Commit Graph

1873 Commits

Author SHA1 Message Date
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
Fangrui Song
03df4085fb Make hover more detailed (e.g. include inheritance info) 2019-10-24 18:37:55 -07:00
Fangrui Song
ea852374a2 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-10-24 18:37:55 -07:00
Fangrui Song
c63121d7c6 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-10-24 18:37:55 -07:00
Leszek Swirski
33a1982e85 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-10-24 18:37:55 -07:00
Fangrui Song
c00f493fcc indexer: change Pos computation from byte offset to UTF-8 encoded code point offset 2019-10-24 18:37:55 -07:00
Fangrui Song
a833b0cb22 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-10-24 18:37:55 -07:00
Fangrui Song
8f9973f03c 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-10-24 18:37:55 -07:00
Fangrui Song
520991c009 Compute CompletionItemKind from Declaration instead of CursorKind 2019-10-24 18:37:55 -07:00
Riatre Foo
0793510541 Fix is_local for vars with non-auto storage period 2019-10-24 18:37:55 -07:00
Riatre Foo
90357034df textDocument/signatureHelp: enable documentation 2019-10-24 18:37:55 -07:00
Fangrui Song
823aea0207 Log {Request,Notification}Message, and timestamp change due to dependency 2019-10-24 18:37:55 -07:00
Riatre Foo
b5b7e9b7e2 Fix completion result sorting in VSCode (#210)
Fix #207
2019-10-24 18:37:55 -07:00
Fangrui Song
c4cc5d2697 cmake: delete SYSTEM_CLANG and auto-download mechanism 2019-10-24 18:37:55 -07:00