Commit Graph

327 Commits

Author SHA1 Message Date
Fangrui Song
23c9c3a061 $ccls/memberHierarchy: add field offset 2018-05-28 21:24:42 -07:00
Fangrui Song
c9f0b65062 Simplify pipeline 2018-05-28 16:13:44 -07:00
Fangrui Song
0ba8f2a42c Remove atomic_object.h and add workspace/didChangeConfiguration placeholder 2018-03-01 18:15:33 -08:00
Fangrui Song
1cc5b85ef4 Fix -Wunused-variable when CINDEX_VERSION >= 47 2018-02-28 08:35:06 -08:00
Fangrui Song
214eded2cb Support listing local variables in memberHierarchy and better handling of locations for typedef; remove cquery_call_tree.cc 2018-02-26 21:32:58 -08:00
Fangrui Song
09dd20226f Rename FuncDefDefinitionData::locals to vars, remove constants from EnumDecl's vars 2018-02-26 17:53:37 -08:00
Fangrui Song
7743480b13 Use clang_getTypedefDeclUnderlyingType and expand alias_of in memberHierarchy 2018-02-26 00:31:16 -08:00
Fangrui Song
95797be730 Rename *DefDefinitionData::{base,parents} to bases and add inheritanceHierarchy{Initial,Expand} 2018-02-25 18:52:30 -08:00
Fangrui Song
dc18f04759 Strip scope qualifiers of detailed_name in $cquery/memberHierarchy{Initial,Expand} 2018-02-25 17:03:24 -08:00
Fangrui Song
b98c9a4575 Remove UniqueAdd* and uniquify uses after libclang callbacks.
This removes some duplication in `uses`.
2018-02-23 15:08:19 -08:00
Nathan Ridge
9f4b30ca8c Fix semantic highlighting regressions from switch from ClangSymbolKind to lsSymbolKind (fixes #469) 2018-02-22 16:11:35 -08:00
Fangrui Song
61b5ef4fa0 Reduce <iostream>; don't include rapidjson in language_server_api.h; add role to lsReferenceContext 2018-02-22 14:39:46 -08:00
Jacob Dufault
01fe19f280 Format code 2018-02-21 23:34:32 -08:00
Fangrui Song
702cdbe9bb Group initialization options and rename $cquery/typeHierarchyTree to $cquery/inheritanceHierarchy 2018-02-21 21:57:15 -08:00
Fangrui Song
1a4da727da Index namespace alias and MSVC __interface; add --enable-assert to waf; add lexical container to xref requests 2018-02-20 22:13:58 -08:00
Fangrui Song
909c2e247a Simplify query_utils 2018-02-20 18:30:58 -08:00
Fangrui Song
40ab5900de Add TypeDefDefinitionData::declarations
Constructors and destructors are also included in declarations. But this is not necessarily bad, as textDocument/definition on class spelling names can jump to constructors as well as declarations.
2018-02-20 14:52:32 -08:00
Fangrui Song
f9d7361953 Add Config::compilationDatabaseCommand
If specified, this is an external command that provides the JSON compilation database, instead of compile_commands.json
2018-02-19 16:20:02 -08:00
Fangrui Song
488f6cc962 Add lsSymbolKind::StaticMethod (extension) and set parentKind 2018-02-18 19:01:22 -08:00
Fangrui Song
9217393a78 Add semantic highlighting test file
Don't mark destructors as type references.
2018-02-18 14:50:11 -08:00
Fangrui Song
58d6547411 Remove ClangSymbolKind in favor of lsSymbolKind 2018-02-18 11:43:28 -08:00
Fangrui Song
f3134d564c Simplify Index* Query* 2018-02-18 10:43:27 -08:00
Fangrui Song
afe86ef146 Use def.spell for semantic parent and def.extent for lexical parent
Use language identifier in the spec

Remove unreliable Boltzmann distribution
2018-02-14 21:54:57 -08:00
Fangrui Song
0c4d82667f Clean up some -Wcovered-switch-default default labels 2018-02-13 13:03:31 -08:00
Fangrui Song
10437aa642 Disable variable PrettyPrint #if CINDEX_VERSION >= 47 and allow trunk libclang in tests 2018-02-12 19:15:39 -08:00
Fangrui Song
de1e350c59 Role : uint8_t -> uint16_t; Add Read,Write to Role (#if CINDEX_VERSION >= 48)
Fix textDocument/documentSymbol
2018-02-12 10:15:43 -08:00
Fangrui Song
afd38cbce9 Add Id<QueryFile> file; to Use and simplify query.cc 2018-02-11 20:43:54 -08:00
Fangrui Song
aee79b3617 variable_type -> type; remove parent_{id,kind} (they should be inferred from Def::spell; clean up SymbolIdx, Reference, SymbolRef 2018-02-11 10:28:26 -08:00
Fangrui Song
8ab45cb43d std::string {hover,comments} -> NTString (null-terminated string)
Typically, sizeof(std::string) = 32, sizeof(NTString) = 8
hover and comments are usually empty and thus wasteful to spend 24*2 bytes for them
2018-02-10 22:53:35 -08:00
Fangrui Song
e019968f51 Add lexical parent to Func 2018-02-10 20:30:27 -08:00
Fangrui Song
9a6cbafa04 Add lexical parent to Type/Var and definition_spelling->spell, definition_extent->extent 2018-02-10 20:23:46 -08:00
Fangrui Song
3ba9209eea Add config->extension.referenceContainer 2018-02-10 18:34:34 -08:00
Fangrui Song
420e84329b Derive SymbolRef,Use from Reference and add lexical container to func/var/type uses 2018-02-10 17:33:56 -08:00
Fangrui Song
749ecf0faa Add {Index,Query}Family to simplify template parameters 2018-02-10 00:06:45 -08:00
Fangrui Song
c4bd7ef44b Rename Reference members 2018-02-09 14:12:35 -08:00
Fangrui Song
4bfb5a3586 struct IndexFuncRef : Reference {}; 2018-02-08 22:06:09 -08:00
Fangrui Song
2d255da07b {Index,Query}Type::uses: Range/QueryLocation -> Reference
And add serialization for Reference
2018-02-08 18:26:09 -08:00
Fangrui Song
48a6f836ca Fix SymbolRole serialization and make it hashable 2018-02-08 12:24:48 -08:00
Fangrui Song
dbdab02ff4 Change is_implicit to role in {Index,Query}FuncRef
Add `FileId file` to *DefDefinitionData::Def
2018-02-07 23:27:35 -08:00
Fangrui Song
e76a336f19 Remove --debug in favor of LIBCLANG_DISABLE_CRASH_RECOVERY=1
ci/before_deploy.sh: Use the latest libclang.so
2018-02-07 00:00:04 -08:00
Fangrui Song
a8fb2264a9 Reflect IndexFuncRef 2018-02-04 17:49:00 -08:00
Fangrui Song
217d238c78 Use clang_getCursorPrettyPrinted if CINDEX_VERSION >= 47
Closes #366
2018-02-04 15:23:23 -08:00
Fangrui Song
e5128d3db9 Wrap Query* references with WithGen 2018-02-03 17:44:20 -08:00
Fangrui Song
6933870962 Change symbol id from size_t to RawId (uint32_t currently) 2018-02-03 10:35:17 -08:00
Nathan Ridge
74f9be1d6f Use symbol kind 'Parameter' for template parameters
Clients can distinguish between function and template parameters based
on storage class.
2018-02-01 20:07:11 -08:00
Fangrui Song
0d715e7bcf Handle int8_t int16_t uint8_t uint16_t enum constants
Clean up clang_complete
2018-02-01 12:21:58 -08:00
Jacob Dufault
c98d53cfe2 Indexer now has access to |config| 2018-01-31 21:48:49 -08:00
Fangrui Song
e259bb91d3 Use string_view for lsSymbolInformation 2018-01-31 21:40:40 -08:00
Fangrui Song
6d6c1639d0 Type-dependent member access expressions 2018-01-31 21:23:00 -08:00
Fangrui Song
768f4ecb6e Enable "Make" hack only if config->index.make_unique is true. 2018-01-31 11:10:20 -08:00
Fangrui Song
4c895bef0b Make optional<string> {hover,comments} non-optional 2018-01-30 23:48:34 -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
a392301be3 Format 2018-01-29 16:27:43 -08:00
Fangrui Song
b7ce3dd60a Better template specialization 2018-01-28 23:05:51 -08:00
Fangrui Song
dc1c72ce30 Remove definition from uses for TemplateVisitor 2018-01-28 22:41:53 -08:00
Fangrui Song
777193d02f Better template specialization 2018-01-28 18:31:11 -08:00
Fangrui Song
bdb880e0a5 Serialize VarDefDefinitionData::{parent_kind,parent_id} 2018-01-28 12:34:31 -08:00
Fangrui Song
79b60561d1 Remove CXCursor_MacroDefinition from uses 2018-01-28 11:42:40 -08:00
Fangrui Song
70bbe6c64c Use major/minor versions for IndexFile
Fixes #364
2018-01-27 21:47:37 -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
aeb63ce3ad Add magic/version to "cacheFormat": "msgpack" 2018-01-27 19:21:35 -08:00
Jacob Dufault
e3d3a492d0 Return default value 2018-01-27 10:20:54 -08:00
Phil Wise
74a39e7ea8 Fix build on Ubuntu 16.04
On Ubuntu 16.04 I get the following compile error in release mode:

../../src/indexer.cc: In function ‘ClangStorageClass {anonymous}::GetStorageClass(CX_StorageClass)’:
../../src/indexer.cc:130:1: error: control reaches end of non-void function [-Werror=return-type]

cc1plus: all warnings being treated as errors
2018-01-27 09:03:08 -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
6b3673a438 Remove definition_spelling from uses in IndexVar
Instead, specify `include_decl = true` in GetUsesOfSymbol
2018-01-26 18:01:14 -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
50c6ed1dd3 Clean up SetTypeName 2018-01-25 22:25:19 -08:00
Fangrui Song
63b793619d Set names in ResolveToDeclarationType and type declarations. 2018-01-25 21:38:39 -08:00
Fangrui Song
7aea052f09 Re-pick "Handle template <class T> class A" but does not assign names to templates without body 2018-01-25 12:35:59 -08:00
Jacob Dufault
7f9f6e0c6b Revert "Handle template <class T> class A; and attribute variable uses to specialized template if exists"
This reverts commit 8da62430e575022e206b66bad58b376002422f32.
2018-01-25 11:46:03 -08:00
Fangrui Song
684ad961ad Handle template <class T> class A; and attribute variable uses to specialized template if exists 2018-01-25 01:13:07 -08:00
Fangrui Song
403c892838 --debug disables libclang crash recovery 2018-01-25 00:01:30 -08:00
Fangrui Song
db1f707027 Add --debug to disable libclang crash recovery
We can add more debug facility later.
2018-01-24 23:32:42 -08:00
Fangrui Song
706a3d0017 Attribute enum to its underlying type's uses 2018-01-24 21:55:59 -08:00
Fangrui Song
c4e8db2964 Index namespaces as Type 2018-01-24 00:57:50 -08:00
Fangrui Song
b4e1e4fd3a Remove enableComments, make index.comments default to 2, and index builtin types 2018-01-23 22:56:13 -08:00
Fangrui Song
bc28bfef45 Cleanup 2018-01-20 22:55:29 -08:00
Fangrui Song
6acea187c7 Add initialization option index.builtin_types for indexing builtin types
Also deprecate enableComments in favor of index.comments

Make $cquery/vars work on variables (by obtaining their types first).
This is currently the only way to list instances of builtin types.
2018-01-20 22:46:03 -08:00
Fangrui Song
b5c9e22ad1 Explicitly use std::move to make clang 3.5 compile 2018-01-20 19:19:24 -08:00
Fangrui Song
a57798154d Explicitly use std::move to make clang 3.5 compile 2018-01-20 17:59:43 -08:00
scturtle
b8a3e089ce Response on index error. (#319) 2018-01-19 23:56:49 -08:00
Chao Shen
405fd56781 Crash Hotfix. 2018-01-18 08:24:10 -08:00
Chao Shen
3132572e72 Don't give up index files of headers if the .cc/.cpp file failed. 2018-01-17 21:24:32 -08:00
Fangrui Song
ca3784db03 Don't index initializer for lambda types 2018-01-17 21:02:09 -08:00
Fangrui Song
b5761b5980 Fix textDocument/definition on #include lines 2018-01-17 12:52:37 -08:00
Fangrui Song
6746883a3b Better inside-out syntax recognizer 2018-01-17 00:29:32 -08:00
Fangrui Song
dd84a85b75 Filter out inside-out syntax and array types for variable hover 2018-01-17 00:17:04 -08:00
Fangrui Song
bf9150f58a Index variable initializer 2018-01-16 20:30:45 -08:00
Fangrui Song
a52d4ac61d Show enum constants as Foo::A = 0 2018-01-16 20:01:47 -08:00
Fangrui Song
7d7e238924 enum 2018-01-16 19:09:29 -08:00
Fangrui Song
0b3ab23b25 For const qualified types, index qualified names along with initializers 2018-01-16 18:26:11 -08:00
Fangrui Song
1388e5190d Fix gcc compile error. #297 2018-01-15 08:58:08 -08:00
Jacob Dufault
e20a6e9790 Add siphash.h, HashUSR -> HashUsr 2018-01-14 13:18:12 -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