Skip to content

Extensions - Language Features: Implement semantic highlighting #3370

@bryphe

Description

@bryphe

The extension host provides some APIs for semantic highlighting:

	$registerDocumentSemanticTokensProvider(handle: number, selector: IDocumentFilterDto[], legend: modes.SemanticTokensLegend, eventHandle: number | undefined): void;
	$emitDocumentSemanticTokensEvent(eventHandle: number): void;
	$registerDocumentRangeSemanticTokensProvider(handle: number, selector: IDocumentFilterDto[], legend: modes.SemanticTokensLegend): void;

https://github.com/onivim/vscode-exthost/blob/0d6b39803352369daaa97a444ff76352d8452be2/src/vs/workbench/api/common/extHost.protocol.ts#L400

and

	$provideDocumentSemanticTokens(handle: number, resource: UriComponents, previousResultId: number, token: CancellationToken): Promise<VSBuffer | null>;
	$releaseDocumentSemanticTokens(handle: number, semanticColoringResultId: number): void;
	$provideDocumentRangeSemanticTokens(handle: number, resource: UriComponents, range: IRange, token: CancellationToken): Promise<VSBuffer | null>;

https://github.com/onivim/vscode-exthost/blob/0d6b39803352369daaa97a444ff76352d8452be2/src/vs/workbench/api/common/extHost.protocol.ts#L1508

We need to wire these APIs up, and integrate them into our language feature / syntax highlighting pipeline, to support languages that use these rich semantic highlights.

Some extensions to test with semantic token support:

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-extensionArea: Extension/plugin integration, vscode or VimLA-language-supportArea: Language support, syntax highlighting, language server etc.A-syntax-highlightingArea: Syntax HighlightingenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions