$ gnpm install typescript-vscode-sh-plugin
A TypeScript plugin that replaces getEncodedSemanticClassifications and getEncodedSyntacticClassifications to provide more classifications to be used by the new Semantic Highlighting APIs in VS Code.
The purpose of this plugin is to test and enable the new VS Code semantic highlight capabilities.
Once proven, the extended classifications will (hopefully) be adapted by the TypeScript language server and the plugin is no longer needed any more.
The plugin uses new token classifications, consisting of a TokenType and with any number of TokenModifiers.
export const enum TokenType {
	class, enum, interface, namespace, typeParameter, type, parameter, variable, enumMember, property, function, member
}
export const enum TokenModifier {
	declaration, static, async, readonly, local, defaultLibrary
}
The new classifications are retured in place of old the classifications. They are encoded as follows:
TSClassification = ((TokenType + 1) << 8) + TokenModifierSet;
All new classifications have a value >= 0x100 to not overlap with the old classifications. Old classifications are no longer emmitted once the plugin is active.
Examples for each feature can be seen in the test cases. To try them out in VSCode, copy the added snippet to a TypeScript editor and use the Developer: Inspect Editor Tokens and Scopes command to see the semantic token information ar the current cursor location.
declaration when on the identifier of the declaration node  class A { field: number; member(param: number) { let var= param + this.field; } }
defaultLibrary when in an symbol that comes from the default libraries.  Math.max(Number.Nan, parseInt('33'))
readonly when defined as const or readonly  const var;
local when not declared top-level   function global(p: number) { const global; 
async when defined as asyncstatic when defined as static
-variables & properties with constructor signaturesclass   Number.isInteger(1);
function resp member (#89337)   const callback = () => {};
   var fs = require('fs); require.resolve('foo/bar');
typeAlias pas a new token type"editor.semanticHighlighting.enabled": trueDeveloper: Inspect Editor Tokens and Scopes command to inspect the semantic information at a given cursor location.yarn && yarn test in the folder of the cloned repo.Copyright 2013 - present © cnpmjs.org | Home |