vscode-semantic-tokens
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

vscode-semantic-tokens

NPM

Small utility to get the semantic tokens of a VS Code document in a more nicer format.

This basically computes the semantic tokens you would get from DocumentSemanticTokensProvider.provideDocumentSemanticTokens method.

Usage

The API is fairly simple. You just need to pass a TextDocument and you will get an array of semantic tokens.

import { getSemanticTokens } from 'vscode-semantic-tokens';

// ...

const tokens = getSemanticTokens(document);

The semantic tokens have the following shape:

export type SemanticToken = {
  text: string;
  line: number;
  startChar: number;
  length: number;
  tokenType: string;
  tokenModifiers: string[];
};

Dependencies (0)

    Dev Dependencies (7)

    Package Sidebar

    Install

    npm i vscode-semantic-tokens

    Weekly Downloads

    71

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    7.86 kB

    Total Files

    7

    Last publish

    Collaborators

    • robertohuertasm