Commit Graph

1907 Commits

Author SHA1 Message Date
Fangrui Song
e3133bea90 cmake_minimum_required 3.8; clean up 2019-11-09 20:09:13 -08:00
Fangrui Song
20e0beb9f3 Rendezvous after receiving "exit" notification (#159) 2019-11-09 20:09:13 -08:00
Fangrui Song
c06c2ca324 Support multiple -init=
Initialization options are applied (deserialized to the same object) in the following order:

* "initializationOptions" from client
* first -init=
* second -init=
* ...

Scalar options will be overridden but arrays will get concatenated, e.g.

ccls -log-file=/dev/stderr -index . -init='{"clang":{"extraArgs":["-DA"]}}' -init='{"clang":{"extraArgs":["-DB"]}}'

results in clang.extraArgs: ["-DA", "-DB"]
2019-11-09 20:09:13 -08:00
Leszek Swirski
25c8928121 Spin IncludeComplete's destructor until scanning completes (#147) 2019-11-09 20:09:13 -08:00
Fangrui Song
c941ca1bcd query: fix UpdateUses when a new entity is seen; simplify {DeclRef,Use,Usr}Update
Thanks to Leszek Swirski
2019-11-09 20:09:13 -08:00
Fangrui Song
a47fb42e30 Refactor serializer
Delete virtual bases Reader & Writer
Delete unused MAKE_REFLECT_STRUCT_WRITER_AS_ARRAY
Merge serializers/{json,binary}.hh into serializer.{hh,cc}
MAKE_REFLECT_STRUCT => REFLECT_STRUCT
MAKE_REFLECT_TYPE_PROXY => REFLECT_UNDERLYING
2019-11-09 20:09:13 -08:00
Fangrui Song
a599aef482 Add ReplyOnce::NotReady and error if didOpen is not seen
Use IgnoringDiagConsumer to override default TextDiagnosticPrinter
2019-11-09 20:09:13 -08:00
Fangrui Song
9ad2450009 Refactor WorkingFiles and CompletionManager
* WorkingFiles::files : vector -> unordered_map
* Add timestamp to WorkingFile

* Rename "comp-preload" thread to "preamble"
* Rename CompletionManager to SemaManager as it is used by "diag" "comp" "preamble"
* Rename clang_complete.* to sema_manager.*
* Merge SemaManager::{preloads,sessions}
* Add initialization option session.maxNum
* In DiagnosticMain, if an included file was modified, cancel the DiagTask and create a PreambleTask instead. The task sets `from_diag` so as to trigger immediate DiagTask after the preamble is built.
2019-11-09 20:09:13 -08:00
Fangrui Song
b9369e055a completion: use Text for Macro{Instantiation,Definition} 2019-11-09 20:09:13 -08:00
Fangrui Song
c6c234725a Fix ComputeGuessScore and delete dead code
Thanks to CXuesong
2019-11-09 20:09:13 -08:00
Fangrui Song
65d856cf8a Merge maybe.hh into utils.hh 2019-11-09 20:09:13 -08:00
Fangrui Song
880c515d64 Merge query.hh and query_util.hh 2019-11-09 20:09:13 -08:00
Fangrui Song
d6dd932e6d Refactor Matcher to use pimpl and merge match.hh into utils.hh 2019-11-09 20:09:13 -08:00
Fangrui Song
38e87a0729 Make EmptyParam empty & rewrite LruCache 2019-11-09 20:09:13 -08:00
Fangrui Song
9603a73421 constexpr std::string_view -> const std::string_view
This works around gcc 7.2/clang rC347417 which have a bad interaction with libstdc++'s implementation of P0426
constexpr std::string_view also emits a string_view object in .rodata that cannot be optimized out by clang (which means larger object file size)

So use good old const.
2019-11-09 20:09:13 -08:00
Fangrui Song
7f8f68c0b2 codeAction: use codeActionProvider: CodeActionOptions and respect CodeActionParams::range 2019-11-09 20:09:13 -08:00
Fangrui Song
19d38bc1d2 Make DocumentLink::range narrower
Thanks to Riatre #135
2019-11-09 20:09:13 -08:00
Fangrui Song
0f0c328a91 completion: delete insertText; don't set filterText if it is the same as label
It decreases Content-Length: from 32K to 25K for the following case:

 #include <bits/stdc++.h>
int main() { std::| }

Also

* make results deterministic when completion text is empty
* sort by newText, label, filterText
2019-11-09 20:09:13 -08:00
Fangrui Song
98be09cc2e serializer: make visitor/vis value/v consistent 2019-11-09 20:09:13 -08:00
Fangrui Song
741d8f2130 Refactor ReplyOnce; error if InitializeParams.rootUri is null 2019-11-09 20:09:13 -08:00
Fangrui Song
8f442c6c35 indexer: handle DecltypeType and empty main file; diag: -Wno-unused-function for headers
Don't replace name with qualified name in Cls::*name
2019-11-09 20:09:13 -08:00
Fangrui Song
e27a5eaff9 .ccls: add %objective-c %objective-cpp
Also allow multiple directives on a line, e.g. %c %cpp -DFOO
2019-11-09 20:09:13 -08:00
Fangrui Song
46d3f075dc Use clang::isIdentifierBody and clean up utils/working_files 2019-11-09 20:09:13 -08:00
Fangrui Song
95bba3ed15 hierarchicalDocumentSymbol: support SymbolKind::Function declaration and uniquify by range
Also ensure selectionRange is a subrange of range, otherwise VSCode won't show the item.
Use detailed_name for 'detail'
2019-11-09 20:09:13 -08:00
Nikolaus Wittenstein
89faa7a6ef Add Apache LICENSE file (#121) 2019-11-09 20:09:13 -08:00
Dso Tsin
e5f7a938b5 Fix VS2017 build issues and add Appveyor CI script (#118) 2019-11-09 20:09:13 -08:00
Fangrui Song
985f5ec4d3 Use SM.isWrittenInMainFile; suppress -Werror in preamble
SM.isWrittenInMainFile is to work around preamble bug: spurious err_pp_unterminated_conditional with circular #include
2019-11-09 20:09:13 -08:00
Fangrui Song
d9a31a72bd hierarchicalDocumentSymbol: display member function declarations 2019-11-09 20:09:13 -08:00
Fangrui Song
aaa5008ec6 Fix some MSVC 2017 errors
Thanks to Dso Tsin!
2019-11-09 20:09:13 -08:00
Fangrui Song
d398e071dc If clang >= 8, delete search path detection and use Sema::CodeCompleteIncludedFile 2019-11-09 20:09:13 -08:00
Fangrui Song
444f0db1f2 Work around relative --sysroot= 2019-11-09 20:09:13 -08:00
Fangrui Song
02a6f39559 Improve semantic highlight in templates 2019-11-09 20:09:13 -08:00
Fangrui Song
09669fff76 Reduce MAKE_REFLECT_STRUCT in lsp.hh
Position -> Pos; lsPosition -> Position
2019-11-09 20:09:13 -08:00
Fangrui Song
0d4f4b68c0 Remove ls prefix from many LSP interfaces
Rename SymbolKind to Kind & lsSymbolKind to SymbolKind
Use textDocumentSync: TextDocumentSyncOptions
2019-11-09 20:09:13 -08:00
Fangrui Song
9a6851c6a5 Misc 2019-11-09 20:09:13 -08:00
Fangrui Song
353b398a73 Simplify and work around vscode _sortTextLow 2019-11-09 20:09:13 -08:00
Fangrui Song
857f41c247 project.cc: deduplicate more cases 2019-11-09 20:09:13 -08:00
Fangrui Song
c598f3ebbd Fix EnumConstantDecl's kind & EnumDecl's vars 2019-11-09 20:09:13 -08:00
Fangrui Song
c8e57ee7b3 textDocument/references workspace/symbol: add folders
For textDocument/reference, base/excludeRole/role has been lifted from params.context.* to params.*
2019-11-09 20:09:13 -08:00
Fangrui Song
c4bf9c5d6a Report InvalidParams for serialization error 2019-11-09 20:09:13 -08:00
Fangrui Song
c1422c7a8d Simplify and better compatibility with encodings retaining the feature of low bytes being 1-byte characters 2019-11-09 20:09:13 -08:00
Fangrui Song
bbce333042 *.h -> *.hh 2019-11-09 20:09:13 -08:00
Fangrui Song
3cd0ee2fc7 Refactor message handler and namespace ccls 2019-11-09 20:09:11 -08:00
Fangrui Song
8fa853c321 Implement textDocument/documentLink 2019-11-09 20:03:28 -08:00
Fangrui Song
617cdd89de Implement textDocument/foldingRange 2019-11-09 20:03:28 -08:00
David F
f6472061d3 Fix broken link in README.md (#101) 2019-11-09 20:03:28 -08:00
Fangrui Song
4f8889c195 Deprioritize completion items with additionTextEdits 2019-11-09 20:03:28 -08:00
Fangrui Song
dc20ea3b33 Fix textDocument/implementation 2019-11-09 20:03:28 -08:00
Fangrui Song
66bf514b5f Add command line option -index=root to index without starting language server 2019-11-09 20:03:28 -08:00
Fangrui Song
a56b6fb228 Improve DeducedType 2019-11-09 20:03:28 -08:00