Commit Graph

211 Commits

Author SHA1 Message Date
Fangrui Song
aaa97fe8df 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-02-10 11:58:18 +08:00
Fangrui Song
343fa74dc1 Implement initialization option compilationDatabaseCommand on Windows 2019-01-21 12:15:28 +08:00
Fangrui Song
f99cf50456 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-11-09 20:09:13 -08:00
Fangrui Song
dd74d03cfc Adjust FrontendOpts.Inputs[0] for inferred files 2019-11-09 20:09:13 -08:00
Fangrui Song
52e0289245 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-11-09 20:09:13 -08:00
Fangrui Song
c085e07b19 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-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
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
c6c234725a Fix ComputeGuessScore and delete dead code
Thanks to CXuesong
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
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
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
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
857f41c247 project.cc: deduplicate more cases 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
4a1eea75db 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-11-09 20:03:28 -08:00
Fangrui Song
40b47f9ca3 Adapt trunk change and write comments to PCH 2019-11-09 20:03:28 -08:00
Fangrui Song
49dd0ed558 Support workspace folders 2019-11-09 20:03:28 -08:00
Fangrui Song
3c332b91de Clean 2019-11-09 20:03:28 -08:00
Fangrui Song
fa2234c894 Use non-inferred entries and build preamble for .h; index on didOpen if no pending requests; documentHighlight 2019-11-09 20:03:28 -08:00
Fangrui Song
d9541c3222 Add index.initial{Blacklist,Whitelist}
index.{blacklist,whitelist}: disable indexes thoroughly
index.initial{Blacklist,Whitelist}: disable initial loading. will still be indexed after opening
2019-11-09 19:58:32 -08:00
Fangrui Song
3334b2c4b7 Remove clang_utils.* 2019-11-09 19:58:32 -08:00
Fangrui Song
3dea9486b9 Misc
Move using below #include to make preamble happy
textDocument/references: if no references, first line or last line => list where this file is included
malloc_trim() only if files have been indexed in last cycle
Intern: use CachedHashStringRef
2019-11-09 19:58:32 -08:00
Fangrui Song
bf698b85d4 Publish diagnostics of inferred files and change diagnostics.{onChange,onOpen,onSave} from bool to debounce time 2019-11-09 19:58:32 -08:00
Fangrui Song
569a7624a6 intern args 2019-11-09 19:58:32 -08:00
Fangrui Song
1249eb1eb0 Simplify pipeline and fix race 2019-11-09 19:58:32 -08:00
Fangrui Song
4b2f53aa5d Add clang.pathMappings to reuse cache files with differect source paths
Use `>` as the separator.
2019-11-09 19:58:32 -08:00
Riatre Foo
082096b613 Normalize paths on Windows
1. Normalize paths in LSP document URIs and project root to forward
slash and uppercase drive letters.
2. Normalize paths in compile_commands.json to forward slash and
uppercase drive letters.
3. Normalize paths from directory listing to forward slash. (Drive
letter should be same as input dir path, which is already uppercase
since path of project root dir is normalized)
4. Add llvm::sys::path::convert_to_slash after certain llvm::sys::path
and llvm::fs calls.
2019-11-09 19:58:32 -08:00
Fangrui Song
1b367eeb4b Misc 2019-11-09 19:58:32 -08:00
Fangrui Song
0ba4a7f0a9 Implement index.onChange: true; enable spell checking for diagnostics 2019-11-09 19:58:32 -08:00
Fangrui Song
8a2438411e Add clang.excludeArgs and rename diagnostics.onType to onChange 2019-11-09 19:58:32 -08:00
Fangrui Song
6aee7b9648 Remove ASTUnit from indexer and clean up 2019-10-24 01:13:22 -07:00
Fangrui Song
27a5b24b59 Add license notice 2019-10-24 01:01:21 -07:00
Fangrui Song
82962e565b Remove CompileCommandsEntry and reduce clangDriver invocations 2019-10-24 01:01:21 -07:00
Fangrui Song
39787d2851 clang-format
DEF CON 26 CTF
2019-10-24 01:01:21 -07:00
Fangrui Song
bfb759fd09 Misc 2019-10-24 01:01:21 -07:00
Fangrui Song
389418f546 Better bases/derived and initializer 2019-10-24 01:01:20 -07:00
Fangrui Song
134a09a255 Remove libclang 2019-10-24 01:01:20 -07:00
Fangrui Song
ebf07265eb Diagnostics 2019-10-24 01:01:20 -07:00
Fangrui Song
d743743282 Enable clangDriver in project.cc
https://bugs.llvm.org/show_bug.cgi?id=37695 is not fixed. But since we have eliminated libclang for indexing and completion the bug no longer bothers us.
2019-10-24 01:01:20 -07:00
Fangrui Song
aa9cdad54f Use clangTooling 2019-10-24 01:01:20 -07:00
Fangrui Song
32dad17e81 Remove submodule doctest 2019-10-24 01:01:20 -07:00
Fangrui Song
8e4d62212b Misc changes to clangIndex 2019-10-24 01:00:37 -07:00
Fangrui Song
9b9bf1cd19 Fix .. in compdb path; better type alias 2019-10-24 00:17:28 -07:00
Fangrui Song
732e002b13 Infer system include paths from CompilerInvocation 2019-10-24 00:17:28 -07:00
Fangrui Song
18fa5efa2a Add Config->reparseForDependency
Specify 1 if for large projects you don't want to reparse dependents at load time when a common .h changes.
2019-10-24 00:17:28 -07:00
Fangrui Song
806a05b234 Add Config->largeFileSize; pure virtual or defaulted methods are definitions; fix $ccls/callHierarchy 2019-10-24 00:17:28 -07:00