Skip to content

Commit 6e4c2e1

Browse files
HighCommander4jacobdufault
authored andcommitted
Apply semantic highlighting for template parameters
1 parent cafca6a commit 6e4c2e1

File tree

2 files changed

+48
-2
lines changed

2 files changed

+48
-2
lines changed

package.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,11 @@
241241
"default": false,
242242
"description": "If semantic highlighting for parameters is enabled/disabled."
243243
},
244+
"cquery.highlighting.enabled.templateParameters": {
245+
"type": "boolean",
246+
"default": false,
247+
"description": "If semantic highlighting for template parameters is enabled/disabled."
248+
},
244249
"cquery.highlighting.enabled.staticMemberVariables": {
245250
"type": "boolean",
246251
"default": false,
@@ -438,6 +443,22 @@
438443
],
439444
"description": "Colors to use for semantic highlighting. A good generator is http://tools.medialab.sciences-po.fr/iwanthue/. If multiple colors are specified, semantic highlighting will cycle through them for successive symbols."
440445
},
446+
"cquery.highlighting.colors.templateParameters": {
447+
"type": "array",
448+
"default": [
449+
"#e1afc3",
450+
"#d533bb",
451+
"#9b677f",
452+
"#e350b6",
453+
"#a04360",
454+
"#dd82bc",
455+
"#de3864",
456+
"#ad3f87",
457+
"#dd7a90",
458+
"#e0438a"
459+
],
460+
"description": "Colors to use for semantic highlighting. A good generator is http://tools.medialab.sciences-po.fr/iwanthue/. If multiple colors are specified, semantic highlighting will cycle through them for successive symbols."
461+
},
441462
"cquery.highlighting.colors.staticMemberVariables": {
442463
"type": "array",
443464
"default": [
@@ -502,6 +523,10 @@
502523
"type": "boolean",
503524
"default": false
504525
},
526+
"cquery.highlighting.underline.templateParameters": {
527+
"type": "boolean",
528+
"default": false
529+
},
505530
"cquery.highlighting.underline.staticMemberVariables": {
506531
"type": "boolean",
507532
"default": true
@@ -554,6 +579,10 @@
554579
"type": "boolean",
555580
"default": true
556581
},
582+
"cquery.highlighting.italic.templateParameters": {
583+
"type": "boolean",
584+
"default": false
585+
},
557586
"cquery.highlighting.italic.staticMemberVariables": {
558587
"type": "boolean",
559588
"default": false
@@ -606,6 +635,10 @@
606635
"type": "boolean",
607636
"default": false
608637
},
638+
"cquery.highlighting.bold.templateParameters": {
639+
"type": "boolean",
640+
"default": true
641+
},
609642
"cquery.highlighting.bold.staticMemberVariables": {
610643
"type": "boolean",
611644
"default": false

src/extension.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,20 @@ enum SemanticSymbolKind {
5959
Parameter = 25,
6060
Using,
6161
}
62+
enum StorageClass {
63+
Invalid,
64+
None,
65+
Extern,
66+
Static,
67+
PrivateExtern,
68+
Auto,
69+
Register
70+
}
6271
class SemanticSymbol {
6372
constructor(
6473
readonly stableId: number, readonly kind: SemanticSymbolKind,
65-
readonly isTypeMember: boolean, readonly ranges: Array<Range>) {}
74+
readonly isTypeMember: boolean, readonly storage: StorageClass,
75+
readonly ranges: Array<Range>) {}
6676
}
6777

6878
function getClientConfig(context: ExtensionContext) {
@@ -658,7 +668,7 @@ export function activate(context: ExtensionContext) {
658668
['types', 'freeStandingFunctions', 'memberFunctions',
659669
'freeStandingVariables', 'memberVariables', 'namespaces',
660670
'macros', 'enums', 'typeAliases', 'enumConstants',
661-
'staticMemberFunctions', 'parameters',
671+
'staticMemberFunctions', 'parameters', 'templateParameters',
662672
'staticMemberVariables']) {
663673
semanticDecorations.set(type, makeDecorations(type));
664674
semanticEnabled.set(type, false);
@@ -707,6 +717,9 @@ export function activate(context: ExtensionContext) {
707717
} else if (symbol.kind == SemanticSymbolKind.StaticProperty) {
708718
return get('staticMemberVariables');
709719
} else if (symbol.kind == SemanticSymbolKind.Parameter) {
720+
if (symbol.storage == StorageClass.Invalid) {
721+
return get('templateParameters');
722+
}
710723
return get('parameters');
711724
} else if (symbol.kind == SemanticSymbolKind.EnumConstant) {
712725
return get('enumConstants');

0 commit comments

Comments
 (0)