diff --git a/extensions/vscode-colorize-tests/src/colorizerTestMain.ts b/extensions/vscode-colorize-tests/src/colorizerTestMain.ts index 7f30a330ffb..9586fc0bb97 100644 --- a/extensions/vscode-colorize-tests/src/colorizerTestMain.ts +++ b/extensions/vscode-colorize-tests/src/colorizerTestMain.ts @@ -8,11 +8,13 @@ import * as jsoncParser from 'jsonc-parser'; export function activate(context: vscode.ExtensionContext): any { - const tokenTypes = ['type', 'struct', 'class', 'interface', 'enum', 'parameterType', 'function', 'variable']; - const tokenModifiers = ['static', 'abstract', 'deprecated', 'declaration', 'documentation', 'member', 'async']; + const tokenTypes = ['type', 'struct', 'class', 'interface', 'enum', 'parameterType', 'function', 'variable', 'testToken']; + const tokenModifiers = ['static', 'abstract', 'deprecated', 'declaration', 'documentation', 'member', 'async', 'testModifier']; const legend = new vscode.SemanticTokensLegend(tokenTypes, tokenModifiers); + const outputChannel = vscode.window.createOutputChannel('Semantic Tokens Test'); + const semanticHighlightProvider: vscode.SemanticTokensProvider = { provideSemanticTokens(document: vscode.TextDocument): vscode.ProviderResult { const builder = new vscode.SemanticTokensBuilder(); @@ -35,8 +37,13 @@ export function activate(context: vscode.ExtensionContext): any { builder.push(startLine, startCharacter, length, tokenType, tokenModifiers); + + const selectedModifiers = legend.tokenModifiers.filter((_val, bit) => tokenModifiers & (1 << bit)).join(' '); + outputChannel.appendLine(`line: ${startLine}, character: ${startCharacter}, length ${length}, ${legend.tokenTypes[tokenType]} (${tokenType}), ${selectedModifiers} ${tokenModifiers.toString(2)}`); } + outputChannel.appendLine('---'); + const visitor: jsoncParser.JSONVisitor = { onObjectProperty: (property: string, _offset: number, _length: number, startLine: number, startCharacter: number) => { addToken(property, startLine, startCharacter, property.length + 2); diff --git a/extensions/vscode-colorize-tests/test/semantic-test/.vscode/settings.json b/extensions/vscode-colorize-tests/test/semantic-test/.vscode/settings.json new file mode 100644 index 00000000000..c91ebc862e9 --- /dev/null +++ b/extensions/vscode-colorize-tests/test/semantic-test/.vscode/settings.json @@ -0,0 +1,13 @@ +{ + "editor.tokenColorCustomizationsExperimental": { + "class": "#00b0b0", + "interface": "#845faf", + "function": "#ff00ff", + "*.declaration": { + "fontStyle": "underline" + }, + "*.declaration.member": { + "fontStyle": "italic bold", + } + } +} \ No newline at end of file diff --git a/extensions/vscode-colorize-tests/test/semantic-test/semantic-test.json b/extensions/vscode-colorize-tests/test/semantic-test/semantic-test.json new file mode 100644 index 00000000000..b250b5d2bc1 --- /dev/null +++ b/extensions/vscode-colorize-tests/test/semantic-test/semantic-test.json @@ -0,0 +1,9 @@ +[ + "class", "function.member.declaration", + "parameterType.declaration", "type", "parameterType.declaration", "type", + "variable.declaration", "parameterNames", + "function.member.declaration", + "interface.declaration", + "function.member.declaration", "testToken.testModifier" + +]