Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hook up Typescript Lang Features to new multi-doc highlight api #198469

Closed
Yoyokrazy opened this issue Nov 16, 2023 · 0 comments · Fixed by #198467
Closed

Hook up Typescript Lang Features to new multi-doc highlight api #198469

Yoyokrazy opened this issue Nov 16, 2023 · 0 comments · Fixed by #198467
Assignees
Labels
editor-highlight Editor selection/word highlight issues insiders-released Patch has been released in VS Code Insiders on-testplan
Milestone

Comments

@Yoyokrazy
Copy link
Contributor

Yoyokrazy commented Nov 16, 2023

Looking at the Typescript word highlighter, it looks like typescript already supports multi-document semantic highlighting. Using the parameter on L29 in the below snippet, more files can likely be passed in via the extHost and semantic highlight should work for multiple files out of the box.

public async provideDocumentHighlights(
document: vscode.TextDocument,
position: vscode.Position,
token: vscode.CancellationToken
): Promise<vscode.DocumentHighlight[]> {
const file = this.client.toOpenTsFilePath(document);
if (!file) {
return [];
}
const args = {
...typeConverters.Position.toFileLocationRequestArgs(file, position),
filesToSearch: [file]
};
const response = await this.client.execute('documentHighlights', args, token);
if (response.type !== 'response' || !response.body) {
return [];
}
return response.body.flatMap(convertDocumentHighlight);
}
}

@Yoyokrazy Yoyokrazy added the editor-highlight Editor selection/word highlight issues label Nov 16, 2023
@Yoyokrazy Yoyokrazy added this to the November 2023 milestone Nov 16, 2023
@Yoyokrazy Yoyokrazy self-assigned this Nov 16, 2023
@vscodenpa vscodenpa added unreleased Patch has not yet been released in VS Code Insiders insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Nov 22, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Jan 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
editor-highlight Editor selection/word highlight issues insiders-released Patch has been released in VS Code Insiders on-testplan
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants