Commit Graph

438 Commits

Author SHA1 Message Date
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