Commit Graph

180 Commits

Author SHA1 Message Date
Fangrui Song
642975ea17 Reflect string_view and fix workspace/symbol 2018-02-01 13:48:41 -08:00
Fangrui Song
8108de0cfa Change short_names/detailed_names from const std::string& to std::string_view 2018-01-31 19:53:50 -08:00
Fangrui Song
77dca1936b Change TypeDefDefinition::short_name from string to string_view 2018-01-30 23:01:59 -08:00
Fangrui Song
93269ecfd4 Change std::string FuncDefDefinition::short_name to ShortName() 2018-01-30 22:40:02 -08:00
Fangrui Song
41f87887bb Change std::string VarDefDefinition::short_name to ShortName() 2018-01-30 22:04:55 -08:00
Jacob Dufault
f6a2a55209 Import pipeline improvements
- Cache manager is created by request
- Index is always associated with its contents
- Reduced frequently of file reads
2018-01-29 21:34:36 -08:00
Jacob Dufault
0eb7d415d7 usr_to_file uses new NormalizedPath type 2018-01-29 16:56:00 -08:00
Jacob Dufault
a392301be3 Format 2018-01-29 16:27:43 -08:00
Fangrui Song
795dfc670c Update tests after specialization handling 2018-01-28 23:40:57 -08:00
Fangrui Song
16bf3158c5 Add SymbolRole to SymbolRef and fix $cquery/{base,derived} by ordering definitions before uses 2018-01-28 20:39:41 -08:00
Fangrui Song
bdb880e0a5 Serialize VarDefDefinitionData::{parent_kind,parent_id} 2018-01-28 12:34:31 -08:00
Fangrui Song
5763201838 Remove is_type_member & VarDefDefinitionData::declaring_type
Rename ClangStorageClass to StorageClass
Add semantic_parent & semantic_parent_kind (but not serialized yet)
Move query.h SymbolKind to indexer.h SymbolKind and make it uint8_t
2018-01-27 20:46:06 -08:00
Fangrui Song
d605217c1a matcher.cc: use std::regex_search instead of std::regex_match
Prototype of non-working `dependencies` parameter of $cquery/freshenIndex
2018-01-27 10:42:18 -08:00
Fangrui Song
0bbabbcbd2 Move IndexVar::def::declarations to IndexVar::declarations 2018-01-26 21:50:17 -08:00
Fangrui Song
e892c23955 Change declaration to declarations in IndexVar 2018-01-26 18:21:15 -08:00
Fangrui Song
723c78409f Move is_operator from indexer to semantic highlighting 2018-01-26 10:08:56 -08:00
Fangrui Song
351e7b6c95 Add ClangStorageClass storage; to {Func,Var}DefDefinitionData and semantic highlighting.
This can be used to differentiate local/global variables, template parameters.
Also make msgpack deserialization robust.
2018-01-26 09:47:42 -08:00
Fangrui Song
1aec53621f Use std::vector<std::string> files_removed;
It turns out this field is not used.
2018-01-25 22:42:58 -08:00
Fangrui Song
273af8306f Move GetQueryFileIdFromPath to unnamed namespace, make them inline and optional 2018-01-20 10:44:30 -08:00
Fangrui Song
76c38787df CXCursor_OverloadCandidate is lsCompletionItemKind::Text
See clang/test/Index for some OverloadCandidate cases, they all start with Text.
2018-01-20 10:07:52 -08:00
Fangrui Song
c5bb14e86b Use INVALID_ID instead of optional and clean up 2018-01-20 09:59:12 -08:00
khng300
427f7b79e3 Use GetQuery{Type,Func,Var}IdFromUsr for querying QueryDatabase::usr_to_{type,func_var} (#315)
* Use GetQuery{Type,Func,Var}IdFromUsr for querying usr_to_{type,func_var}

Instead of directly touching usr_to_{type,func_var}, use dedicated
methods to touch them for more abstraction around QueryDatabase.

* Use `Usr` as parameter for GetQueryVarIdFromUsr()

To maintain code consistency with other similar helpers.
2018-01-20 08:57:41 -08:00
Fangrui Song
804c9c8b1e Copy Query*::kind to Index*::kind 2018-01-15 15:51:24 -08:00
Jacob Dufault
e20a6e9790 Add siphash.h, HashUSR -> HashUsr 2018-01-14 13:18:12 -08:00
Fangrui Song
54ac72115e Change line/column to 0-based and only use 1-based when (de,)serialized to JSON 2018-01-14 11:54:23 -08:00
Fangrui Song
da2cbe4152 USR -> Usr 2018-01-13 00:10:39 -08:00
Fangrui Song
14a213d407 Change std::string USR to uint64_t pseudorandom function (SipHash 64-bit) 2018-01-12 23:47:24 -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
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
54394ed868 Format 2018-01-10 18:43:01 -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
516b94e982 Change VarClass::cls to ClangSymbolKind::kind
ClangSymbolKind is ported from clang::index::SymbolKind
2018-01-05 22:43:12 -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
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
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
Jacob Dufault
b8e7a5bcb3 Format code 2017-12-27 07:54:46 -08:00
romix
03b50ea3cc Serialize decl comments and use them in GetHoverForSymbol 2017-12-24 18:01:38 -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
scturtle
cb7ccbe543 Change var.def.is_* to enum. 2017-12-23 19:29:32 -06:00
Chao Shen
0985613d16 Add is_global and is_member. 2017-12-23 01:00:46 -06:00
Jacob Dufault
be961fc4f2 Add hover (instead of reusing detailed_name) 2017-12-18 21:20:00 -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
4a7ca6168f Reformat 2017-12-07 11:54:51 -08:00
Jacob Dufault
b441a90e0d Finish migrating to messages/ 2017-12-05 19:46:36 -08:00
Jacob Dufault
9b44bf7901 Run ./format.sh 2017-12-01 09:55:41 -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
4e153784f6 Index language as enum instead of string 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
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
Jacob Dufault
6a50c48aaa Formatting and a TODO 2017-11-18 09:29:48 -08:00
Jacob Dufault
348b4a2e4e Move libclangmm/Cursor.* to clang_cursor.* 2017-11-11 11:31:05 -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
7734943620 Format all code in src/ 2017-10-31 12:49:19 -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
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
f5314b62b1 Reformat to Chromium style. 2017-09-21 18:14:57 -07:00
Jacob Dufault
7901653698 Make sure file exists before importing it. 2017-08-15 22:39:50 -07:00
Jacob Dufault
ee20d79dcc wip 2017-07-29 21:24:02 -07:00
Jacob Dufault
b4000fa956 Don't show code lens on include/header guards. 2017-06-28 23:34:04 -07:00
Jacob Dufault
1ade2e5ca1 Show more variables in global symbol search 2017-06-15 19:28:07 -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
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
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
dc605bc5c3 Don't import defs without definition information into querydb 2017-05-21 23:09:09 -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
a058eb8e95 Small nits 2017-05-21 00:56:21 -07:00
Jacob Dufault
41e1dff4c9 Goto definition for includes 2017-05-20 20:47:20 -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
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
00143bef8e Log index updates before applying them 2017-05-19 00:02:01 -07:00
Jacob Dufault
2c20cf0157 Add some partial update tests 2017-05-15 00:29:22 -07:00
Jacob Dufault
ff421723a5 Renames and fix some operator < implementations 2017-05-11 23:08:15 -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
4efb4dbf25 Make querydb import more robust to usr changes 2017-05-08 18:21:21 -07:00
Jacob Dufault
278eb0cd77 Better support for removing data from querydb 2017-04-22 00:43:48 -07:00
Jacob Dufault
bb25640d91 Rename instantiations to instances. 2017-04-21 00:03:33 -07:00
Jacob Dufault
5ef4f55053 Fix code lens for variable instantiations 2017-04-20 23:46:53 -07:00
Jacob Dufault
c60fae5abb Fix import crash 2017-04-19 10:55:54 -07:00
Jacob Dufault
cbe308c0f9 Try to have better behavior when types are defined across multiple files. 2017-04-18 23:56:37 -07:00
Jacob Dufault
eb83ba26e1 Add sparsepp as a replacement for sparsehash 2017-04-18 22:45:54 -07:00
Jacob Dufault
85734278d8 Misc fixes 2017-04-18 17:05:14 -07:00
Jacob Dufault
26c0bfe71d Misc fixes 2017-04-17 13:40:50 -07:00
Jacob Dufault
55f527b975 Spend time on indexer thread doing a higher quality IndexUpdate merge to reduce querydb import time 2017-04-16 01:31:28 -07:00
Jacob Dufault
4dcffeb3f3 Use type safe google::dense_hash_map instantiations 2017-04-14 22:55:01 -07:00
Jacob Dufault
5109d27b87 Tons of renames (generally, Queryable -> Query, QueryableTypeDef -> QueryType, QueryableFuncDef -> QueryFunc, QueryableVarDef -> QueryVar) 2017-04-14 22:41:35 -07:00
Jacob Dufault
4135186ae2 Optimize MergeableUpdate so we don't do usr->id lookups when importing on querydb thread 2017-04-14 22:24:49 -07:00
Jacob Dufault
f4e16067b7 Rename qualified_name to detailed_name. 2017-04-14 21:58:07 -07:00
Jacob Dufault
07c984d6c7 - Add type information to qualified_name, remove hover.
- Allow tests to automatically update their expecatations
2017-04-14 21:53:10 -07:00
Jacob Dufault
4f770befee Support textDocument/hover (ie, hover over symbol to see type) 2017-04-13 22:18:02 -07:00
Jacob Dufault
fe0b5cb79c Cleanup / simplify the querydb import code a little 2017-04-13 19:17:15 -07:00
Jacob Dufault
103b2dac95 Fix querydb import overriding good data with bad 2017-04-13 01:31:25 -07:00
Jacob Dufault
151505dadf Add TODO to investigate index or import issue 2017-04-13 01:21:24 -07:00
Jacob Dufault
d6123bd861 Every function usage is now considered a call of that function.
This means we will now report function calls that happen in the global scope (previously, those would only show up for find all refs).
2017-04-13 00:47:47 -07:00
Jacob Dufault
7a429ed3e6 Fix global symbol search (was searching usr, should search qualified name) 2017-04-12 23:02:01 -07:00