Commit Graph

143 Commits

Author SHA1 Message Date
Fangrui Song
0016d214c3 Convert copy constructor to move constructors piecemeal
If I replace all the important constructors used in query.cc, there will be a weird issue that strings following "Applying index update for " are empty.
2018-02-06 20:54:17 -08:00
Fangrui Song
1a82f1f113 We may should represent Query{Func,Type,Var} as a bag of definitions and references 2018-02-05 10:16:43 -08:00
Fangrui Song
3839d1e5ab Decouple QueryDb_ImportMain 2018-02-04 21:22:21 -08:00
Fangrui Song
985dec101d Generation 2018-02-03 19:51:30 -08:00
Fangrui Song
0a721ff247 Simplify query.h 2018-02-03 18:16:30 -08:00
Fangrui Song
e5128d3db9 Wrap Query* references with WithGen 2018-02-03 17:44:20 -08:00
Fangrui Song
3d6d000297 Add Generation gen; to Query{Func,Type,Var} and corresponding ToQueryLocation 2018-02-03 14:52:26 -08:00
Fangrui Song
6933870962 Change symbol id from size_t to RawId (uint32_t currently) 2018-02-03 10:35:17 -08:00
Fangrui Song
e42f6b6191 optional<...> GetQuery*IdFromUsr -> Maybe 2018-02-01 23:17:34 -08:00
Fangrui Song
ae999f9c92 size_t Query*::symbol_idx -> Maybe<Id<void>> 2018-02-01 22:52:03 -08:00
Fangrui Song
392cd79d04 Add Maybe<T> and change definition_{spelling,extent} from optional to Maybe
sizeof(db->funcs[0].def) decreases from 248 to 232
sizeof(db->types[0].def) decreases from 272 to 256
sizeof(db->vars[0].def) decreases from 184 to 168
2018-02-01 21:39:23 -08:00
Fangrui Song
ce6f1c7294 QueryDatabase::{detailed_names,short_names} -> GetSymbol{DetailedName,ShortName} 2018-02-01 18:15:22 -08:00
Fangrui Song
2fb85732c0 Add RemoveSymbol 2018-02-01 17:25:06 -08:00
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