Commit Graph

1879 Commits

Author SHA1 Message Date
Fangrui Song
d417597a11 indexer: disable warnings and skip processed function bodies 2019-08-22 20:08:48 -07:00
Fangrui Song
646aca5b7f indexer: llvm::sys::fs::UniqueID -> clang::FileID 2019-08-22 20:08:47 -07:00
Fangrui Song
459091af4f textDocument/definition: don't jump to the type definition 2019-08-22 02:24:20 -07:00
Fangrui Song
03263c8521 project: allow absolute compilationDatabaseDirectory
Fix #466
2019-08-16 19:34:22 -07:00
Shengjing Zhu
9079c48c77 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-08-16 08:23:15 +08:00
Fangrui Song
8b0332173f Construct SourceManager with UserFilesAreVolatile
Fix #235. Close #453

In clang, it may be worth generalizing UserFilesAreVolatile (introduced in rC160074) to FilesAreVolatile.
2019-07-31 19:29:34 -07:00
Fangrui Song
af72b59d88 project: improve ComputeGuessScore heuristics 2019-07-22 06:51:18 -07:00
Fangrui Song
cdc24e9731 Support indexing non-existent files in index.onChange:true mode 2019-07-20 17:33:50 -07:00
Fangrui Song
0e8c9db44d $ccls/fileInfo: optionally dump dependencies, includes and skipped_ranges 2019-07-20 02:59:59 -07:00
Riatre Foo
eb752497e8 Change RequestId::value from int to std::string to allow non-numeric IDs. 2019-07-16 14:39:35 +08:00
Dan Čermák
990925d806 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-06-30 23:45:57 -07:00
Fangrui Song
796c75794e project: support %cu directive and strip -M* options 2019-06-30 23:45:56 -07:00
Fangrui Song
cc7e0dde33 pipeline: report changed arg 2019-06-27 03:24:25 -07:00
Fangrui Song
cf997dc680 Adapt rL364464: clang::FrontendAction::Execute returns llvm::Error instead of bool 2019-06-27 03:24:20 -07:00
TÖRÖK Attila
9f25474e73 threaded_queue.hh: fix -Wpessimizing-move (#409) 2019-06-18 14:45:20 +08:00
Fangrui Song
f54fac0303 utils.hh: work around MSVC STL bug 2019-06-17 23:42:48 -07:00
Fangrui Song
d3808de26a Set Diag::concerned if any of its Notes is concerned 2019-05-13 00:26:55 -07:00
Fangrui Song
b059ea3262 Adapt llvm rL360179: Option may have multiple OptionCategory's 2019-05-13 00:26:55 -07:00
Fangrui Song
6624108fd9 Refactor FindEntry and use best-fit .ccls
Fixes an issue with hierarchical .ccls found by Riatre in #384
2019-05-13 00:26:55 -07:00
Fangrui Song
16bd93b24b JsonWriter: write "null" if VersionedTextDocumentIdentifier.version is null
Fix #387
2019-05-13 00:26:55 -07:00
Riatre Foo
9e884fca80 Append '/' before populating folder.dot_ccls 2019-05-13 00:26:55 -07:00
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