Commit Graph

1329 Commits

Author SHA1 Message Date
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
Fangrui Song
48e88950e1 Complete CompletionItemKind 2017-12-29 16:32:43 -08:00
Fangrui Song
b015b03405 Fix platform_posix.cc on FreeBSD 2017-12-29 14:46:21 -08:00
Fangrui Song
66d4926e41 Remove <sys/prctl.h> and set thread name on BSD & __APPLE__ 2017-12-29 14:35:20 -08:00
Fangrui Song
720266e97a Support equal signs in options, e.g. --log-file=a.log 2017-12-29 14:00:02 -08:00
Fangrui Song
43ea2fcc53 Clean up type printer 2017-12-29 12:58:11 -08:00
Fangrui Song
daaf3a701b Clean type printer 2017-12-29 12:30:05 -08:00
romix
f897c46122 A more robust way of producing function signatures with parameter names 2017-12-29 12:02:33 -08:00
Fangrui Song
8592df7cf6 Use --bundled-clang=5.0.1 by default (instead of 4.0.0) 2017-12-29 10:40:29 -08:00
Jacob Dufault
f85659713e Fix compile 2017-12-29 10:28:11 -08:00
Jacob Dufault
6048eb6237 Move LoadCachedFileContents into ICacheManager 2017-12-29 12:19:39 -06:00
Jacob Dufault
71591d7805 Index_Request::contents is no longer optional 2017-12-29 12:00:52 -06:00
Jacob Dufault
a10bb50f51 Begin cache restructure so it can be tested 2017-12-29 12:00:52 -06:00
Jacob Dufault
3c0b2ff042 Move most of import_pipeline.cc into anonymous namespace 2017-12-29 12:00:52 -06:00
Jacob Dufault
c596e55dcc Cleanup some includes. 2017-12-29 12:00:52 -06:00
Jacob Dufault
48f3c75053 Add using declaration to optional.h, include STL optional if available or fallback to third-party one. 2017-12-29 12:00:52 -06:00
Jacob Dufault
b6071004df Rename IndexMain to Indexer_Main 2017-12-29 12:00:52 -06:00
Fangrui Song
d4ce12bb9a Add --use-clang-cxx to waf and move type printer to src/type_printer.cc
src/type_printer.cc demonstrates how to leverage clang C++ API.
It includes clang/**/*.h headers and CXTranslationUnit.h which resides
in clang/tools/libclang/ but is not exposed in clang/include/clang-c/

These libclang/ header files are stable and provide some struct definitions used by clang-c/ header files.
A copy of them from clang source tree is checked into libclang/ .

If you want to an early adopter,
CXXFLAGS='-std=c++11 -fno-rtti -D_GLIBCXX_USE_CXX11_ABI=0 -g' ./waf configure --variant=cxx-debug --bundled-clang=5.0.1 --use-clang-cxx

Some clang/**/*.h are unstable and should be used with caution,
in addition, Windows pre-built binaries on https://releases.llvm.org/download.html do not include C++ header files.
Thus `--use-clang-cxx` defaults to False.
2017-12-29 09:51:26 -08:00
Jacob Dufault
59e79b3c42 Move entry_points.h into import_pipeline.h 2017-12-29 09:52:43 -06:00
Jacob Dufault
36e7fa9a76 More work on e2e tests 2017-12-29 09:39:10 -06:00
Jacob Dufault
ad193b2ace Initialize ImportPipelineStatus::num_active_threads 2017-12-29 09:39:10 -06:00
Fangrui Song
6636617b4d [comments] Import mpark/variant and make MarkedString a variant (#200) 2017-12-28 15:21:40 -08:00
Fangrui Song
34052fbf27 [indexer] Index some references in ClassTemplate 2017-12-28 10:53:13 -08:00
Jacob Dufault
719c6c9ae9 Enhance index test selection filtering 2017-12-28 09:55:17 -08:00
Jacob Dufault
4781e9a53d Move tests to index_tests 2017-12-28 09:42:55 -08:00
Jacob Dufault
3ab2f2e2b7 Update formatting 2017-12-28 09:22:26 -08:00
Jacob Dufault
7939aec743 Remove WorkThread::Result.
WorkThread::StartThread is now a more typical main function.
2017-12-28 09:20:21 -08:00
Jacob Dufault
8468ef09c3 Reduce verbosity of index tests. Make it easier to identify failures. 2017-12-28 09:15:46 -08:00
Jacob Dufault
5ace7e7062 Remove logging 2017-12-28 09:03:35 -08:00
Jacob Dufault
243630ca2e wip 2017-12-28 08:55:46 -08:00
Fangrui Song
56135f615c [template] Attribute template parameter references to the parameter declaration. Class templates still do not work 2017-12-28 00:37:10 -08:00
Fangrui Song
cff432a223 [template] Index references to non-type template parameters 2017-12-27 23:42:56 -08:00
scturtle
32bcac38af Simplify LruCache a little bit. (#199) 2017-12-27 23:27:42 -08:00
Fangrui Song
d7d8b820ac [template] Index template parameter references 2017-12-27 22:58:07 -08:00
Fangrui Song
f86de0b544 function signature: blacklist "typeof " 2017-12-27 19:51:16 -08:00
Fangrui Song
6fa08b2b90 Refactor function signatures: fix infinite loop processing constructors 2017-12-27 18:51:19 -08:00
romix
8bdce31789 Produce detailed function signatures which include parameter names 2017-12-27 15:49:26 -08:00
Jacob Dufault
9dde5041cb Always use -fparse-all-comments 2017-12-27 07:56:17 -08:00
Jacob Dufault
ef4af128fc Exit early if unit tests fail 2017-12-27 07:54:46 -08:00
Jacob Dufault
b8e7a5bcb3 Format code 2017-12-27 07:54:46 -08:00
Chao Shen
a84c863e5e Filter some completion results based on the input. 2017-12-27 09:34:24 -06:00
Fangrui Song
3df71f4145 [hover] Change the first MarkedString's language to "text" 2017-12-25 21:48:28 -08:00
Fangrui Song
5a22a5cc66 [hover] Return comments and hover as two MarkedString's
Inspired by @romix's https://github.com/jacobdufault/cquery/pull/187
2017-12-25 21:31:01 -08:00
Fangrui Song
23bbe81b92 Un-indent extracted comments (#191) 2017-12-25 11:20:47 -08:00
Fangrui Song
20c156f71d Make lsTextDocumentContentChangeEvent::{range,rangeLength} optional. fix #185 (#189)
Also make lsVersionedTextDocumentIdentifier::version optional per specification
2017-12-25 00:58:26 -08:00
Fangrui Song
bfccac525c Add experimental command line option --enable-comments to index comments and display them on textDocument/hover (#188) 2017-12-24 18:47:39 -08:00
romix
03b50ea3cc Serialize decl comments and use them in GetHoverForSymbol 2017-12-24 18:01:38 -08:00
Fangrui Song
2ffc068760 Handle function calls from templates. fix #174 2017-12-24 15:12:52 -08:00
Fangrui Song
dced34dd58 Reopen #174 2017-12-24 13:28:53 -08:00
Fangrui Song
4b9bc342f5 Fix called_id 2017-12-24 10:43:32 -08:00
Fangrui Song
6a8537c2bf Handle function references in templates. fix #174 (#184) 2017-12-24 10:27:17 -08:00
Fangrui Song
dd4044998d Add TemplateVisitor to handle CXCursor_OverloadedDeclRef in templates 2017-12-24 00:35:38 -08:00
Fangrui Song
cdcf75ac84 Raise maxWorkspaceSearchResults to 500 and sort results even if the max number has been reached 2017-12-23 22:49:45 -08:00
Fangrui Song
b52ec9070c [workspace/symbol] Use short_name for sorting and detailed_name for displaying results 2017-12-23 21:27:01 -08:00
Fangrui Song
24f428c670 [workspace/symbol] Sort candidates with a fuzzy matching algorithm (#182) 2017-12-23 19:23:29 -08:00
Jacob Dufault
dce1365eb6 Move import pipeline into import_pipeline.cc 2017-12-23 17:30:55 -08:00
scturtle
f10521372b Initilize var.def.cls to unknown. 2017-12-23 19:29:32 -06:00
scturtle
cb7ccbe543 Change var.def.is_* to enum. 2017-12-23 19:29:32 -06:00
Jacob Dufault
f6d84cd68c Merge IpcManager and QueueManager 2017-12-23 16:25:18 -08:00
Jacob Dufault
27b5816a7f Small doc updates 2017-12-23 15:42:54 -08:00
Jacob Dufault
64f094d347 Move BuildWorkspaceEdit to text_document_rename.cc 2017-12-23 15:41:09 -08:00
Jacob Dufault
2bc44d59f2 Add --wait-for-input.
Previous on Windows when running index tests cquery would wait for the user to
press enter. This breaks AppVeyor CI.
2017-12-23 17:25:18 -06:00
Fangrui Song
af5ae31c34 Don't emit more diagnostics after hitting -ferror-limit 2017-12-23 15:20:13 -08:00
Fangrui Song
c04c9fa750 Don't emit more diagnostics after hitting -ferror-limit 2017-12-23 15:08:47 -08:00
Fangrui Song
646d154b9b Better heuristics, noexcept specifier and C11 _Atomic specifier 2017-12-23 09:57:12 -08:00
Fangrui Song
156d4891c3 [hover] Better heuristics to insert function name right before the paren pair enclosing parameters (#178) 2017-12-23 09:29:13 -08:00
Jacob Dufault
fb491e6c6d Format using clang format 4.0.0 2017-12-23 08:33:26 -08:00
Jacob Dufault
4aeb6acf04 Test improvements:
- Update files with \r\n newlines.
- Require clang 4.0.0 for running tests.
2017-12-23 07:51:34 -08:00
Chao Shen
0985613d16 Add is_global and is_member. 2017-12-23 01:00:46 -06:00
Fangrui Song
2056e44d22 Insert qualified name right before matching paren ( of last ) in function's type spelling
Before, function<int(int)> and (anon) mess up the function signature
2017-12-22 15:48:30 -08:00
Fangrui Song
c3c0feecb2 [indexer] Make hover optional (#176)
On textDocument/hover requests, return `detailed_name` if `hover` is unavailable
Don't include leading `type_name` in `detailed_name` for CXIdxEntityEnumConstant, i.e. `Foo Foo::a` -> `Foo::a`
2017-12-22 14:48:55 -08:00
Fangrui Song
ba4a5e91cb [indexer] Remove IsLocalSemanticContainer check in qualified names 2017-12-22 09:21:53 -08:00
Jacob Dufault
ea323a3b4b Actually skip the test 2017-12-22 09:14:11 -08:00
Jacob Dufault
b4b45d36b5 Only run Objective-C tests on Apple platforms 2017-12-22 09:07:21 -08:00
Jacob Dufault
fd7c01796c Do not include path in lambda detail/hover string 2017-12-22 08:59:37 -08:00
Jacob Dufault
e1ac3103a8 Add TEXT_REPLACE in index tests.
This allows USRs to vary across platforms in index tests, which is required to
make them pass on all platforms.
2017-12-22 08:48:12 -08:00
Jacob Dufault
d7a183c796 Try to keep semantic highlighting colors stable across open files. 2017-12-22 07:29:13 -08:00
Fangrui Song
043e9a4d44 [indexer] Fix hover info of class member functions 2017-12-21 22:46:45 -08:00
Fangrui Song
ba1ca37326 [indexer] Make $cquery/base find correct overriden functions (#169) 2017-12-20 23:18:48 -08:00
Fangrui Song
6aefa9b114 [indexer] Handle unnamed namespaces 2017-12-20 19:52:34 -08:00
Fangrui Song
6e231628fe Specify lambda return type to work around clang 3.5 build issue 2017-12-20 19:28:57 -08:00
Fangrui Song
3410f9769c textDocument/definitions: on a variable definition, get both declarations and variable_type definition. 2017-12-20 10:59:14 -08:00
Jacob Dufault
b75875a83e Fix CI 2017-12-20 10:27:10 -08:00
Jacob Dufault
e26f1caaba Some changes to index tests:
- Add EXTRA_FLAGS: which lets a test specify additional command line
flags to pass to clang.
- Show diagnostics in the terminal after indexing the file.
- Allow the user to pass a test filter/file on the command line (ie,
cquery --test-index foo.cc)
2017-12-20 09:12:22 -08:00
Jacob Dufault
4bf8dbe3ea Move std::cin.tie to main 2017-12-20 09:12:22 -08:00
Fangrui Song
ee78b527ae [indexer] Treat empty short_name as implicit call which should not be included in all_symbols
std::vector<int> a = f(); // besides f, there is an implicit move constructor vector(vector<T>&&)
We expect finding references on `f` takes us to `f`, not to `vector(vector<T>&&)`
2017-12-20 07:46:43 -08:00
Joel Hock
4b420c53d3 add unit test 2017-12-19 08:16:52 -08:00
Joel Hock
bea5b38bc5 /.cquery file parsing fixes
- relative path handling
- first line was being ignored if it was a flag (code assumed it was path to clang binary)
2017-12-19 08:16:52 -08:00
Jacob Dufault
b9a2b68e93 Never elide result response for hover. 2017-12-18 23:54:00 -08:00
Jacob Dufault
7e9db4a2da Send null hover response if there is no hover. 2017-12-18 23:27:52 -08:00
Fangrui Song
18f602c6e8 For textDocument/hover, do not error on empty results 2017-12-18 23:21:30 -08:00
Fangrui Song
cf4603c6fa Add FileContentsWithOffsets 2017-12-18 23:05:12 -08:00
Jacob Dufault
8098e4f01d Support multiple base functions. 2017-12-18 22:15:46 -08:00
Jacob Dufault
b4e8f8dd4f Don't show idle status while loading compile_commands.json/project. 2017-12-18 21:36:48 -08:00
Jacob Dufault
a7d1c6917f Report detailed name for workspace symbol search.
This fixes vscode filtering which fixes qualified name global symbol search.
2017-12-18 21:31:19 -08:00
Jacob Dufault
be961fc4f2 Add hover (instead of reusing detailed_name) 2017-12-18 21:20:00 -08:00
Jacob Dufault
3d4ebcd7ee Update tests for llvm 4 2017-12-18 20:40:12 -08:00
Fangrui Song
8897bcc54d [indexer] Display declaration line for typedef/using. fix #141
GetDocumentContentInRange calls clang_tokenize, which is not easy to
handle multi-line declarations. Only display declaration lines for
one-line `typedef`/`using` now.
2017-12-18 19:30:49 -08:00
Jacob Dufault
1fd50b4dea Fix MSVC build. 2017-12-18 16:35:43 -08:00
Walter Erquinigo
cb098cbfc3 test 2017-12-18 16:26:58 -08:00
Walter Erquinigo
a6cb98945e Add obj-c support in the indexer 2017-12-18 16:26:58 -08:00
Fangrui Song
5600989a42 [indexer] Treat explicit destructor call as not is_implicit (#159)
Also fixed an unused warning.
2017-12-18 13:48:32 -08:00
Jacob Dufault
002d32c8a0 Fix broken auto-resource-dir detection 2017-12-18 11:47:58 -08:00
Fangrui Song
9fd35db034 [indexer] Index references to system headers 2017-12-17 21:16:40 -08:00
Fangrui Song
ef7215cd7f textDocument/definition: find macro definition instead of Type definition if the macro expands to tokens led by a SymbolKind::Type 2017-12-17 21:14:57 -08:00
Fangrui Song
2fb135e10a Support FreeBSD
This commit fixes issue on cquery's side. Its dependencies loguru and
sparsepp should also be ported to FreeBSD:

* https://github.com/emilk/loguru/pull/46
* sysinfo(2) called by sparsepp https://github.com/greg7mdp/sparsepp/blob/master/sparsepp/spp_memory.h#L32
2017-12-17 16:44:21 -08:00
Riatre Foo
0045e4817c Windows build script (#154)
* Cast from float explicitly.

* Upgrades to waf 2.0.2.

For VS2017 support on Windows.

* [waf] Supports building on Windows.

Needs 7z.exe in PATH for extracting prebuilt clang NSIS installer (when
using bundled clang).
RPATH is "emulated" by putting a libclang.dll alongside the cquery
binary.
Tested with Visual Studio 2017 toolchain.

* [waf] Fix default_resource_directory on Windows + system clang.

* Add AppVeyor configuration
2017-12-17 10:14:30 -08:00
DaanDeMeyer
4aa92466eb Fix IsSymLink on Linux (#147)
IsSymlink was giving faulty results when finding recursive files on Linux. I've updated the function to use the built-in POSIX macro for checking if a file is a symlink.
2017-12-16 08:32:10 -08:00
Jacob Dufault
c0c3fc41a4 Do not emit an include in the indexer if we failed to resolve the file. Also add -resource-dir to tests. 2017-12-15 21:24:31 -08:00
Jacob Dufault
d23de3a9fb Move default resource directory computation to utils.
This will be used by the test system as well.
2017-12-15 21:18:49 -08:00
Jacob Dufault
883f886d2a Make sure GetExecutablePath is normalized on windows. 2017-12-15 21:18:23 -08:00
Jacob Dufault
9f249970b0 Ensure DEFAULT_RESOURCE_DIRECTORY is a string. 2017-12-15 21:06:27 -08:00
Jacob Dufault
487680e8d1 Fix project.cc unit tests.
-x processing broke.
2017-12-15 21:05:48 -08:00
Walter Erquinigo
5238c50027 objc 2017-12-15 12:02:32 -08:00
Chen
f3f7bc26cd Better default resource dir heuristics: use system resource dir with system clang and relative path to resource dir with bundled clang (#137) 2017-12-14 14:35:21 -08:00
Fangrui Song
17cac3d30a [indexer] Change macro's IndexVar::def::detail_name to its approximate definition
For `#define foo 3`,
Before this commit, `detail_name` was `foo` (displayed for textDocument/hover reqeusts).
It is now shown as `#define foo 3`
2017-12-13 09:35:44 -08:00
Jacob Dufault
a1fd516788 Log stack trace when there is bad index/buffer lines 2017-12-12 09:50:12 -08:00
Jacob Dufault
1467526bad Be less aggressive about indexing potential lambdas 2017-12-12 09:49:52 -08:00
Fangrui Song
17f23bf3bf In OnIndexDeclaration, get_type_description() may return the name of a typedef and there is no (, causing insert failing 2017-12-12 00:14:25 -08:00
Jacob Dufault
9b909b3a13 Move usr out of *Def and into Query*/Index* types.
I'd like to make the *Def structures optional in the future, and usr is always non-optional.
2017-12-11 23:57:44 -08:00
Jacob Dufault
2751f51956 Format 2017-12-11 21:21:03 -08:00
Jacob Dufault
12bfabf9c2 No more NonElidedVector 2017-12-11 21:20:29 -08:00
Jacob Dufault
e535fab581 Do not elide vector in serialization 2017-12-11 21:15:37 -08:00
Fangrui Song
fb902a29b7 Add missing definition and reference info to lambda paramaters. fix #120 2017-12-11 21:06:55 -08:00
Fangrui Song
c6135f5de0 Reflect empty string
MarkedString::value is a mandatory field and the client may complain if `value` does not exist.
2017-12-11 21:03:30 -08:00
Fangrui Song
86cc50e27f Implement diagnostic range as per clang_formatDiagnostic 2017-12-11 13:34:37 -08:00
Peter Elmers
177e4cd224 Escape more symbols in path handling. 2017-12-11 11:11:02 -08:00
Fangrui Song
479c0c59bc More idiomatic 2017-12-10 19:53:17 -08:00
Jacob Dufault
4a7ca6168f Reformat 2017-12-07 11:54:51 -08:00
Yuxuan Shui
93fb746992 Convert priority to a string properly for sortText
Cast the number to a char directly sometimes results in a invalid UTF-8
string, which is not good for some clients.
2017-12-07 10:38:43 -08:00
Fangrui Song
77ccee10ce Serialize clang_createIndex to prevent race condition (concurrent modify/read to FirstTarget defined in lib/Support/TargetRegistry.cpp) 2017-12-07 10:29:42 -08:00
Jacob Dufault
ae8cae5ba6 Do not index files starting with git: 2017-12-06 17:00:19 -08:00
Jacob Dufault
3b9371f4b5 Reduce STDERR logging to only WARNING and above.
INFO logs are now only viewable in the log file, which is not written
by default. A new command line option --log-file can be used to control
where the log file is written.

INFO logs can be written to STDERR if --log-all-to-stderr is passed.
2017-12-06 10:58:30 -08:00
Jacob Dufault
0e4148518a Fix clang 3.8 build 2017-12-06 09:10:58 -08:00
Jacob Dufault
ae40bfa208 Add override 2017-12-06 07:10:19 -08:00
Jacob Dufault
7a5eb3c4d5 Move src/messages/*.cc to anonymous namespace 2017-12-05 21:03:38 -08:00
Jacob Dufault
b65a30c3f7 Move Ipc_* types into messages/ 2017-12-05 20:41:44 -08:00
Jacob Dufault
5093863b33 Move initialization Ipc structures into messages/ 2017-12-05 20:09:12 -08:00
Jacob Dufault
ad550f3f2c Enable global/static registration for IpcMessage. 2017-12-05 20:09:12 -08:00
Jacob Dufault
9a3e040bf8 Fix clang build 2017-12-05 19:49:16 -08:00
Jacob Dufault
b441a90e0d Finish migrating to messages/ 2017-12-05 19:46:36 -08:00
Yuxuan Shui
2bd4671ddd Only set insertTextFormat to Snippet when we have placeholders 2017-12-05 09:47:33 -08:00
Jacob Dufault
dbeb4eb511 Reformat 2017-12-05 08:24:37 -08:00
Jacob Dufault
905a4ab2b1 Make IpcId::Exit handled as a message. 2017-12-05 00:21:19 -08:00
Jacob Dufault
3599a831b1 Introduce MessageHandler abstraction. Mainly just code reorg.
Only the initialize request uses it so far, but this will enable pulling
quite a bit of code out of command_line.cc.
2017-12-04 23:57:41 -08:00
Fangrui Song
8b5d9d33ab Fix LruCache when next_score overflows 2017-12-04 14:47:14 -08:00
Jacob Dufault
4a7194d2df Remove unused variable 2017-12-04 09:18:29 -08:00
Jacob Dufault
eb8a1ee570 Fix clang build 2017-12-04 07:13:33 -08:00
Jacob Dufault
0f3680866e Make missing clientVersion skip check 2017-12-04 00:29:38 -08:00
Jacob Dufault
670c925204 Remove Ipc_Cout; rename IpcId::Cout to IpcId::Unknown. 2017-12-04 00:16:19 -08:00
Jacob Dufault
6c5f1d9c88 Simplify IpcManager.
It no longer supports multi-process IPC; remove some of the extra code that was used to support that.
2017-12-04 00:13:35 -08:00
Jacob Dufault
b64b8b5493 Fix clang build 2017-12-03 22:49:50 -08:00
Jacob Dufault
9a64fb0747 Fix broken build (add lru_cache.h) 2017-12-03 19:24:42 -08:00
Jacob Dufault
b2736f8822 Semantic highlighting improvements.
- Semantic highlighting no longer disappears when switching between
files.
- Semantic highlighting for a symbol will remain stable as the file is
edited.
- Improved semantic highlighting colors.

Progress indicator also now shows the number of remaining index jobs
(not the total number).
2017-12-03 18:25:21 -08:00
Jacob Dufault
9e6d33689f Trim lines when reading from .cquery file.
Otherwise there may be newlines and the like.
2017-12-03 18:25:21 -08:00
Jacob Dufault
ab7ffa302a Add $cquery/textDocumentDidView.
This allows for more stable semantic highlighting, among other potential features. Requires custom support from the client, though.
2017-12-03 18:25:21 -08:00
Fangrui Song
697968b15f Group cache files by projectRoot 2017-12-03 16:00:49 -08:00
Josh Elsasser
82643dc79d Ensure that paths passed to libclang are fully expanded
- "-include" arguments must have their paths resolved
- clang_resource_dir must have its path resolved
2017-12-03 12:53:05 -08:00
Jacob Dufault
ee5ea91c1f Reduce test clang arg set. 2017-12-01 17:11:27 -08:00
Jacob Dufault
5d1fd4ce4d Remove a bunch of std::cerr in favor of LOG_S 2017-12-01 17:04:39 -08:00
Jacob Dufault
cf5f465e9e Add -Wno-unknown-warning-option 2017-12-01 10:11:09 -08:00
Jacob Dufault
b727e36afc Move cleanup_maybe_relative_path to top of func in project.cc 2017-12-01 09:59:28 -08:00
Jacob Dufault
fa240e3132 Small code cleanup in src/indexer.cc. 2017-12-01 09:57:03 -08:00
Jacob Dufault
9b44bf7901 Run ./format.sh 2017-12-01 09:55:41 -08:00
Jacob Dufault
066166ba40 Add --clang-sanity-check.
Does a simple index test to verify expected libclang API behavior.
2017-12-01 09:46:40 -08:00
Jacob Dufault
2a2794da23 Also log arguments when failing to create a translation unit 2017-12-01 09:46:40 -08:00
topisani
ab6c5f0515 Emit semantic highlighting for types 2017-12-01 09:42:22 -08:00
topisani
c4ada3e9df Don't highlight operators as functions (#104)
* Don't highlight operators as functions

* address comments
2017-12-01 17:08:19 +01:00
topisani
63d2b5fa10 nitpick fixing 2017-11-30 14:12:41 -08:00
topisani
4e153784f6 Index language as enum instead of string 2017-11-30 14:12:41 -08:00
topisani
e6bcd05a7e markdown compliant language identifiers 2017-11-30 14:12:41 -08:00
topisani
28ad5b1ed1 Index file language and send it on hover 2017-11-30 14:12:41 -08:00
Fangrui Song
eac644d81a On *nix, use a realpath(3) variant (which does not expand symlinks) in NormalizePath
Before this commit, when a source file is a symlink, cquery is not able to serve LSP requests for it.
2017-11-30 11:27:26 -08:00
Jacob Dufault
38ff70ebc3 Disable serialization of clang_parseTranslationUnit2FullArgv 2017-11-29 20:23:34 -08:00
Jacob Dufault
f4acde7588 Add --log-stdin-stdout-to-stderr
Prints messages received and stdin/stdout to stderr. Useful when developing a new client that uses cquery as the backend.
2017-11-29 20:22:10 -08:00
Jacob Dufault
f1f2cc3bd1 Serialize clang_parseTranslationUnit2FullArgv requests.
Also try to emit diagnostics when translation unit creation fails.
2017-11-29 19:53:07 -08:00
Jacob Dufault
aeab1a0b79 Fix MSVC builds 2017-11-29 19:18:58 -08:00
Jacob Dufault
e421f86bfa Try to make index tests more platform independent 2017-11-29 19:18:25 -08:00
Jacob Dufault
76c07f3cc6 Additional improvements to automatic index test updates. 2017-11-29 19:09:11 -08:00
Jacob Dufault
68f6d34693 Only wait when running index tests on windows. 2017-11-29 19:09:10 -08:00
Jacob Dufault
f6f88cc788 Better logging in when iterating files. 2017-11-29 19:09:10 -08:00
Jacob Dufault
f84945fb51 Make SafeGetLine work the same across different file-ending styles. 2017-11-29 19:09:10 -08:00
nobody
c7ef44ad53 Fix hang during reading from stdin
I experienced this hang problem when using cquery with
LanguageClient-neovim.

Sometimes std::cout would hang because the pipe is full, which would
normally be fine, since the client would read from the pipe soon.
However, in this case the client is blocking on a write(). This
shouldn't happen, because cquery has a stdin thread which constantly
reads from stdin. But, in C++, cin and cout are tied streams. Reading
from cin would cause cout to flush, which cause the read to block.

So, cquery can't write because the client doesn't read, the client won't
read before it finishes writing. It can't finish writing because cquery
can't read, and cquery can't read because cquery can't write. Which is a
deadlock.

The solution is to simply untie cin and cout.
2017-11-28 13:58:11 -05:00
Fangrui Song
87f6452b5d Rename clang_args to .cquery 2017-11-27 12:31:54 -05:00
Jacob Dufault
d5951c0e69 Revert "Specify nullptr for source_filename in clang_parseTranslationUnit2 so that we do not need to strip main source filename from args"
This reverts commit 6adc3a28c39a5f6b58a0a57bfae83916051c19f8.
2017-11-27 08:20:42 -08:00
Fangrui Song
2b54296992 Specify nullptr for source_filename in clang_parseTranslationUnit2 so that we do not need to strip main source filename from args 2017-11-27 11:13:07 -05:00
Fangrui Song
bf2aaf470e Use clang_getCursorKindSpelling 2017-11-27 11:11:21 -05:00
Josh Elsasser
76785105ed Add an option to disable EmitProgress methods during indexing 2017-11-26 19:50:57 -05:00
Peter Elmers
750cc4ea30 Respond to comment 2017-11-26 12:12:59 -05:00
Peter Elmers
3341b1f13d Only replace text if both rangeLength and range are not set 2017-11-26 12:12:59 -05:00
Walter Erquinigo
31d7423490 Rebuild vscode plugin and fix some naming 2017-11-26 12:11:09 -05:00
Walter Erquinigo
3cee3cb775 Support an optional compilation database dir at initialization 2017-11-26 12:11:09 -05:00
Peter Elmers
6f6cd4ea7f Give default value to compileCommandsDirectory 2017-11-26 12:11:09 -05:00
Peter Elmers
b7059e69d7 Add compileCommandsDirectory to config struct 2017-11-26 12:11:09 -05:00
Fangrui Song
dba27c3d34 Catch ios_base::failure exceptions in ReadContent
`filename` may be a directory (the latest Emacs lsp-mode sometimes sends a `textDocument/didOpen` message with an empty filename) or the file cannot be read.
2017-11-22 11:35:46 -05:00
Jacob Dufault
626f7bc736 Use compile_commands.json in root directory in favor of clang_args 2017-11-19 18:52:09 -08:00
Jacob Dufault
6a23c5bace Enable path in args test 2017-11-19 15:46:02 -08:00
Fangrui Song
fb38537f20 Strip main source filename if it is a relative path in GetCompilationEntryFromCompileCommandEntry 2017-11-19 18:30:27 -05:00
Daan De Meyer
de1de3e51a Remove .vscode directories from the repository and add .vscode
to the .gitignore
2017-11-19 18:09:32 -05:00
Jacob Dufault
261b04a131 Update test once more 2017-11-19 14:48:26 -08:00
Jacob Dufault
475cd6b668 Add failing test for issue #42 2017-11-19 14:46:05 -08:00
Jacob Dufault
5f73c7efac Allow running unit and index tests separately 2017-11-19 14:35:16 -08:00
Jacob Dufault
97417ecc93 Reformat code 2017-11-19 14:11:54 -08:00
Fangrui Song
297ed1d13e Use indented TEST_SUITE 2017-11-19 14:13:11 -05:00
Daan De Meyer
5842dd5d60 Add option to disable insertion of snippets when completing a method/function call. 2017-11-19 10:30:29 -05:00
Fangrui Song
49559402cf Add a virtual destructor for ThreadedQueue 2017-11-19 01:16:32 -05:00
Peter Goodman
3f45c05476 This commit fixes severak compiler errors when trying to build cquery. I gave up after a bit and didn't fix them all though, there are a ton of signed to unsigned comparisons. 2017-11-18 16:09:14 -05:00
Jacob Dufault
0376da015f Try to always log when exiting. 2017-11-18 11:02:09 -08:00
Jacob Dufault
6a50c48aaa Formatting and a TODO 2017-11-18 09:29:48 -08:00
Jacob Dufault
eea8a1b07a Try to avoid crashing when deserializing JSON 2017-11-18 09:27:37 -08:00
Jacob Dufault
7b0d2d7bf2 Make sure to send initialize response before status updates 2017-11-17 13:31:48 -08:00
Abhinav Gauniyal
27a00d7ad3 Update command_line.cc, fixes #14
- error: lambda capture 'working_files' is not used
 - error: lambda capture 'config' is not used
2017-11-17 07:35:15 -08:00
Christian Pehle
c7c6a8ed39 Fix build on macOS #20 2017-11-17 07:34:09 -08:00
Jacob Dufault
42f744ba29 Remove some unused code. 2017-11-11 11:43:55 -08:00
Jacob Dufault
601af73ca9 Move all libclangmm/* files into src/* directory 2017-11-11 11:41:09 -08:00
Jacob Dufault
348b4a2e4e Move libclangmm/Cursor.* to clang_cursor.* 2017-11-11 11:31:05 -08:00
Jacob Dufault
5fa7fbf0d2 More improvements to semantic highlighting. Still not done though. 2017-11-11 11:18:55 -08:00
Jacob Dufault
8145a06534 First pass at semantic highlighting.
It is disabled by default.
2017-11-08 23:06:32 -08:00
Jacob Dufault
9d376a47d5 Do not index is_constructor and parameter_type_descriptions. 2017-11-08 19:59:11 -08:00
Jacob Dufault
96894ae996 Index std::make_unique and similar functions as constructor calls. 2017-11-08 19:55:13 -08:00
Jacob Dufault
e7de24764e Increase indexed file version 2017-11-07 01:01:37 -08:00
Jacob Dufault
510594cdcd Add is_constructor to indexer 2017-11-07 01:00:59 -08:00
Jacob Dufault
9cb4008023 Index type description for function parameters. 2017-11-07 00:57:08 -08:00
Jacob Dufault
6d2af96c16 Remove TranslationUnit::document_cursor() 2017-11-04 16:11:52 -07:00
Jacob Dufault
7d549f3fdf Move libclangmm/Utility.h into clang_utils.h 2017-11-04 16:02:39 -07:00
Jacob Dufault
172f9e2e80 Remove tiny-process-library 2017-11-04 15:23:08 -07:00
Jacob Dufault
1f0c1e922f Fix compile_commands.json parsing when filename is absolute.
Some compile_commands.json generators will emit absolute paths for the
filename, such as cmake.
2017-10-31 15:43:27 -07:00
Jacob Dufault
f48f818f4c Fix MacOS build 2017-10-31 15:43:07 -07:00
Jacob Dufault
7734943620 Format all code in src/ 2017-10-31 12:49:19 -07:00
Jacob Dufault
5f04e390a2 Fix threaded_queue 2017-10-31 12:39:02 -07:00
Jacob Dufault
4156be09c1 Fix inactive region after closing/reopening a document.
Also make it a bit more robust.
2017-10-28 15:09:14 -07:00
Jacob Dufault
98c701b217 Fix project loading absolute path normalization for clang_args 2017-10-28 14:51:36 -07:00
Jacob Dufault
82f8133d7e Log to cquery_diagnostics.log instead of cquery.log 2017-10-28 14:51:12 -07:00
Jacob Dufault
c694b56bc1 Reduce some locking in ThreadedQueue for status updates 2017-10-28 14:50:57 -07:00
Jacob Dufault
61b0cfb114 Don't emit ipc timings for cout messages. 2017-10-28 14:33:33 -07:00
Jacob Dufault
b9f72377dd Fix inactive region publishing when editing a file. 2017-10-28 14:31:54 -07:00
Jacob Dufault
235987bb58 Show progress indicator in status area 2017-10-25 00:12:11 -07:00
Jacob Dufault
39de197e8a Only target 80% of threads for indexers by default.
Using 100% - 1 tended to cause too much resource contention.
2017-10-24 19:18:47 -07:00
Jacob Dufault
37ab94e7b4 Add GetWorkingDirectory for linux 2017-10-24 19:11:11 -07:00
Jacob Dufault
ccff74a79c Fix performance regression in loading compile_commands.json
Regression was caused by accidental copying.
2017-10-24 19:00:29 -07:00
Jacob Dufault
738b338d47 Emit timings for project loading 2017-10-24 18:39:44 -07:00
Jacob Dufault
f698a3451f Update comment in utils.cc 2017-10-24 18:28:23 -07:00
Jacob Dufault
93d3b2b3cb Change whitelist behavior so it is more likely what the user wants. 2017-10-24 18:09:02 -07:00
Jacob Dufault
58f2107714 Inject -resource-dir automatically. 2017-10-24 18:02:15 -07:00
Jacob Dufault
0d091b69cf Minor style fix 2017-10-23 08:39:33 -07:00
Jacob Dufault
d145bcebc5 Fix completion issue where completing dropped completion session. 2017-10-23 08:38:01 -07:00
Jacob Dufault
f0e9434163 Add start/pause to Timer 2017-10-23 08:04:43 -07:00
Jacob Dufault
76cc110cc2 Simplify completion session management code. 2017-10-23 00:28:21 -07:00
Jacob Dufault
3e9cffcc62 Cleanup clang::TranslationUnit API so callers have to handle failures. 2017-10-22 22:07:50 -07:00
Jacob Dufault
9429dff63a Try to only ever have one completion session per file. 2017-10-22 21:49:17 -07:00
Jacob Dufault
a155f5b686 Fix a bunch of bugs in argument handling and address some TODOs 2017-10-18 01:24:52 -07:00
Jacob Dufault
0e7c8bdf05 Fix argument handling for chrome 2017-10-18 00:02:33 -07:00
Jacob Dufault
3003385d76 Update clang argument parsing 2017-10-17 23:23:07 -07:00
Jacob Dufault
a6807dcb8c Remove issue where diagnostics would disappear file saves.
Also allow rebuilding of completion session by closing and reopening a
file.
2017-10-17 11:43:33 -07:00
Jacob Dufault
809a55a351 When erasing a USR only erase def data.
This should hopefully fix some bad indexes. It is possible that a def is temporarily deleted. In that case, we don't want to nuke all of the callers/etc so that if the def is restored we still have that information.

If the def is actually erased it the normal IndexUpdate remove logic will eventually purge the extra state outside of just the def (ie, callers).
2017-10-16 22:45:26 -07:00
Jacob Dufault
272e23901c Handle missing cached dependencies better 2017-10-12 08:41:03 -07:00
Jacob Dufault
4364a37d76 Increase max completion sessions 2017-10-12 08:41:03 -07:00
Jacob Dufault
6704049e13 Disable real-time indexing.
It adds a bit too much latency to code completion. I suspect this can
be removed by running real-time indexing in a separate thread (though
this will require a dedicated CXTranslationUnit instance).
2017-09-27 13:44:54 -07:00
Jacob Dufault
7531a0b4e5 Real-time indexing as you type. 2017-09-26 23:03:43 -07:00
Jacob Dufault
80df5beee5 Fix code completion isIncomplete handling.
isIncomplete would not be set to true when there was no filter text but we elided entries.
2017-09-26 21:44:56 -07:00
Jacob Dufault
084d5c8d91 Fix two TODOs 2017-09-26 21:40:47 -07:00
Jacob Dufault
d57ecff497 Disable not sending isIncomplete optimization 2017-09-25 14:33:28 -07:00
Jacob Dufault
145975df6b Fix some issues in import pipeline. 2017-09-23 17:36:28 -07:00
Jacob Dufault
87394de1cf Handle error condition instead of asserting, since it is occassionaly hit.
This needs to be debugged later.
2017-09-22 00:39:59 -07:00
Jacob Dufault
6b0c3831fa Add project parsing test 2017-09-21 23:50:27 -07:00
Jacob Dufault
511bbbe391 Add TODO 2017-09-21 23:48:05 -07:00
Jacob Dufault
bd8582e718 A bit more code cleanup in project.cc 2017-09-21 20:09:11 -07:00
Jacob Dufault
a96be1d6e5 Cleanup how include directories are passed around in project. 2017-09-21 20:02:48 -07:00
Jacob Dufault
5704ef5077 Cleanup completion logging. Also don't mark isIncomplete for completion results as aggressively. 2017-09-21 19:45:17 -07:00
Jacob Dufault
772f547065 Update diagnostics on document change, not code completion.
This also changes the API used for reporting diagnostics, which will hopefully be more reliable. This requires reparsing the document, though, so it is much slower. We do this after reporting code completion though, so hopefully the performance delay is not too noticable.
2017-09-21 19:25:33 -07:00
Jacob Dufault
1df8fd7c7a Remove some static_casts. 2017-09-21 18:32:55 -07:00
Jacob Dufault
772df3e92a Move InsertSymbolIntoResult into query_utils.cc 2017-09-21 18:18:24 -07:00
Jacob Dufault
f5314b62b1 Reformat to Chromium style. 2017-09-21 18:14:57 -07:00
Jacob Dufault
1b1be28be4 Log files joined in IndexFile merges. 2017-09-21 17:59:46 -07:00
Jacob Dufault
ba7461fc24 Fix dependency scanning on import.
The same dependency would cause multiple translation units to get reindexed.
2017-09-19 22:08:17 -07:00
Jacob Dufault
a06f730958 Better logging, add notes about a bug. 2017-09-14 00:22:06 -07:00
Jacob Dufault
d6a8071da4 Be more aggressive about only indexing files once.
This should help fix perf regressions with long import times after syncing.
2017-09-13 23:39:32 -07:00
Jacob Dufault
036c2819f1 Add some whitespace 2017-09-13 22:18:15 -07:00
Jacob Dufault
cd58eafd90 Simplify import dedup by allowing indexer to reparse the same document concurrently. Removes a critical section simplifies the code.
Instead we dedup the imports between creating an id map and applying the update.
2017-09-13 21:51:39 -07:00
Jacob Dufault
104cfd167c Fix linux build 2017-09-13 10:53:13 -07:00
Jacob Dufault
d9143f065d Fix indexer crash when indexing MSVC STL. 2017-09-12 22:51:13 -07:00
Jacob Dufault
17565f9a14 Make some good progress on e2e tests. 2017-09-12 20:35:53 -07:00
Jacob Dufault
6cdb7c66e1 Remove unused function 2017-08-18 10:26:05 -07:00
Jacob Dufault
3f44307268 Call malloc_trim(0) on Linux 2017-08-17 11:02:47 -07:00
Jacob Dufault
2328141d98 Fix clang compile 2017-08-16 22:17:24 -07:00
Jacob Dufault
b1d9602682 Dedup import requests, show diagnostics on interactive indexes, priority index file when opening it 2017-08-16 20:39:00 -07:00
Jacob Dufault
58fbd04142 Add ThreadedQueue::EnqueueAll to reduce lock contention. 2017-08-16 19:14:54 -07:00
Jacob Dufault
28ddc9f346 Re-enable anonymous namespace in command_line.cc 2017-08-16 19:08:00 -07:00
Jacob Dufault
4245bac1db Make import pipeline a bit more flexible w.r.t. writing indexed content to disk. 2017-08-16 19:06:28 -07:00
Jacob Dufault
d5bdf8ce0a Rename/cleanups 2017-08-15 22:45:42 -07:00
Jacob Dufault
7901653698 Make sure file exists before importing it. 2017-08-15 22:39:50 -07:00
Jacob Dufault
49aca3038b Cache timestamps when importing, which improves import time by 5x on windows.
cquery import goes from 2.5s to 0.5s
2017-08-15 20:54:59 -07:00
Jacob Dufault
274c98f032 Fix import pipeline stall due to blocking Deqeue call. 2017-08-15 20:29:49 -07:00
Jacob Dufault
81594a1497 Fix LoadCachedIndex crash if deserialization failed. 2017-08-15 20:29:09 -07:00
Jacob Dufault
7faedfdf00 Do not import empty dependencies 2017-08-15 20:28:52 -07:00
Jacob Dufault
3ab4d0455d Fix delta update.
Previous file was being loaded after the current file is written to disk.
2017-08-15 00:46:21 -07:00
Jacob Dufault
59851c06e0 More import pipeline simplifications.
Move already-import dependency checking to a separate stage.
2017-08-15 00:22:13 -07:00
Jacob Dufault
5a451d3ad1 Remove some additional overhead created for out of process 2017-08-14 22:53:44 -07:00
Jacob Dufault
db9a97d586 Remove out of process indexer support.
malloc_trim does a good enough job that we don't need it anymore.
2017-08-14 19:07:46 -07:00
Jacob Dufault
ee003a2cf0 Log when we are doing delta updates 2017-08-05 15:44:44 -07:00
Jacob Dufault
5b69c5bfc5 Small cleanup 2017-08-01 20:40:30 -07:00
Jacob Dufault
cac5dcaf8f Simplify queue management 2017-08-01 20:23:37 -07:00
Jacob Dufault
c89f651cd8 More iteration on task system 2017-08-01 20:23:06 -07:00
Jacob Dufault
b9061ccc07 WIP task system 2017-08-01 01:24:06 -07:00
Jacob Dufault
50a726f59e Simplify Index_OnIdMapped 2017-07-30 11:49:24 -07:00
Jacob Dufault
1f3f69b221 Reuse loaded file contents in indexer; clear large state before caching. 2017-07-30 11:31:41 -07:00
Jacob Dufault
85f3c00376 Some more small cleanup 2017-07-30 00:16:08 -07:00
Jacob Dufault
6d9e4242d1 Use shared_ptr, try to fix a crash. 2017-07-29 23:51:32 -07:00
Jacob Dufault
e771f05f3f Linux build fixes 2017-07-29 21:46:21 -07:00
Jacob Dufault
ee20d79dcc wip 2017-07-29 21:24:02 -07:00
Jacob Dufault
c83b9eab77 Fix issue when buffer contents do not get synced properly near start of file 2017-07-29 21:13:22 -07:00
Jacob Dufault
2a1ce80b4d Change perf logs to use LOG_S 2017-07-29 17:45:00 -07:00
Jacob Dufault
6518f8b79a Add tiny-process-library 2017-07-29 17:44:32 -07:00
Jacob Dufault
a9bac06b83 Add MoveFileTo 2017-07-28 17:08:18 -07:00
Jacob Dufault
ea5508a699 Perf can now be serialized 2017-07-28 17:08:04 -07:00
Jacob Dufault
cf8b95809f Hide error messages when scanning a directory and file open fails 2017-07-28 17:07:50 -07:00
Jacob Dufault
7b052d887d Add DequeuePlusAction 2017-07-28 17:07:27 -07:00
Jacob Dufault
c37396a36d First pass at logging using loguru 2017-07-27 19:14:46 -07:00
Jacob Dufault
1e995dc30e Cleanup call tree appearance
- Use up/down icons instead of [B] and [D]
- Don't show column number
- Show declaring type instead of path if applicable
2017-07-20 23:16:27 -07:00
Jacob Dufault
475afc77a5 Support functions in type hierarchy. 2017-07-20 19:53:08 -07:00
Jacob Dufault
a046f89650 Do not show base calls in tree view that come from derived function. 2017-07-20 19:42:56 -07:00
Jacob Dufault
64580decab Push cursor position to end when updating delayed diagnostics 2017-07-19 00:20:19 -07:00
Jacob Dufault
08fb60a675 Show call tree expand button if function has base or derived callers. 2017-07-19 00:17:38 -07:00
Jacob Dufault
79ec5a749a Improve tree view
- Show base/derived callers ([B] and [D] prefix)
- Show call position information
- Temporarily prevent duplicate calls from appearing, needs a proper fix.
2017-07-19 00:12:29 -07:00
Jacob Dufault
f4db0967b2 Show based/derived callers in callers keyboard shortcut. 2017-07-19 00:12:29 -07:00
Jacob Dufault
57e5fe1814 Fix crash 2017-07-17 13:03:42 -07:00
Jacob Dufault
ba973ba1bf Remove unused variables 2017-07-17 10:41:59 -07:00
Jacob Dufault
22bb89fca1 Add options to turn off diagnostics.
diagnostics.onParse: semi-real time diagnostics that reported when a file is indexed or prepared for code completion
diagnostics.onCodeComplete: real time diagnostics that are reported as you type
2017-07-15 17:25:52 -07:00
Jacob Dufault
152e98363f Refresh diagnostics 5 seconds after the last code completion. 2017-07-15 17:08:07 -07:00
Jacob Dufault
00e452272f Do not use clang_Location_isInSystemHeader for diagnostics; causes crashes 2017-07-12 15:02:48 -07:00
Jacob Dufault
aae126f899 Disable diagnostics during code completion (causes crashes) 2017-07-12 11:34:05 -07:00
Jacob Dufault
dde1c687ec Build diagnostics during code completion 2017-07-12 11:26:08 -07:00
Jacob Dufault
d1cbc32c81 Hopefully fix completion crashes.
It was caused due to a multithreading race. A vector was assigned to twice at the same time, which caused a crash in the destructor.
2017-06-29 23:51:22 -07:00
Jacob Dufault
b683c863e3 Add enable_shared_from_this to CompletionSession 2017-06-29 23:19:16 -07:00
Jacob Dufault
808e0f5277 Fix clang build 2017-06-29 10:30:22 -07:00
Jacob Dufault
f498f0ccb1 Fix showing duplicate completion entries, always provide insertText. 2017-06-28 23:59:38 -07:00
Jacob Dufault
b4000fa956 Don't show code lens on include/header guards. 2017-06-28 23:34:04 -07:00
Jacob Dufault
6ab8a27313 Mark macros in index. 2017-06-28 23:28:29 -07:00
Jacob Dufault
b5305e14f2 Add |is_macro| state to IndexVar.
This does not handle setting |is_macro|, this CL is about updating the
tests.
2017-06-28 23:25:29 -07:00
Jacob Dufault
85ec4b9843 Use shared_ptr in command_line for completion data.
Also add thread exit logs so to check if the stack has gone away.
2017-06-28 21:59:16 -07:00
Jacob Dufault
3228619414 Small fixes to auto-include and auto-implement fixits. 2017-06-28 21:40:30 -07:00
Jacob Dufault
25d450cf8b Always include literal completions 2017-06-28 21:33:52 -07:00
Jacob Dufault
706479aded Completion changes (maybe fix some crashes) 2017-06-28 19:50:30 -07:00
James Cook
0876886c60 Fix build error on Linux for INT_MIN (#10)
* Fix compiler warnings and turn on warnings as errors

* Fix build error on Linux for INT_MIN
2017-06-20 08:17:23 -07:00
Jacob Dufault
8dd751a70f Fix completion for items with underscores. 2017-06-19 23:31:34 -07:00
Jacob Dufault
36ee8bec47 Consider filename ending when guessing arguments.
This should improve guessing for, ie, test files, like foo_test.cc.
2017-06-19 19:09:15 -07:00
Jacob Dufault
a005cc627d Generate diagnostics when indexing a file, even if non-interactive. 2017-06-19 18:52:25 -07:00
Jacob Dufault
ced7c878b7 Don't show unique file id warning if there is no file name 2017-06-19 18:51:56 -07:00
Jacob Dufault
491e7b4625 Prefer literal string matches in global symbol search 2017-06-19 18:32:19 -07:00
James Cook
5b4986f04b Fix compiler warnings and turn on warnings as errors 2017-06-19 18:30:44 -07:00
Jacob Dufault
61f023fec8 clang build fix 2017-06-16 10:14:09 -07:00
Jacob Dufault
11af3986ba Better symbol resolution (ie, goto definition) for macro arguments. 2017-06-15 23:43:02 -07:00
Jacob Dufault
f8f4c06c20 Better error message when getting a unique file id fails. 2017-06-15 23:07:03 -07:00
Jacob Dufault
b04ce0c503 Auto-index file on open 2017-06-15 22:56:07 -07:00
Jacob Dufault
bb46b38b1c Make global symbol search a bit more fuzzy 2017-06-15 19:30:00 -07:00
Jacob Dufault
9d1369786f Pre-filter completion results before sending to vscode.
This results in a less laggy completion experience. Before, vscode would
drop frames if handed too many completions (ie, by typing #include in a
very large project).
2017-06-15 19:28:49 -07:00
Jacob Dufault
1ade2e5ca1 Show more variables in global symbol search 2017-06-15 19:28:07 -07:00
Jacob Dufault
99db0a1596 Add some additional code completion logging. 2017-06-14 22:47:41 -07:00
Jacob Dufault
7a71447273 Move some code out of command_line.cc 2017-06-14 22:47:41 -07:00
Jacob Dufault
7328d138e3 Fix linker error on clang (issue #2) 2017-06-14 20:12:52 -07:00
Jacob Dufault
053aa549f0 Bump extension version. 2017-06-14 00:13:26 -07:00
Jacob Dufault
14009293ba Fix IPC message e2e hiding 2017-06-13 23:59:40 -07:00
Jacob Dufault
3d0b8fd807 Fix call tree when function ref does not refer to a function. 2017-06-13 23:50:30 -07:00
Jacob Dufault
4bddc95908 Fix possible race when setting diagnostics. 2017-06-13 23:29:41 -07:00
Jacob Dufault
84b7ec930b Log completion session creation/destruction. Ensure $0 is at end of insert text for final tab stop. 2017-06-13 23:15:18 -07:00
Jacob Dufault
584f7b45b9 Uniqueify include string proposals 2017-06-13 23:09:25 -07:00
Jacob Dufault
511f6c5248 Fix crash when loading old cache when file format changed.
Also eliminate an unnecessary copy after finishing deserialization.
2017-06-13 21:00:51 -07:00
Jacob Dufault
8fece6c252 Remove some extra logging 2017-06-13 20:41:30 -07:00
Jacob Dufault
0e5312790e Add more detailed logging for failed unique file id 2017-06-13 20:08:31 -07:00
Jacob Dufault
64253ec174 Use shared_ptr in a couple more spots. 2017-06-09 21:15:33 -07:00
Jacob Dufault
dec484ed0d Only report diagnostics from code completion document parse.
Also use shared_ptr, hopefully fix memory crashes.
2017-06-09 21:13:16 -07:00
Jacob Dufault
c262e1674d Misc fixes 2017-06-09 18:02:48 -07:00
Jacob Dufault
f0fb8db3e5 Update clang args again 2017-06-09 00:14:36 -07:00
Jacob Dufault
db60b72e3b Update clang_arg on windows 2017-06-09 00:08:14 -07:00
Jacob Dufault
767b4ac0e1 Small code cleanup 2017-06-09 00:08:06 -07:00
Jacob Dufault
1fc2d2756e Don't show output when there is an error. Force extension update. 2017-06-08 23:26:04 -07:00
Jacob Dufault
3358e6afd3 Update settings.json paths 2017-06-08 23:22:00 -07:00
Jacob Dufault
41d8cd9a0c Fix memory leaks 2017-06-08 23:22:00 -07:00
Jacob Dufault
598b53efff Show diagnostics for tests, update absolute paths 2017-06-08 23:22:00 -07:00
Jacob Dufault
8c50324576 Small fixes for osx 2017-05-30 17:54:19 -07:00
Jacob Dufault
c40df5c0e5 Provide code action to auto-include an undefined symbol. 2017-05-29 16:57:19 -07:00
Jacob Dufault
80e78831d4 Small formatting change in clang_utils 2017-05-29 16:34:11 -07:00
Jacob Dufault
f5efa02448 Clear diagnostics for open files. 2017-05-29 16:33:57 -07:00
Jacob Dufault
7b790e7da3 Fix file name typo 2017-05-29 14:21:08 -07:00
Jacob Dufault
d834d4db08 Provide code action to auto-implement methods (useful for classes or function declarations). 2017-05-29 14:18:35 -07:00
Jacob Dufault
1d67d1ee37 Add additional metadata to function declarations. 2017-05-27 18:53:22 -07:00
Jacob Dufault
3469850c98 Change how function declarations are serialized so parameter info can be added. 2017-05-27 14:09:20 -07:00
Jacob Dufault
b7f7987cb8 Use cached location 2017-05-27 13:10:06 -07:00
Jacob Dufault
5415f4be50 Don't count the '~' in type usages for destructors. 2017-05-27 13:02:49 -07:00
Jacob Dufault
dcc71f2470 More cleanup in indexer 2017-05-27 12:56:39 -07:00
Jacob Dufault
e431dbd793 Some renames in indexer. Fix warning for namespace alias. 2017-05-27 12:33:18 -07:00
Jacob Dufault
e9025104cb Rename some variables in the indexer. 2017-05-27 10:03:49 -07:00
Jacob Dufault
b66f015a4a Some small cleanup when indexing function declaration/definition. 2017-05-27 09:57:52 -07:00
Jacob Dufault
968b6c0966 Remove HasInterestingState().
These don't serve any real purpose since the multi-file indexer tests.
2017-05-27 00:47:03 -07:00
Jacob Dufault
79a4d8ad79 Proper error reporting when request fails due to missing file. 2017-05-27 00:10:21 -07:00
Jacob Dufault
385531521f Harden against bad language server method call in completion. 2017-05-26 23:51:32 -07:00
Jacob Dufault
d816e2618a Some renames, promote view completion sessions to edit sessions 2017-05-26 21:21:00 -07:00
Jacob Dufault
7840b7a015 Cache global completion results. 2017-05-26 00:10:55 -07:00
Jacob Dufault
cdc268d549 Preload code completion, maintain LRU cache for multiple completion files. 2017-05-25 23:40:38 -07:00
Jacob Dufault
2e3e1e0427 Refactor quote extraction 2017-05-25 21:26:35 -07:00
Jacob Dufault
f5ed2828c3 Fix code lens sometimes appearing on "};" 2017-05-25 21:09:10 -07:00
Jacob Dufault
8bbd9b7694 Revert change to use CXTranslationUnit_Incomplete when indexing. It broke tests. 2017-05-24 20:06:05 -07:00
Jacob Dufault
32940e2c88 Experiment with caching CXIndex across multiple sessions 2017-05-24 19:04:19 -07:00
Jacob Dufault
d47869ad0f Do not remove querydb defined type/func/var if the final reference is removed from a file.
We still remove the defined type/func/var if it was defined in that file, though.
2017-05-24 17:45:33 -07:00
Jacob Dufault
97832f2a73 Add call tree and full type hierarchy using upcoming vscode tree API 2017-05-24 00:17:29 -07:00
Jacob Dufault
6c66beb0fa Increment index version 2017-05-23 00:52:20 -07:00
Jacob Dufault
37787290cb Make sure every include candidate is unique w.r.t. absolute path.
Also do not follow symlinks when iterating a directory.
2017-05-23 00:24:14 -07:00
Jacob Dufault
ee90938b28 Fix goto def when implicit functions are called.
Don't import the implicit functions into the 'all symbols' structure. This fixes symbol lookup.
2017-05-22 23:57:46 -07:00
Jacob Dufault
2e4c5474da Index implicit function calls. 2017-05-22 23:47:27 -07:00
Jacob Dufault
1598129d8b Fix file finding on windows when path case changes. 2017-05-22 00:14:11 -07:00
Jacob Dufault
8d9374ee59 Disable logging of filtered project paths, but let user enable it in config. 2017-05-21 23:45:47 -07:00
Jacob Dufault
da6a8f335f Only delta update on file save if the file is already imported. 2017-05-21 23:18:38 -07:00
Jacob Dufault
dc605bc5c3 Don't import defs without definition information into querydb 2017-05-21 23:09:09 -07:00
Jacob Dufault
440fa950a0 Use -xc (instead of -xc++) for files ending with .c.
A good chunk of c files will fail to compile under c++ mode.
2017-05-21 23:06:30 -07:00
Jacob Dufault
639bf8a431 Show error message when regex parsing fails. 2017-05-21 22:54:27 -07:00
Jacob Dufault
c66c927c1f Fix some more warnings from clang 2017-05-21 16:48:21 -07:00
Jacob Dufault
8910d0a13e Fix warnings (almost all numeric cast-related) 2017-05-21 16:22:00 -07:00
Jacob Dufault
e182ac12ae Elide long include path proposals 2017-05-21 14:01:52 -07:00
Jacob Dufault
89b34a359c Log message if creating regex fails 2017-05-21 14:00:48 -07:00
Jacob Dufault
864ff122d8 Scan include directories for include completion candidates. 2017-05-21 12:51:15 -07:00
Jacob Dufault
a058eb8e95 Small nits 2017-05-21 00:56:21 -07:00
Jacob Dufault
3fe824e208 Fix clang compile 2017-05-21 00:43:10 -07:00
Jacob Dufault
94bd6fc301 Add #include auto-complete. 2017-05-21 00:37:53 -07:00
Jacob Dufault
7a79532fff Report document links on includes 2017-05-20 21:30:59 -07:00
Jacob Dufault
41e1dff4c9 Goto definition for includes 2017-05-20 20:47:20 -07:00
Jacob Dufault
529f309c45 Index macros (treat them like variables) 2017-05-20 18:58:54 -07:00
Jacob Dufault
d3bd31604e Code lens improvements
- Hide declaration from list of refs on types and variables (so now they will show as '0 refs')
- Let the user hide code lens on parameter and function-local variables
2017-05-20 18:26:50 -07:00
Jacob Dufault
44153f94e8 Fix auto variable type deduction when auto is a pointer. 2017-05-20 17:19:32 -07:00
Jacob Dufault
b79b98f464 Darken/fade code disabled by preprocessor. 2017-05-20 14:45:46 -07:00
Jacob Dufault
f3d00dea23 Implement code actions using clang FixIts
- Also make server check client version and show an error message if they do not match.
2017-05-20 12:31:07 -07:00
Jacob Dufault
440c6c5325 Small code cleanup 2017-05-20 01:23:01 -07:00
Jacob Dufault
b258f2dd0b Cache signature completion as well.
- Also check file path when validating completion cache.
2017-05-20 01:20:37 -07:00
Jacob Dufault
9d3187a06c Don't bother saving if we reported diagnostics.
Always report if file has diagnostics, always report if file is interactive.
2017-05-20 01:07:54 -07:00
Jacob Dufault
29845cc1e3 Cache code completion results for backspace character. 2017-05-20 01:07:29 -07:00
Jacob Dufault
9ae526089a Fix removing entries from querydb.
I expect this will resolve most of the issues with the index getting messed up when actively editing a file.
2017-05-20 00:33:11 -07:00
Jacob Dufault
b3d5327342 Real-time diagnostics via clang_codeCompleteAt 2017-05-19 23:35:14 -07:00
Jacob Dufault
54fed027ce Fix CopyFileTo when there is already a destination file.
This fixes reindexing files, as before we would update the json but not
the indexed file contents which caused code lens and references to get
out of sync.
2017-05-19 17:41:27 -07:00
Jacob Dufault
3e00e5fc0c Log compile arguments when there is a libclang failure 2017-05-19 09:51:42 -07:00
Jacob Dufault
00143bef8e Log index updates before applying them 2017-05-19 00:02:01 -07:00
Jacob Dufault
f9787f83d8 Don't serialize diagnostics 2017-05-18 22:44:23 -07:00
Jacob Dufault
cf45c91bcd A bit more work on making a faster compile_commands.json loader 2017-05-18 18:14:53 -07:00
Jacob Dufault
1d6477c3e9 Fix compile 2017-05-18 18:14:15 -07:00
Jacob Dufault
866faed4fc Exit when there is no more stdin input 2017-05-18 18:13:51 -07:00
Jacob Dufault
2b407e0bce Basic performance data tracking during indexing 2017-05-17 00:08:45 -07:00
Jacob Dufault
f2d46e86b7 Don't force index updates on primary translation unit when updating dependency indexes. 2017-05-16 23:09:53 -07:00
Jacob Dufault
c5f29c277b Fix off-by-one error for resolving document column to symbol column 2017-05-16 23:05:12 -07:00
Jacob Dufault
59a077d8a9 Fix race condition when saving indexed file contents to cache. 2017-05-16 23:01:51 -07:00
Jacob Dufault
671a54c7af Move most of the information in document outline to containerName. This makes searching nicer. 2017-05-16 00:45:46 -07:00
Jacob Dufault
f907d1d1b9 When indexing make sure we use the correct contents.
Hopefully this will make overlapping saves more robust.
2017-05-16 00:38:15 -07:00
Jacob Dufault
d8567c75cc More robust approach for tracking indexed file. 2017-05-16 00:26:26 -07:00
Jacob Dufault
83f8c7afa8 Better insert text for STL types 2017-05-15 00:58:29 -07:00
Jacob Dufault
b727fc5a36 Fix signature help for calls prefixed by a namespace 2017-05-15 00:37:47 -07:00
Jacob Dufault
3001faf9a8 Signature help and snippets for code completion 2017-05-15 00:29:22 -07:00
Jacob Dufault
7f33861526 Don't serialize diagnostics for tests. 2017-05-15 00:29:22 -07:00
Jacob Dufault
2c20cf0157 Add some partial update tests 2017-05-15 00:29:22 -07:00
Jacob Dufault
a92a83a319 Simplify cquery building, prepackage extension. 2017-05-12 00:15:17 -07:00
Jacob Dufault
ff421723a5 Renames and fix some operator < implementations 2017-05-11 23:08:15 -07:00
Jacob Dufault
61aaf4509c Fix PriorityEnqueue; use it when saving a file so index results come in faster for actively edited files. 2017-05-11 00:41:27 -07:00
Jacob Dufault
a587022643 Fix some more operator< implementations. This may fix some of the IndexUpdate diff issues. 2017-05-11 00:38:57 -07:00
Jacob Dufault
57da6a81ab Make update delta work a bit better. Still buggy though. 2017-05-11 00:20:00 -07:00
Jacob Dufault
74d67b0eb5 Update readme, add TODO 2017-05-10 23:36:34 -07:00
Jacob Dufault
4c487ab797 Reparse document after save for code completion, but don't drop existing completion state until after reparse is done. 2017-05-10 23:25:41 -07:00
Jacob Dufault
20429ed397 Clear diagnostics if previously reported 2017-05-10 18:44:39 -07:00
Jacob Dufault
202ab60ede Added diagnostics. 2017-05-09 23:13:13 -07:00
Jacob Dufault
1083a10a66 Fix some threading bugs with code completion 2017-05-09 21:52:15 -07:00
Jacob Dufault
4a4315d7a1 Set code completion thread name 2017-05-09 21:00:05 -07:00
Jacob Dufault
6737599c11 Add CXTranslationUnit_CreatePreambleOnFirstParse for code completion on non-Windows machines. 2017-05-08 22:15:35 -07:00
Jacob Dufault
8ed20567a1 Only allow one active index request per file when actively editing. 2017-05-08 22:09:57 -07:00
Jacob Dufault
ad0a03b0da Split global usr lookup into separate lookups for file/type/func/var.
This eliminates problems when actively editing code, ie, a USR can change from being a variable to being a type.
2017-05-08 21:20:28 -07:00
Jacob Dufault
ea5400a633 Add todo; use clang_parseTranslationUnit2 2017-05-08 18:21:21 -07:00
Jacob Dufault
629876007e Fix clang compile 2017-05-08 18:21:21 -07:00
Jacob Dufault
d1287f8fc8 Fix crash when trying to load cache that does not exist 2017-05-08 18:21:21 -07:00
Jacob Dufault
a97bd9d1c4 WIP better command line parsing 2017-05-08 18:21:21 -07:00
Jacob Dufault
9ffed9a253 Add assert when updating test expectations 2017-05-08 18:21:21 -07:00
Jacob Dufault
4efb4dbf25 Make querydb import more robust to usr changes 2017-05-08 18:21:21 -07:00
Jacob Dufault
5524abdaa7 Support keyboard shortcuts for vars, callers, base, and derived. 2017-05-06 23:56:04 -07:00
Jacob Dufault
fc55589ed3 Infer arguments for files not in the project. 2017-05-06 22:36:29 -07:00
Jacob Dufault
e1e45b6dc5 Emit warning for bad working file index instead of crashing. 2017-05-06 22:34:43 -07:00
Jacob Dufault
1b4f377682 WIP but basic test e2e test running 2017-05-02 23:45:10 -07:00
Jacob Dufault
bf21cde14a Remove default platform arguments for linux. 2017-04-25 21:13:04 -07:00
Jacob Dufault
49c687663e Rework some of the command line flag parsing logic. Hopefully make it more robust. 2017-04-25 21:03:22 -07:00
Jacob Dufault
839f3d9968 Try parsing with full argv. Also hide system diagnostics. 2017-04-25 19:57:36 -07:00
Jacob Dufault
c77531a432 Log initialization options, reactivate working file asserts. 2017-04-25 19:57:36 -07:00
Jacob Dufault
592ef1c3cf Better code completion trigger characters. 2017-04-23 18:52:38 -07:00
Jacob Dufault
526fefaf09 Don't rename '.' to '_' in cache files.
This makes it easier to browse cached cc/etc files.

Also clean up logging a bit.
2017-04-23 18:24:09 -07:00
Jacob Dufault
91b5614c7e Optimize import pipeline.
Previous implementation was slower at reindexing if loading from cache because primary cc files would be reindexed for every dependency that changed.
2017-04-23 18:01:51 -07:00