Jacob Dufault
93ba0c532b
For completion, only tell clang about relevant dirty working files.
...
The heuristic may not be perfect, but it is probably good enough.
clang_codeCompleteAt seems to get slower as more and more CXUnsavedFile
instances are uploaded.
2018-01-12 09:39:05 -08:00
rianneogi
27dad9a277
Moved lines above
2018-01-12 09:36:17 -08:00
rianneogi
2f8d11e5ff
Always do completion on manual trigger.
2018-01-12 09:36:17 -08:00
rianneogi
a324178fcb
changed size()==0
to empty()
2018-01-12 09:36:17 -08:00
rianneogi
dc00d320ec
Fix autocompletion results on semicolon
2018-01-12 09:36:17 -08:00
scturtle
16f6fdbef1
Fix shrinking region. ( #290 )
2018-01-12 08:44:11 -08:00
Daniel Martín
a7215c233c
Add unit test for conversion from clang-format edits to LSP ranges
2018-01-11 17:33:51 -08:00
Daniel Martín
903d517b0a
Convert to snake case
2018-01-11 17:33:51 -08:00
Jacob Dufault
cc1fbada4b
Don't crash in completion if there is no working file.
2018-01-11 00:35:15 -08:00
Jacob Dufault
beba312a5f
Add VerifyUnique in querydb, disabled by default.
...
Will be used later to validate querydb behavior.
2018-01-11 00:35:15 -08:00
Fangrui Song
4d07189b47
Comment optional<T> in serializers and remove redundant Writer ReflectMember on std::vector
2018-01-11 00:32:28 -08:00
Fangrui Song
5f1aa34a9c
Comment serializer
2018-01-11 00:07:54 -08:00
Fangrui Song
6fb1798692
Use @ as escape character of cache filenames
...
Fixes #112
2018-01-10 23:57:42 -08:00
Fangrui Song
27ddce4cd6
Reader reflection of std::variant<Ts...>
2018-01-10 23:17:27 -08:00
Jacob Dufault
b2672c6009
Fix a new file in the session not generating an index.
2018-01-10 21:27:58 -08:00
Jacob Dufault
786ac0bc4f
Merge FileContents and FileContentsWithOffsets.
...
Also try to more aggressively load FileContents when indexing to increase reliability.
2018-01-10 21:16:46 -08:00
Jacob Dufault
7de2a733c8
Fix windows path normalization
2018-01-10 20:07:50 -08:00
Jacob Dufault
05b577c9fa
Fix progress not always going to zero
2018-01-10 19:56:47 -08:00
Jacob Dufault
54394ed868
Format
2018-01-10 18:43:01 -08:00
Jacob Dufault
5605dfbb00
Always normalize project file entry when passing it to clang.
...
This makes clang_codeCompleteAt much faster.
2018-01-10 18:33:36 -08:00
Daniel Martín
1836a50a48
Add unit tests for formatting documents and document ranges
2018-01-10 18:11:59 -08:00
Fangrui Song
a8d403426d
using lsRequestId = std::variant<std::monostate, int64_t, std::string>;
...
Emacs lsp-mode uses (gethash "id" json-data) to handle asynchronous
requests. The JavaScript `Number` type is really a hindrance.
2018-01-10 10:45:31 -08:00
Fangrui Song
38bfd26750
Add <iostream>
2018-01-10 10:08:39 -08:00
Chao Shen
6a03a86e64
Hack to restrict the region.
2018-01-10 09:42:54 -08:00
Fangrui Song
0e5e2a6ca5
Fix build
2018-01-10 00:21:55 -08:00
Fangrui Song
a8aa94d4ba
Fix build
2018-01-10 00:15:58 -08:00
Fangrui Song
060b92b214
Change lsVersionedTextDocumentIdentifier::version to variant<monostate,int>
...
version: number | null
Maybe we need to change it to double
2018-01-09 23:57:44 -08:00
Fangrui Song
3e076b4111
workspace/didChangeWatchedFiles placeholder
2018-01-09 23:11:20 -08:00
Fangrui Song
503127e0da
Reflect std::variant and change lsRequestId to variant<monostate,double,string> ( #279 )
2018-01-09 22:34:58 -08:00
Fangrui Song
a99fd7c444
Add IpcId::Shutdown
2018-01-09 22:05:09 -08:00
Fangrui Song
60e384a859
Make semantic highlighting symbol ranges non-overlapping using a scan line algorithm
2018-01-09 20:24:54 -08:00
Fangrui Song
71ca687252
Change Config->enableComments from to int
...
"enableComments": 0 // don't index comments
"enableComments": 1 // index Doxygen comment markers
"enableComments": 2 // -fparse-all-comments
2018-01-09 00:46:37 -08:00
Fangrui Song
37152da0fc
Add std::monostate to represent null field and add Ipc::Shutdown
...
Fixes #265
// FIXME lsRequestId should be number | string | null (std::variant<std::monostate, double, string>
2018-01-09 00:23:00 -08:00
Fangrui Song
a7bf90f50b
Serialize cacheFormat as string literal
2018-01-08 22:22:24 -08:00
Fangrui Song
c0a9b7189f
Use --init='{"enableComments": true}' to index comments and display them on hover
2018-01-08 21:41:46 -08:00
Fangrui Song
53134b679c
Simplify wscript and remove -x c++-header
2018-01-08 20:55:09 -08:00
Joel Hock
9d64a76fec
fix logic in GetFilesInFolderHelper from DFS-ification in 96f4ffc4b
2018-01-08 19:38:37 -08:00
Walter Erquinigo
2494c24332
Delete wrong comment
2018-01-08 13:31:20 -08:00
yshui
b644b54614
Convert GetFilesInFolderHelper to use BFS ( #268 )
...
This function has a huge stack frame (> 8k, thanks to tinydir), and is
called recursively. I have seen this function causing some stack
overflows. So convert it to BFS to avoid that.
2018-01-08 09:09:19 -08:00
Fangrui Song
0ef5aec3fc
Initial values of variables are useful. For now, enable it for const qualified types. Qualified names may also be useful but they can not be easily combined.
...
See #260
2018-01-08 00:20:40 -08:00
Fangrui Song
7b8f8e9cad
Add Config->dumpAST for dumping AST after parsing
...
Example initializationOptions: {"dumpAST": ["a.cc"]}
2018-01-07 23:51:36 -08:00
Chen
acc8f42033
[comments] Strip additional comment marker at the end of comments ( #264 )
2018-01-07 21:40:11 -08:00
Fangrui Song
63178468eb
-x c++-header has implicit -std=c++14
2018-01-07 21:18:02 -08:00
Fangrui Song
a2faa0c519
Treat source filenames with no dot as -x c++-header
2018-01-07 21:13:12 -08:00
Fangrui Song
11436c1f0d
Flatten msgpack by replacing pack_array() with pack()
...
msgpack::unpacker is not a complete streaming deserializer. It returns maps/arrays as a whole but does not allow us to step into individual elements. There is some memory overhead and it is also likely less efficient. By flattening maps, we also no longer need to track how many fields a struct has, which is less error-prone.
2018-01-07 20:52:16 -08:00
Fangrui Song
541b1a7494
Fix MessagePackReader for Position/Range
...
Go out for dinner
2018-01-07 17:42:47 -08:00
Fangrui Song
a78c65fdbb
Fix MSVC C2220
2018-01-07 16:20:13 -08:00
Fangrui Song
4e6c585e59
Add mnemonic constants to ClangSymbolKind
2018-01-07 16:06:07 -08:00
Fangrui Song
d49679d885
Fix Range serialization for -1:-1--1:-1
2018-01-07 15:52:46 -08:00
Fangrui Song
cef1559f6d
Fix waf configure --variant=debug on Linux
2018-01-07 15:18:01 -08:00
Jacob Dufault
78dc0c4341
Fix unit tests
2018-01-07 14:34:30 -08:00
Jacob Dufault
06870d5b61
Do not show completion candidates for : or > by itself.
...
Fixes issue #258 .
2018-01-07 14:27:57 -08:00
Jacob Dufault
2e20c8b655
Use c++14 by default if no language is specified.
2018-01-07 13:37:40 -08:00
Jacob Dufault
ab41e0353c
Fix build
2018-01-07 13:37:30 -08:00
Jacob Dufault
74c75ad0d1
Do not sort workspace symbols in vscode.
...
vscode assumes the order does not change.
2018-01-07 13:08:48 -08:00
Jacob Dufault
09d9d5eedc
Progress output improvements
...
- Don't emit so many progress messages
- Allow user to control how often progress is emitted
- Include number of active threads in progress
2018-01-07 13:08:48 -08:00
Jacob Dufault
7f6f63b702
Compute call location on client-side.
2018-01-07 13:08:48 -08:00
Fangrui Song
ce6087978f
Use cursor extents for non-type template parameters
2018-01-07 10:53:44 -08:00
Fangrui Song
332a3b5240
Serialize {type,func}->def.kind for semantic highlighting
2018-01-07 10:22:03 -08:00
Jacob Dufault
6661410483
Fix AppVeyor
2018-01-07 02:51:26 -08:00
Jacob Dufault
0ac0039c61
Small doc update.
2018-01-07 02:10:35 -08:00
Fangrui Song
ed880f50dd
Add msgpack reflection for Point/Range
2018-01-07 01:27:14 -08:00
Fangrui Song
34aac56ff0
Fix non-type template parameter
2018-01-07 01:19:57 -08:00
Fangrui Song
29345f067c
Set {func,type}->def.kind
2018-01-07 01:07:39 -08:00
Fangrui Song
9dc34103d8
[indexer] Add uses of types of (non-type template parameter)
2018-01-07 00:36:12 -08:00
Fangrui Song
93f92d57b7
Remove unused ptrace.h
2018-01-06 23:51:48 -08:00
Fangrui Song
0a7b9209df
Add TraceMe() to main()
...
On POSIX systems, you may set CQUERY_TRACEME=1 before running your editor.
cquery will inherit that environment variable and stop itself at the start of main().
2018-01-06 23:42:45 -08:00
Fangrui Song
32d37ede49
[emacs] Add cquery-extra-init-params
...
To enable SerializeFormat::MessagePack and use .mpack cache files:
(setq cquery-extra-init-params '(:cacheFormat 1))
2018-01-06 21:48:22 -08:00
Fangrui Song
286a0649c1
msgpack seems to work
...
Specify cacheFormat: 1 (SerializeFormat::MessagePack) in initializationOptions to write to .mpack cache files.
2018-01-06 21:12:10 -08:00
Jacob Dufault
a0a52e50a2
Make initialization options parsing less crashy if null is passed instead of undefined/nothing.
...
See issue #247 .
2018-01-06 20:53:58 -08:00
Jacob Dufault
a4496b7430
Do not try to load compile_commands.json if there is a .cquery file.
...
Also give some better diagnostics for .cquery.
2018-01-06 20:27:50 -08:00
Jacob Dufault
8a7dfb017f
Validate no files are consumed by import pipeline
2018-01-06 20:27:50 -08:00
Fangrui Song
299e687d37
WIP serializers/msgpack.h
2018-01-06 20:10:08 -08:00
Fangrui Song
aa139a4b65
Serialize Config::cacheFormat
2018-01-06 18:56:15 -08:00
Fangrui Song
5809d0c436
Make Serialize accept argument SerializeFormat format
...
Rename `const char* GetString()` to GetCString and add `std::string GetString()`
WIP on serializers/msgpack.h
2018-01-06 18:01:36 -08:00
Jacob Dufault
76a3fe8400
Reenable tests
2018-01-06 17:12:57 -08:00
Jacob Dufault
8debcf1d9d
Usage initializer_list
2018-01-06 17:11:34 -08:00
Jacob Dufault
a1423a39a0
Fix build
2018-01-06 16:51:55 -08:00
Fangrui Song
315ec292f1
Add WIP serializers/msgpack.h
2018-01-06 16:44:49 -08:00
Fangrui Song
fe0313f0b5
Add a parameter (number of __VA_ARGS__) to REFLECT_MEMBER_START
...
rapidjson StartArray StartObject do not need the number of fields, but msgpack-c does.
2018-01-06 16:42:22 -08:00
Jacob Dufault
d22f994d8a
Don't implicitly return data for TestIndexer.
2018-01-06 16:30:57 -08:00
Jacob Dufault
476a3f1797
Add a couple more import pipeline tests, introduce fixture.
2018-01-06 16:30:41 -08:00
Jacob Dufault
a9a905b0d2
Delete previous QueueManager instance if creating multiple.
2018-01-06 16:30:26 -08:00
Jacob Dufault
5d4e0a5020
Enable simple sanity test for import pipeline.
...
- Add FakeCacheManager
- Add IIndexer so we don't call out to clang
2018-01-06 16:20:37 -08:00
Jacob Dufault
e09ed35a8d
Forward declare Project
2018-01-06 16:04:51 -08:00
Fangrui Song
3f1cb5c072
Add submodule https://github.com/msgpack/msgpack-c and make Serialize/Deserialize aware of SerializeFormat
2018-01-06 15:29:53 -08:00
Fangrui Song
734f9b6380
Add serializers/json.h
2018-01-06 14:59:05 -08:00
Fangrui Song
02a457f65d
Make Reader/Writer abstract classes instead of type aliases of rapidjson classes
...
Added src/serializers/json.h (which includes rapidjson)
2018-01-06 14:47:43 -08:00
Fangrui Song
007bc5362c
Fix null pointer dereference of param.primary_file
2018-01-06 14:47:24 -08:00
Jacob Dufault
181b405c54
Remove some debug code
2018-01-06 12:32:58 -08:00
Fangrui Song
4758b70d00
Reorder Reflect functions
2018-01-06 11:26:41 -08:00
Joel Hock
0c9f572637
freeze state of WorkingFiles to insulate them from async changes
...
before shipping unsaved state off to clang
2018-01-06 11:26:09 -08:00
scturtle
991b27899f
Show error on include position. ( #243 )
2018-01-06 09:28:55 -08:00
Fangrui Song
516b94e982
Change VarClass::cls to ClangSymbolKind::kind
...
ClangSymbolKind is ported from clang::index::SymbolKind
2018-01-05 22:43:12 -08:00
Jacob Dufault
cf2103b521
Always normalize --sysroot=.
...
Clang does not respect -working-dir for this argument.
2018-01-05 13:41:38 -08:00
Fangrui Song
af600d4b90
Recognize clang-4.0 as commands
2018-01-05 11:10:58 -08:00
Jacob Dufault
0657de7ef9
Make exact workspace symbol search use detailed_name.
...
This enables lookup by typing fully qualified names, ie, myns::MyClass.
2018-01-05 10:06:15 -08:00
Jacob Dufault
bbe11e32eb
Prefer WriteToFile over manual std;:ofstream usage.
2018-01-05 10:02:53 -08:00
Jacob Dufault
327958dbe0
Log error instead of asserting if writing file fails.
...
Also remove some unused code.
2018-01-05 09:58:38 -08:00
Fangrui Song
08e856b85a
Use nullptr for main source filename in clang_parseTranslationUnit2FullArgv and rely on -working-directory for relative filename resolution
2018-01-05 09:45:46 -08:00
yshui
2a7b593a80
Use gnu11 standard when none is specified ( #231 )
...
Reference:
1. https://clang.llvm.org/docs/UsersManual.html#differences-between-various-standard-modes
2. https://gcc.gnu.org/onlinedocs/gcc/Standards.html
2018-01-04 11:10:40 -08:00
yshui
e2ce134e1f
Check __GLIBC__ for malloc_trim instead of __linux__ ( #230 )
2018-01-04 10:55:11 -08:00
Jacob Dufault
22ef88045f
Write cache to disk in binary format. Otherwise some escaping may occur.
2018-01-03 22:13:33 -08:00
Jacob Dufault
0c839d19fc
[ci]: Do not wait for input after failing a test.
...
This adds --ci command line flag which disables waiting for user input when running an index test (ie, test expectations are not updated).
2018-01-03 18:43:58 -08:00
Jacob Dufault
31c7fddf3d
More work to fix AppVeyor
2018-01-03 18:32:15 -08:00
Jacob Dufault
f5f3887dd3
Add newline after warning about not running obj-c tests
2018-01-03 18:12:39 -08:00
Jacob Dufault
2a17f66792
Write test using binary, otherwise \n will become \r\n leading to double \r\r\n.
2018-01-03 18:12:39 -08:00
Chao Shen
d9b9e5e227
fix appveyor
2018-01-03 18:12:21 -08:00
Daniel Martín
7e2c19d792
Format with predefined_style when a style cannot be obtained
2018-01-03 13:29:54 -08:00
Fangrui Song
5f8e1935a6
Use cursor extent instead of cursor spelling range for CXCursor_MemberRefExpr #174
...
Members of non-concrete template types do not have useful spelling ranges (likely unexposed).
C<int> f; f.x // .x produces a MemberRefExpr which has a spelling range of `x`.
C<T> e; e.x // .x produces a MemberRefExpr which has a spelling range of `e` (weird).
To make `e.x` (MemberRefExpr with empty spelling name) able to find
definition, We use cursor extent (larger than spelling range) `e.x`. It
would be better if we could restrict the ranges to `.x` or just `x`.
Nevertheless, larger ranges are less specific, and should do no harm
because they will be overriden by more specific variable references `e`.
2018-01-03 11:02:28 -08:00
Jacob Dufault
4514e2f9ce
Silence unhandled namespace declaration warnings
2018-01-03 08:05:52 -08:00
scturtle
66af432946
Fix completion order: Sort after cache.
2018-01-03 07:58:59 -08:00
Fangrui Song
1109c486c6
Help Riatre
...
clang_getNumArgTypes may return -1 for unexposed types.
2018-01-03 00:08:18 -08:00
Fangrui Song
74be57c334
Set variable_type of lambda parameters
...
Now a lambda parameter is listed in $cquery/vars of its type
2018-01-03 00:00:03 -08:00
Fangrui Song
a63297b002
Add type names to non-type template parameters
2018-01-02 22:52:40 -08:00
Fangrui Song
1220463efe
Make GetPath less hacky for #215
2018-01-02 18:59:47 -08:00
Fangrui Song
3e1a068c19
Make implicit calls spanning one more column to the left/right
...
This is hacky but useful. e.g. textDocument/definition on the space/semicolon in `A a;` or `return 42;` will take you to the constructor.
2018-01-02 16:30:08 -08:00
Chao Shen
c157445ef3
fix ci
2018-01-02 09:11:34 -06:00
Fangrui Song
a14ddc69ac
Split MultiQueueWaiter into {querydb,indexer,stdout}waiter to solve thundering herd problem ( #217 )
...
See https://github.com/jacobdufault/cquery/pull/213#issuecomment-354706992
2018-01-01 23:40:36 -08:00
Jacob Dufault
0b53c871dc
Remove platform specific mutex/shared memory
2018-01-02 01:37:39 -06:00
Fangrui Song
f68e70f5b7
Replace MultiQueueWaiter timeout with condition_variable_any on multiple mutexes
...
Inspired by https://github.com/jacobdufault/cquery/pull/213
2018-01-01 16:19:58 -08:00
Fangrui Song
6fa92f7968
Compare hover & comments in {Func,Type,Var}DefDefinitionData::operator==
...
So that the changes populate to querydb.
Also expand two std::set_difference calls to save one scan
2018-01-01 12:36:08 -08:00
Fangrui Song
0539e4249b
The Little Match Ray On New Year's Eve 2017
2018-01-01 00:06:25 -08:00
Fangrui Song
cef47b13f7
Remove ResolveSpelling
2017-12-31 23:34:00 -08:00
Fangrui Song
02246a5c4b
Add ClangCursor::get_spelling_range and change some ResolveSpelling calls to get_spelling_range
2017-12-31 23:27:33 -08:00
Fangrui Song
a6496a0f8f
[indexer] Add template parameters in parameter-list to their uses
and index template template parameters
2017-12-31 22:54:52 -08:00
Fangrui Song
a4847181fa
Fix formatting
2017-12-31 20:17:31 -08:00
Fangrui Song
86768b7d36
[formatting] textDocument/rangeFormatting
2017-12-31 20:03:43 -08:00
Fangrui Song
12ad0303be
[formatting] Add textDocument/rangeFormatting
2017-12-31 19:41:47 -08:00
Fangrui Song
aca8e42033
Use --bundled-clang=5.0.1 in appveyor ( #212 )
2017-12-31 17:21:35 -08:00
Daniel Martín
c5610b8d76
Default to Chromium's format style if cquery cannot obtain it ( #211 )
...
Set the tab configuration (tab, spaces, amount) to the information
provided by the LSP client.
2017-12-31 16:35:37 -08:00
Fangrui Song
f9aa0ef66d
[formatting] Refrain from std::make_unique until migration to C++14 or C++17
2017-12-31 15:56:02 -08:00
Fangrui Song
cd2f3c1e45
[formatting] Rename formattingOptions to options
...
LanguageClient-neovim `:call LanguageClient_formatting()` works now
2017-12-31 15:46:28 -08:00
Fangrui Song
c97bc5dbac
[formatting] Add missing cases
2017-12-31 14:52:06 -08:00
Fangrui Song
9d04446d48
Merge branch 'document-formatting' of https://github.com/danielmartin/cquery into danielmartin-document-formatting
2017-12-31 14:17:39 -08:00
Daniel Martín
f389d294b7
Protect formatting code inside USE_CLANG_CXX
2017-12-31 23:15:03 +01:00
Fangrui Song
f32d3a6851
Use -working-directory
...
This is in preparation for https://github.com/jacobdufault/cquery/pull/94
-working-directory allows us to remove relative filename resolution later on.
2017-12-31 14:00:50 -08:00
Fangrui Song
73ba3f0d6f
Move -x & -std= options just after compiler driver
2017-12-31 13:37:59 -08:00
Daniel Martín
4fdc81ae6d
Manage Expected in formatting APIs
2017-12-31 13:30:34 +01:00
Daniel Martín
05e9bf3966
Add missing includes
2017-12-31 13:30:34 +01:00
Daniel Martín
0e16899b81
Move formatting structs to text_document_formatting.cc
2017-12-31 13:30:34 +01:00
Daniel Martín
aa4e5e7e5b
Implement .clang-format style management
...
If we can't find a .clang-format file for the given file, default to
Chromium style with the tab/spaces configuration that was provided by
the client.
2017-12-31 13:30:34 +01:00
Daniel Martín
19341c18cd
Basic implementation of document formatting
...
Still some important TODOs to address:
- Improve the algorithm that converts between offsets and line/column
pairs. Right now it's extremely naive.
- Add proper support for a .clang-format file that specifies
the coding style.
2017-12-31 13:30:34 +01:00
Daniel Martín
abc2edf05f
Add structures to support document formatting
2017-12-31 13:24:58 +01:00
scturtle
4c2dff39ef
Response "being indexed" instead of "not found".
2017-12-30 19:39:10 -08:00
Fangrui Song
77e9ea1b77
Use cursor extents for is_implicit
function calls
...
cursor extents have larger ranges and less specific, thus making
them overridable by more specific (with smaller range) symbols.
Thus we do not need to hide them in query.cc:BuildFileDef
For example, the left paren in `A a(3)` jumps to the constructor.
the left paren in `A a = f()` jumps to the copy/move constructor.
2017-12-30 15:42:08 -08:00
Fangrui Song
95126bff61
In detailed_name
, remove space between *
and name
2017-12-30 13:11:55 -08:00
Fangrui Song
947a80ecc8
[comments] Add a minimalist approach to skip Doxygen comment markers
2017-12-30 10:56:34 -08:00
Chao Shen
829b2fe18c
Better order of the completion items.
2017-12-30 15:15:46 +08:00
Fangrui Song
11aa09fac2
Don't reject macro definitions in system headers
...
Before, an assert() macro expansion jumps to __assert_fail but not
assert. This is because OnIndexReference finds a reference to __assert_fail
but VisitMacroDefinitionAndExpansions rejects the expansion.
2017-12-29 19:18:42 -08:00