提交 f1f652cc 编写于 作者: M Martin Aeschlimann

polish html-js sem highlighting

上级 cf0fd9a5
......@@ -55,35 +55,40 @@ export function getSemanticTokens(jsLanguageService: ts.LanguageService, current
return resultTokens;
}
export function getSemanticTokenLegend() {
return { types: tokenTypes, modifiers: tokenModifiers };
enum TokenType {
'class',
'enum',
'interface',
'namespace',
'typeParameter',
'type',
'parameter',
'variable',
'property',
'constant',
'function',
'member',
_sentinel
}
const tokenTypes: string[] = ['class', 'enum', 'interface', 'namespace', 'typeParameter', 'type', 'parameter', 'variable', 'property', 'constant', 'function', 'member'];
const tokenModifiers: string[] = ['declaration', 'static', 'async'];
const enum TokenType {
'class' = 0,
'enum' = 1,
'interface' = 2,
'namespace' = 3,
'typeParameter' = 4,
'type' = 5,
'parameter' = 6,
'variable' = 7,
'property' = 8,
'constant' = 9,
'function' = 10,
'member' = 11
enum TokenModifier {
'declaration',
'static',
'async',
_sentinel
}
const enum TokenModifier {
'declaration' = 0x01,
'static' = 0x02,
'async' = 0x04,
export function getSemanticTokenLegend() {
const tokenTypes = [];
for (let i = 0; i < TokenType._sentinel; i++) {
tokenTypes.push(TokenType[i]);
}
const tokenModifiers = [];
for (let i = 0; i < TokenModifier._sentinel; i++) {
tokenModifiers.push(TokenModifier[i]);
}
return { types: tokenTypes, modifiers: tokenModifiers };
}
const tokenFromDeclarationMapping: { [name: string]: TokenType } = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册