Commit Graph

1886 Commits

Author SHA1 Message Date
Evgenii Balai
27385aef6e Correct comment about completion cache 2019-11-08 02:06:58 -05:00
Evgenii Balai
dc4d0f7748 completion: do not invalidate cache when adding new characters 2019-11-08 02:06:53 -05:00
Fangrui Song
396d0668af cmake: support CLANG_LINK_CLANG_DYLIB 2019-11-01 10:46:17 -07:00
Fangrui Song
bfac2162eb Infer -target and --driver-mode from argv[0]
Fix #511
2019-10-31 23:30:02 -07:00
Fangrui Song
3e04997061 Fix some clang-tidy warnings
Incorporated some fixes by Daniel Chabrowski (#467)
2019-10-24 18:37:55 -07:00
Fangrui Song
e941ffa5fb Add initialization option completion.placeholder; change client.snippetSupport: false to drop ( and <
* client.snippetSupport: false => `foo`
* client.snippetSupport: true
  + completion.placeholder: false => `foo($1)$0` `bar<$1>()$0`
  + completion.placeholder: true => `foo(${1:int a}, ${2:int b})$0` `bar<${1:typename T}>()$0`

Note, client.snippetSupport is always false if the client does not support snippets.

Close #412
2019-10-24 18:37:55 -07:00
Fangrui Song
1a41d2dbd1 completion: don't reuse cache if the buffer line has changed
Fix emacs-ccls#54
2019-10-24 18:37:55 -07:00
Fangrui Song
8ddc0550c0 project: strip -Xclang <arg> 2019-10-24 18:37:55 -07:00
Fangrui Song
4534393ca1 indexer: disable warnings and skip processed function bodies
Adapt clang rC370337: removal of createIndexingAction and WrappingIndexAction
2019-10-24 18:37:55 -07:00
Fangrui Song
5422afe35a indexer: llvm::sys::fs::UniqueID -> clang::FileID
Fix a minor issue that an empty included file is not recorded.

Note, we need to skip invalid uid2lid_and_path because
otherwise lid2path may contain invalid entries with lid: 0,
which will cause the file entry with file_id 0 to have an empty path.
2019-10-24 18:37:55 -07:00
Fangrui Song
97af6fb889 💥 Rename FunctionName -> functionName, VarName -> var_name 2019-10-24 18:37:55 -07:00
Fangrui Song
fc8074bbf5 textDocument/definition: don't jump to the type definition 2019-10-24 18:37:55 -07:00
Fangrui Song
2cc81d2371 project: allow absolute compilationDatabaseDirectory
Fix #466
2019-10-24 18:37:55 -07:00
Shengjing Zhu
07ed9902e0 Support override CLANG_RESOURCE_DIR
The result from clang commandline is something like
/usr/lib/llvm-7/lib/clang/7.0.1

Which means I need to recompile when the clang is upgraded to newer 7.x.x

However the system has a convenient symlink, which is
/usr/include/clang/7.
2019-10-24 18:37:55 -07:00
Fangrui Song
689c19a5af Construct SourceManager with UserFilesAreVolatile
Fix #235. Close #453

In clang, it may be worth generalizing UserFilesAreVolatile (introduced in rC160074) to FilesAreVolatile.
2019-10-24 18:37:55 -07:00
Fangrui Song
b400049ced project: improve ComputeGuessScore heuristics 2019-10-24 18:37:55 -07:00
Fangrui Song
582d9940f0 Support indexing non-existent files in index.onChange:true mode 2019-10-24 18:37:55 -07:00
Fangrui Song
df17dd0952 $ccls/fileInfo: optionally dump dependencies, includes and skipped_ranges 2019-10-24 18:37:55 -07:00
Riatre Foo
7631a92fcc Change RequestId::value from int to std::string to allow non-numeric IDs. 2019-10-24 18:37:55 -07:00
Dan Čermák
0061c76a7f Only add include directories for LLVM, clang & rapidjson if they are not in CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES
/usr/include/c++/9 comes before /usr/include in `{clang,gcc} -v -fsyntax-only -xc++ /dev/null`.

    target_include_directories(ccls SYSTEM PRIVATE ${RapidJSON_INCLUDE_DIRS})

If ${RapidJSON_INCLUDE_DIRS} resolves to /usr/include, /usr/include will
be shuffled before /usr/include/c++/9 and will cause `#include_next <stdlib.h>`
issues (see https://github.com/MaskRay/ccls/pull/417).

Check if the include directories are already in CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES.
2019-10-24 18:37:55 -07:00
Fangrui Song
79d6c27ae1 project: support %cu directive and strip -M* options 2019-10-24 18:37:55 -07:00
Fangrui Song
0b47af2310 pipeline: report changed arg 2019-10-24 18:37:55 -07:00
Fangrui Song
1485c5064f Adapt rL364464: clang::FrontendAction::Execute returns llvm::Error instead of bool 2019-10-24 18:37:55 -07:00
TÖRÖK Attila
8d9728e847 threaded_queue.hh: fix -Wpessimizing-move (#409) 2019-10-24 18:37:55 -07:00
Fangrui Song
1a7ace9ccb utils.hh: work around MSVC STL bug 2019-10-24 18:37:55 -07:00
Fangrui Song
71c8fb108c Set Diag::concerned if any of its Notes is concerned 2019-10-24 18:37:55 -07:00
Fangrui Song
09207e605e Adapt llvm rL360179: Option may have multiple OptionCategory's 2019-10-24 18:37:55 -07:00
Fangrui Song
caf292afb9 Refactor FindEntry and use best-fit .ccls
Fixes an issue with hierarchical .ccls found by Riatre in #384
2019-10-24 18:37:55 -07:00
Fangrui Song
85df23729a JsonWriter: write "null" if VersionedTextDocumentIdentifier.version is null
Fix #387
2019-10-24 18:37:55 -07:00
Riatre Foo
2cdd3b9e26 Append '/' before populating folder.dot_ccls 2019-10-24 18:37:55 -07:00
Fangrui Song
9dc5a6f90b Adapt clang rC358696: removal of OutputIsBinary 2019-10-24 18:37:55 -07:00
Fangrui Song
75bce7f78a Set RetainCommentsFromSystemHeaders to true
Note with -fretain-comments-from-system-headers, the .gch of bits/stdc++.h becomes larger by 1%, but that is fine.

And improve comment handling in textDocument/hover

Fix #373
2019-10-24 18:37:55 -07:00
Fangrui Song
29f3071cf7 Set RetainRemappedFileBuffers to true
Reported by David Welch in #350.

This fixes double-free of llvm::MemoryBuffer when parsing fails.
2019-10-24 18:37:55 -07:00
Fangrui Song
1c99760561 Add error checking of object deserialization; ignore non-object initializationOptions 2019-10-24 18:37:55 -07:00
Fangrui Song
c0541342e9 Adapt clang rC357037: removal of setVirtualFileSystem 2019-10-24 18:37:55 -07:00
Fangrui Song
be8b1043a0 Add initialization option index.initialNoLinkage: false
By default, the background indexer doesn't handle names of no linkage.
They are indexed when their files are opened. This saves memory and
makes cache files smaller.
2019-10-24 18:37:55 -07:00
Paul Smith
157551f413 Enhance the output of --version with Git describe results. (#342) 2019-10-24 18:37:55 -07:00
Fangrui Song
0272a044dc Change containers of Query*::Def fields from std::vector to ccls::Vec
Query*::Def contain several immutable std::vector fields. Change them to
ccls::Vec to save bytes which were wasted by `capacity`.
2019-10-24 18:37:55 -07:00
Fangrui Song
e8f40da198 Add initialization option index.name.suppressUnwrittenScope (default: false) 2019-10-24 18:37:55 -07:00
Fangrui Song
7fb4b291ae If the workspace folder is a symlink, convert paths relative to it (#314)
If the workspace folder is a symlink and the client doesn't follow it.
Treat /tmp/symlink/ as canonical and convert every /tmp/real/ path to
/tmp/symlink/.
2019-10-24 18:37:55 -07:00
Fangrui Song
70142fb0bd cmake: use {LLVM,Clang}Config.cmake
Combined Daan De Meyer's #227 with other simplification

* USE_SHARED_LLVM is deleted in favor of LLVM_LINK_LLVM_DYLIB
* LLVM_ENABLE_RTTI is deleted as it is provided by LLVMConfig.cmake
* Only direct Clang/LLVM dependencies are required in target_link_libraries
* Restrict -DCLANG_RESOURCE_DIRECTORY= to src/utils.cc
2019-10-24 18:37:55 -07:00
Fangrui Song
58207b0700 Add excludeRole to documentSymbol and override declaration's range/selectionRange with definition's 2019-10-24 18:37:55 -07:00
Fangrui Song
e9a9384cfd cmake: add option to use system rapidjson if exists 2019-10-24 18:37:55 -07:00
Fangrui Song
52180f1f1f Misc 2019-10-24 18:37:55 -07:00
Fangrui Song
b1bb8ffd97 Make clang.excludeArgs accept glob patterns 2019-10-24 18:37:55 -07:00
Fangrui Song
c765d3564f stdin: synthesize an "exit" NotificationMessage in abnormal termination 2019-10-24 18:37:55 -07:00
Fangrui Song
c4545782da textDocument/rename: mitigate edits in the same place and edits in macro replacement
Mitigate edits in the same place (#294) and:

// textDocument/rename on `f`
void f();
void g() { m(); } // incorrectly rewrote m() before
2019-10-24 18:37:55 -07:00
Fangrui Song
7d3121b012 Add .github/ISSUE_TEMPLATE
Adapted from https://github.com/hlissner/doom-emacs
2019-10-24 18:37:55 -07:00
Fangrui Song
ce3769f066 working_files: normalize \r\n and \n to \n
Clients may normalize end-of-line sequences, thus cause a mismatch
between index_lines and buffer_lines.

Thanks to CXuesong for reporting this issue!
2019-10-24 18:37:55 -07:00
Fangrui Song
baae464195 Change Pos::line from int16_t to uint16_t
This allows representing line 0 ~ 65535.
2019-10-24 18:37:55 -07:00