Skip to content

Commit 7379c10

Browse files
HighCommander4jacobdufault
authored andcommitted
Update semantic highlighting code to correspond to recent changes to the server (fixes #15)
1 parent c0f3eb7 commit 7379c10

File tree

1 file changed

+41
-38
lines changed

1 file changed

+41
-38
lines changed

src/extension.ts

Lines changed: 41 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -32,39 +32,45 @@ enum SymbolKind {
3232
Var
3333
}
3434
enum SemanticSymbolKind {
35-
Unknown,
36-
37-
Module = 1,
35+
// lsSymbolKind
36+
Unknown = 0,
37+
File,
38+
Module,
3839
Namespace,
39-
NamespaceAlias,
40-
Macro,
40+
Package,
4141

42-
Enum = 5,
43-
Struct,
44-
Class,
45-
Protocol,
46-
Extension,
47-
Union,
48-
TypeAlias,
42+
Class = 5,
43+
Method,
44+
Property,
45+
Field,
46+
Constructor,
4947

50-
Function = 12,
48+
Enum = 10,
49+
Interface,
50+
Function,
5151
Variable,
52-
Field,
53-
EnumConstant,
52+
Constant,
5453

55-
InstanceMethod = 16,
56-
ClassMethod,
57-
StaticMethod,
58-
InstanceProperty,
59-
ClassProperty,
60-
StaticProperty,
54+
String = 15,
55+
Number,
56+
Boolean,
57+
Array,
58+
Object,
6159

62-
Constructor = 22,
63-
Destructor,
64-
ConversionFunction,
60+
Key = 20,
61+
Null,
62+
EnumMember,
63+
Struct,
64+
Event,
65+
66+
Operator = 25,
67+
TypeParameter,
6568

66-
Parameter = 25,
67-
Using,
69+
// cquery extensions
70+
TypeAlias = 252,
71+
Parameter = 253,
72+
StaticMethod = 254,
73+
Macro = 255
6874
}
6975
enum StorageClass {
7076
Invalid,
@@ -701,19 +707,18 @@ export function activate(context: ExtensionContext) {
701707
};
702708

703709
if (symbol.kind == SemanticSymbolKind.Class ||
704-
symbol.kind == SemanticSymbolKind.Struct ||
705-
symbol.kind == SemanticSymbolKind.Union) {
710+
symbol.kind == SemanticSymbolKind.Struct) {
706711
return get('types');
707712
} else if (symbol.kind == SemanticSymbolKind.Enum) {
708713
return get('enums');
709714
} else if (symbol.kind == SemanticSymbolKind.TypeAlias) {
710715
return get('typeAliases');
716+
} else if (symbol.kind == SemanticSymbolKind.TypeParameter) {
717+
return get('templateParameters');
711718
} else if (symbol.kind == SemanticSymbolKind.Function) {
712719
return get('freeStandingFunctions');
713-
} else if (symbol.kind == SemanticSymbolKind.InstanceMethod ||
714-
symbol.kind == SemanticSymbolKind.Constructor ||
715-
symbol.kind == SemanticSymbolKind.Destructor ||
716-
symbol.kind == SemanticSymbolKind.ConversionFunction) {
720+
} else if (symbol.kind == SemanticSymbolKind.Method ||
721+
symbol.kind == SemanticSymbolKind.Constructor) {
717722
return get('memberFunctions')
718723
} else if (symbol.kind == SemanticSymbolKind.StaticMethod) {
719724
return get('staticMemberFunctions')
@@ -723,15 +728,13 @@ export function activate(context: ExtensionContext) {
723728
}
724729
return get('globalVariables');
725730
} else if (symbol.kind == SemanticSymbolKind.Field) {
731+
if (symbol.storage == StorageClass.Static) {
732+
return get('staticMemberVariables');
733+
}
726734
return get('memberVariables');
727-
} else if (symbol.kind == SemanticSymbolKind.StaticProperty) {
728-
return get('staticMemberVariables');
729735
} else if (symbol.kind == SemanticSymbolKind.Parameter) {
730-
if (symbol.storage == StorageClass.Invalid) {
731-
return get('templateParameters');
732-
}
733736
return get('parameters');
734-
} else if (symbol.kind == SemanticSymbolKind.EnumConstant) {
737+
} else if (symbol.kind == SemanticSymbolKind.EnumMember) {
735738
return get('enumConstants');
736739
} else if (symbol.kind == SemanticSymbolKind.Namespace) {
737740
return get('namespaces');

0 commit comments

Comments
 (0)