Skip to content

Commit

Permalink
update semantic token sample
Browse files Browse the repository at this point in the history
  • Loading branch information
aeschli committed Jan 17, 2020
1 parent 8e2f080 commit 5ae1f77
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion semantic-tokens-sample/.vscode/launch.json
Expand Up @@ -10,7 +10,8 @@
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
"--extensionDevelopmentPath=${workspaceFolder}",
"${workspaceFolder}/sample",
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
Expand Down
2 changes: 2 additions & 0 deletions semantic-tokens-sample/README.md
Expand Up @@ -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
Expand Down
Binary file modified semantic-tokens-sample/demo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions semantic-tokens-sample/sample/sample.semanticLanguage
@@ -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]
Expand Down
6 changes: 3 additions & 3 deletions semantic-tokens-sample/src/extension.ts
Expand Up @@ -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));
Expand Down

0 comments on commit 5ae1f77

Please sign in to comment.