Commit Graph

1858 Commits

Author SHA1 Message Date
Fangrui Song
b2f32788d3 Adapt clang rC358696: removal of OutputIsBinary 2019-05-13 00:26:55 -07:00
Fangrui Song
2e6aed4408 Set declarationProvider 2019-05-13 00:26:55 -07:00
Fangrui Song
99930623ef 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-05-13 00:26:55 -07:00
Fangrui Song
b69f62c2bc Set RetainRemappedFileBuffers to true
Reported by David Welch in #350.

This fixes double-free of llvm::MemoryBuffer when parsing fails.
2019-05-13 00:26:55 -07:00
Fangrui Song
aded3faf97 Add error checking of object deserialization; ignore non-object initializationOptions 2019-05-13 00:26:55 -07:00
Fangrui Song
a41b976a77 Adapt clang rC357037: removal of setVirtualFileSystem 2019-05-13 00:26:55 -07:00
Fangrui Song
0846c12e89 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-05-13 00:26:55 -07:00
Paul Smith
2c11b0dc47 Enhance the output of --version with Git describe results. (#342) 2019-05-13 00:26:55 -07:00
Fangrui Song
f3cfdb2781 clang.pathMappings: use > instead of : as the separator 2019-05-13 00:26:55 -07:00
Fangrui Song
4276c2b383 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-05-13 00:26:55 -07:00
Fangrui Song
a0e76254de Add initialization option index.name.suppressUnwrittenScope (default: false) 2019-05-13 00:26:55 -07:00
Fangrui Song
4e10504a6d 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-05-13 00:26:55 -07:00
Fangrui Song
977e14c862 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-05-13 00:26:55 -07:00
Fangrui Song
b8e0fe9812 Add excludeRole to documentSymbol and override declaration's range/selectionRange with definition's 2019-05-13 00:26:55 -07:00
Fangrui Song
e73f5791bf cmake: add option to use system rapidjson if exists 2019-05-13 00:26:55 -07:00
Fangrui Song
ba68f49861 Misc 2019-05-13 00:26:55 -07:00
Fangrui Song
7e752c1901 Make clang.excludeArgs accept glob patterns 2019-05-13 00:26:55 -07:00
Fangrui Song
cff00a8711 stdin: synthesize an "exit" NotificationMessage in abnormal termination 2019-05-13 00:26:55 -07:00
Fangrui Song
401f057027 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-05-13 00:26:55 -07:00
Fangrui Song
887535b8fb Add .github/ISSUE_TEMPLATE
Adapted from https://github.com/hlissner/doom-emacs
2019-05-13 00:26:55 -07:00
Fangrui Song
05658ef966 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-05-13 00:26:55 -07:00
Fangrui Song
c4ab72500b Change Pos::line from int16_t to uint16_t
This allows representing line 0 ~ 65535.
2019-05-13 00:26:55 -07:00
Fangrui Song
43774f2c11 Make hover more detailed (e.g. include inheritance info) 2019-05-13 00:26:55 -07:00
Fangrui Song
048f1dc7a5 indexer: index TemplateTypeParmDecl and ParmVarDecl in declarations for clang >= 9
Index ParmVarDecl in declarations if index.parametersInDeclarations is true

And support some unhandled Decl::Kind
2019-05-13 00:26:55 -07:00
Fangrui Song
05d1fbfc5b Add cache.{hierarchicalPath,retainInMemory}
cache.hierarchicalPath: store cache files as $directory/a/b/c.cc.blob to
work around NAME_MAX limitation.

cache.retainInMemory: after this number of loads, keep a copy of file
index in memory. If set to 1, it avoids cache corruption if the index
file is changed after the initial load, which may happen if several
language clients open the same project and share the same cache
directory.

Also rename cacheDirectory cacheFormat to cache.{directory,format}
2019-05-13 00:26:55 -07:00
Leszek Swirski
3a252fc0ad Use DiagnosticRelatedInformation if client supports publishDiagnostics.relatedInformation (#276)
In clients that support DiagnosticRelatedInformation, display
clang notes as these nested diagnostics rather than appending
them to the parent diagnostic's message. Behaviour for clients
that don't support related information should be unchanged.
2019-05-13 00:26:46 -07:00
Fangrui Song
ea774dadf5 indexer: change Pos computation from byte offset to UTF-8 encoded code point offset 2019-03-17 18:50:25 -07:00
Fangrui Song
3f6ece0a44 Add initialization option capabilities.* and index.maxInitializerLines
indexer.cc: use index.maxInitializerLines instead of kInitializerMaxLines

messages/initialize.cc: some ServerCapabilities are toggable:

documentOnTypeFormattingProvider.firstTriggerCharacter
foldingRangeProvider
workspace.workspaceFolders.supported
2019-03-17 18:50:25 -07:00
Fangrui Song
6185d69d9d GetFallback: append clang.extraArgs
When compile_commands.json is absent, GetFallback is called to get
default clang command line when there is no .ccls or .ccls is empty.
2019-03-17 18:50:25 -07:00
Fangrui Song
8724985388 Compute CompletionItemKind from Declaration instead of CursorKind 2019-03-17 18:50:25 -07:00
Riatre Foo
233ed4f741 Fix is_local for vars with non-auto storage period 2019-03-17 18:50:25 -07:00
Riatre Foo
e4ba51aea3 textDocument/signatureHelp: enable documentation 2019-03-17 18:50:25 -07:00
Fangrui Song
f1efcb80c7 Log {Request,Notification}Message, and timestamp change due to dependency 2019-03-17 18:50:25 -07:00
Riatre Foo
d4de474be1 Fix completion result sorting in VSCode (#210)
Fix #207
2019-03-17 18:50:25 -07:00
Fangrui Song
9bc762961a cmake: delete SYSTEM_CLANG and auto-download mechanism 2019-03-17 18:50:25 -07:00
Fangrui Song
b2fcec4b97 Implement initialization option compilationDatabaseCommand on Windows 2019-03-17 18:50:25 -07:00
Fangrui Song
0dbf6c89f1 Drop support for clang 6 2019-03-17 18:50:25 -07:00
Fangrui Song
26fb0a9dd3 Add -log-file=stderr and make it default
Change -log-file-append to a boolean flag
2019-03-17 18:50:25 -07:00
Fangrui Song
d6329ea328 completion: if preamble size changes, rebuild it
Fix #190

If a new header is added, the preamble size changes. Language clients may cache completion results, thus we rebuild preamble to avoid inaccurate results.
2019-03-17 18:50:25 -07:00
Fangrui Song
87d7c40903 Update wiki link 2019-03-17 18:50:25 -07:00
Fangrui Song
7b3aca2952 textDocument/didOpen: index related files when a header is opened
Fix #180

index.initialBlacklist: ["."] can inhibit initial indexing (useful for larger code bases).
Opened files are still indexed, though.
This heuristic allows related files (a/foo.c a/b/foo.cc) to be indexed when a header (foo.h) is opened.
2019-03-17 18:50:25 -07:00
Fangrui Song
9a529bd691 Delay requests if the document has not not indexed (#176)
This fixes a plethora of "not indexed" errors when the document has not been indexed.

* Message handler throws NotIndexed if not overdue
* The message is put into backlog and tagged with backlog_path
* path2backlog[path] tracks backlog associated with document `path`
* The backlog is cleared when the index is merged
* backlog[0] is forced to run if it becomes overdue
2019-03-17 18:50:25 -07:00
Fangrui Song
e8cacf1efa Adjust FrontendOpts.Inputs[0] for inferred files 2019-03-17 18:50:25 -07:00
Fangrui Song
cbd36aeedb Handle file deletion and register workspace/didChangeWatchedFiles
* In the "initialized" callback, send client/registerCapability with DidChangeWatchedFilesRegistrationOptions
* In workspace/didChangeWatchedFiles callback, call pipeline::Index
* In pipeline::Index, add a `deleted` status
2019-03-17 18:50:25 -07:00
Fangrui Song
828c21c8d7 Make cacheDirectory related to project root; delete Timer 2019-03-17 18:50:25 -07:00
Fangrui Song
f2df43055f completion: ignore CXXDeductionGuide
Fix #173
2019-03-17 18:50:25 -07:00
Fangrui Song
573bfc27a1 Extend .ccls
* Add %h for C header files (the suffix .h is considered a C header, not a C++ header)
* Add %hpp for C++ header files
* If .ccls exists, it provides full command line for files not specified by compile_commands.json (before, compile_commands.json was ignored)
* If the first line of .ccls is %compile_commands.json, it appends flags to compile_commands.json "arguments", instead of overriding.
  Files not specified by compile_commands.json will not be added to folder.entries, but their command line can be inferred from other files.

Also fix `#include <` completion of -I flags for clang < 8
2019-03-17 18:50:21 -07:00
Fangrui Song
8ca0978804 Make -v=1 work and log cflags for SemaManager session and Indexer 2019-01-12 00:40:49 +08:00
Fangrui Song
18e4be616c Add strict to FuzzyMatcher::Match
In completion, underscore prefixed builtin macros may be annoying when the first type character is not an underscore.

When `strict` is true, `Match` enforces the first characters should be loosely of the same category.
2019-01-12 00:40:49 +08:00
Fangrui Song
e0a6db8d9b ParameterInformation: use label: [number, number]
Don't bother checking signatureHelp.signatureInformationparameterInformation.labelOffsetSupport
2019-01-12 00:40:49 +08:00