Commit Graph

1794 Commits

Author SHA1 Message Date
Fangrui Song
a3e635fb09 Make EmptyParam empty & rewrite LruCache 2019-10-24 18:37:54 -07:00
Fangrui Song
6379beb9ba 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-10-24 18:37:54 -07:00
Fangrui Song
385eb582c8 codeAction: use codeActionProvider: CodeActionOptions and respect CodeActionParams::range 2019-10-24 18:37:54 -07:00
Fangrui Song
38227e2bd5 Make DocumentLink::range narrower
Thanks to Riatre #135
2019-10-24 18:37:54 -07:00
Fangrui Song
8fc6b8a9f4 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-10-24 18:37:54 -07:00
Fangrui Song
9d767ffa99 serializer: make visitor/vis value/v consistent 2019-10-24 18:37:54 -07:00
Fangrui Song
e6300aeb57 Refactor ReplyOnce; error if InitializeParams.rootUri is null 2019-10-24 18:37:54 -07:00
Fangrui Song
008b1762c1 indexer: handle DecltypeType and empty main file; diag: -Wno-unused-function for headers
Don't replace name with qualified name in Cls::*name
2019-10-24 18:37:54 -07:00
Fangrui Song
2d00b62f63 .ccls: add %objective-c %objective-cpp
Also allow multiple directives on a line, e.g. %c %cpp -DFOO
2019-10-24 18:37:54 -07:00
Fangrui Song
c2cf488114 Use clang::isIdentifierBody and clean up utils/working_files 2019-10-24 18:37:54 -07:00
Fangrui Song
d2969b5185 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-10-24 18:37:54 -07:00
Nikolaus Wittenstein
8b2076e158 Add Apache LICENSE file (#121) 2019-10-24 18:37:54 -07:00
Dso Tsin
6100a7a0d6 Fix VS2017 build issues and add Appveyor CI script (#118) 2019-10-24 18:37:54 -07:00
Fangrui Song
2e16b3c6bb Use SM.isWrittenInMainFile; suppress -Werror in preamble
SM.isWrittenInMainFile is to work around preamble bug: spurious err_pp_unterminated_conditional with circular #include
2019-10-24 18:37:54 -07:00
Fangrui Song
6283f7e919 hierarchicalDocumentSymbol: display member function declarations 2019-10-24 18:37:54 -07:00
Fangrui Song
c84895e39d Fix some MSVC 2017 errors
Thanks to Dso Tsin!
2019-10-24 18:37:54 -07:00
Fangrui Song
cb06324c13 If clang >= 8, delete search path detection and use Sema::CodeCompleteIncludedFile 2019-10-24 18:37:54 -07:00
Fangrui Song
3e39b86981 Work around relative --sysroot= 2019-10-24 18:37:54 -07:00
Fangrui Song
ceeae84662 Improve semantic highlight in templates 2019-10-24 18:37:54 -07:00
Fangrui Song
6dfe5d1c4f Reduce MAKE_REFLECT_STRUCT in lsp.hh
Position -> Pos; lsPosition -> Position
2019-10-24 18:37:54 -07:00
Fangrui Song
50736827ca Remove ls prefix from many LSP interfaces
Rename SymbolKind to Kind & lsSymbolKind to SymbolKind
Use textDocumentSync: TextDocumentSyncOptions
2019-10-24 18:37:54 -07:00
Fangrui Song
6517f9f143 Misc 2019-10-24 18:37:54 -07:00
Fangrui Song
85b449df03 Simplify and work around vscode _sortTextLow 2019-10-24 18:37:54 -07:00
Fangrui Song
b0863ba366 project.cc: deduplicate more cases 2019-10-24 18:37:54 -07:00
Fangrui Song
041ce5b6f1 Fix EnumConstantDecl's kind & EnumDecl's vars 2019-10-24 18:37:54 -07:00
Fangrui Song
9b0ff9f9ea textDocument/references workspace/symbol: add folders
For textDocument/reference, base/excludeRole/role has been lifted from params.context.* to params.*
2019-10-24 18:37:54 -07:00
Fangrui Song
4c6278c152 Report InvalidParams for serialization error 2019-10-24 18:37:54 -07:00
Fangrui Song
ca550720e4 Simplify and better compatibility with encodings retaining the feature of low bytes being 1-byte characters 2019-10-24 18:37:54 -07:00
Fangrui Song
e3a2f1a9a8 *.h -> *.hh 2019-10-24 18:37:54 -07:00
Fangrui Song
67eb1e6b23 Refactor message handler and namespace ccls 2019-10-24 18:37:53 -07:00
Fangrui Song
05929b8afb Implement textDocument/documentLink 2019-10-24 18:37:35 -07:00
Fangrui Song
6de2789635 Implement textDocument/foldingRange 2019-10-24 18:37:35 -07:00
David F
f4bac72e47 Fix broken link in README.md (#101) 2019-10-24 18:37:35 -07:00
Fangrui Song
2180320540 Deprioritize completion items with additionTextEdits 2019-10-24 18:37:35 -07:00
Fangrui Song
65fc01c671 Fix textDocument/implementation 2019-10-24 18:37:35 -07:00
Fangrui Song
6ce79155a9 Add command line option -index=root to index without starting language server 2019-10-24 18:37:35 -07:00
Fangrui Song
a1094c0897 Improve DeducedType 2019-10-24 18:37:35 -07:00
Fangrui Song
610798f634 Improve extent of definition/declaration; uniquify typeDefinition 2019-10-24 18:37:35 -07:00
Fangrui Song
ca1edb582e Simplify 2019-10-24 18:37:35 -07:00
Fangrui Song
556e611573 Add ExtentRef; merge symbol2refcnt and outline2refcnt
Fix hierarchical document symbol for namespaces when there are multiple declarations.
2019-10-24 18:37:35 -07:00
Fangrui Song
6deadc5f24 Add pipeline::{Notify,Reply,ReplyError} and simplify message handling
Delete method.{cc,h}
Rename $ccls/setSkippedRanges to $ccls/publishSkippedRanges
Rename $ccls/publishSemanticHighlighting to $ccls/publishSemanticHighlight; stableId -> id
2019-10-24 18:37:35 -07:00
Fangrui Song
8fea558f95 Misc changes to project
* Better LanguageId detection with clangDriver (e.g. .cu -> types::TY_CUDA)
* fallback when there is no .ccls or compile_commands.json

Also Hide clangTooling options from --help
2019-10-24 18:37:35 -07:00
Fangrui Song
78e323b662 Adapt trunk change and write comments to PCH 2019-10-24 18:37:35 -07:00
Fangrui Song
af5f6a53a9 -DSYSTEM_CLANG=off: 6.0.1 -> 7.0.0 2019-10-24 18:37:35 -07:00
Riatre Foo
5a442dfb53 Fix hierarchical document symbol
1. Fixed a bug on building document symbol tree: As sym2ds was updated in
place, nested funcs/types may be moved into children of another
lsDocumentSymbol before itself got processed.

2. Namespaces only have declarations, in the old implementation it wasn't included in the result, making the result less hierarchical. This
commit fixes this by including the declarations of a symbol if no
definitions found.
2019-10-24 18:37:35 -07:00
Fangrui Song
5fb2407685 Add namespace alias clang::vfs = llvm::vfs to adapt D52783
vfs::x should be written as llvm::vfs::x to work around a [namepace.udir] bug before GCC 8 when namespace alias is used
2019-10-24 18:37:35 -07:00
Fangrui Song
56c70ad1fd Namespace: improve indexer and don't trace bases in $ccls/member 2019-10-24 18:37:35 -07:00
Riatre Foo
d98965d8d9 Fix additionalTextEdits -> textEdit hack for VS Code (#89)
* Fix additionalTextEdits -> textEdit hack for VS Code

Visual Studio Code filters the completion result according to
textEdit.range and filterText, if the textEdit.range overlaps with
existing text, we have to include it in filterText, otherwise it would
be filtered out.

* Fix has_open_paren in FilterCandidates
2019-10-24 18:37:35 -07:00
Fangrui Song
3bf5002c98 Support workspace folders 2019-10-24 18:37:35 -07:00
Fangrui Song
798cf7852d Improve completion
blacklist some undesired candidates
additionalTextEdits if clang>=7
Use CodePatterns for preprocessor directive completion if there is a #
Prefer textEdit over insertText
2019-10-24 18:37:35 -07:00