update semantic token sample

This commit is contained in:
Martin Aeschlimann
2020-01-17 16:41:22 +01:00
parent 8e2f08086b
commit 5ae1f77871
5 changed files with 9 additions and 6 deletions

View File

@ -10,7 +10,8 @@
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
"--extensionDevelopmentPath=${workspaceFolder}",
"${workspaceFolder}/sample",
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"

View File

@ -2,6 +2,8 @@
This is an extension sample showing a very simple semantic tokens provider. This semantic tokens provider always returns all the tokens in a file.
For more background on semantic highlighting read [here](https://github.com/microsoft/vscode/wiki/Semantic-Highlighting-Overview)
![Screenshot](demo.png)
## How to run

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 80 KiB

View File

@ -1,7 +1,7 @@
Available token types:
[comment] [string] [keyword] [number] [regexp] [operator] [namespace]
[type] [struct] [class] [interface] [enum] [parameterType] [function]
[macro] [variable] [constant] [parameter] [property] [label]
[type] [struct] [class] [interface] [enum] [typeParameter] [function]
[member] [macro] [variable] [parameter] [property] [label]
Available token modifiers:
[type.declaration] [type.documentation] [type.member] [type.static]

View File

@ -6,13 +6,13 @@ const tokenModifiers = new Map<string, number>();
const legend = (function () {
const tokenTypesLegend = [
'comment', 'string', 'keyword', 'number', 'regexp', 'operator', 'namespace',
'type', 'struct', 'class', 'interface', 'enum', 'parameterType', 'function',
'macro', 'variable', 'constant', 'parameter', 'property', 'label'
'type', 'struct', 'class', 'interface', 'enum', 'typeParameter', 'function',
'member', 'macro', 'variable', 'parameter', 'property', 'label'
];
tokenTypesLegend.forEach((tokenType, index) => tokenTypes.set(tokenType, index));
const tokenModifiersLegend = [
'declaration', 'documentation', 'member', 'static', 'abstract', 'deprecated',
'declaration', 'documentation', 'readonly', 'static', 'abstract', 'deprecated',
'modification', 'async'
];
tokenModifiersLegend.forEach((tokenModifier, index) => tokenModifiers.set(tokenModifier, index));