-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
Disable semantic highlighting in large JS/TS files #94321
Comments
We don't have file size as a selector, we have scheme and language, etc. I don't know how to have a provider that registers itself only for files of a certain file size. cc @jrieken if you have any ideas? @aeschli One workaround would be to not make the call to |
Yes my proposal would be to add a document size check to the JS/TS semantic highlighting provider at the very start of if (document.getText().length > 20000) {
return null;
} |
Why is TypeScript not doing that check itself and disabling semantic highlighting on the server side? That way other, better performing extensions aren't hit with arbitrary limits. If the client really needs to, wouldn't it also be better to disable highlighting if it detects that an extension is taking more than x amount of time to complete? |
Because maybe the client isn't an editor and it doesn't matter if the request takes 5 seconds. |
@mattacosta the delay is impacting all VS Code users who edit large JS/TS files (in reality for any language that supports SH and returns a large set of highlights in large documents), but shipping an update to TS Server would only fix the delay for people on newer versions of TS. We'd prefer that all VS Code users not encounter responsiveness delays in large JS/TS files |
@DanielRosenwasser My workaround is to send a "client kind" when initializing, which (for me) is normally used to change some results in "cli" mode, but could also be used to allow long requests. @RyanCavanaugh Fair enough. |
From the discussion in #92789, I think there is no need to change the vscode API, so this can be customized as desired from the TS extension. |
Bug
Semantic highlighting can be slow for large JS/TS files (such as
checker.ts
in the TypeScript project). This can also slow down other operations, such as getting completions.This has been impacting the TypeScript team's work in their codebase
Feature Request
Disable semantic highlighting for any JS/TS files that are larger than 200kb or so.
/cc @RyanCavanaugh @DanielRosenwasser
The text was updated successfully, but these errors were encountered: