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

Disable diagnostics on large files #2483

Merged
merged 1 commit into from
Aug 23, 2024

Conversation

vinistock
Copy link
Member

Motivation

Similar to #2481, this PR disables "external diagnostics" for files with over 100k characters. Diagnostics such as syntax errors (collected by Prism) are still displayed, but linters like RuboCop are not shown.

Diagnostics runs on every keypress and trying to compute it for very large files ends up causing too much lag in the editor. After this PR, working on a ~4k line file is fully responsive, with response times around ~10-50ms.

Implementation

Just changed the message on did open and started returning before running RuboCop in large files.

Automated Tests

We don't have such a large file inside our codebase and we intentionally don't run diagnostics on files that are outside of the workspace, so I couldn't use Prism's node.rb file to write a test. I think this is simple enough that it's okay to skip it.

@vinistock vinistock added enhancement New feature or request server This pull request should be included in the server gem's release notes labels Aug 23, 2024
@vinistock vinistock self-assigned this Aug 23, 2024
@vinistock vinistock requested a review from a team as a code owner August 23, 2024 20:27
@vinistock vinistock requested review from andyw8 and st0012 August 23, 2024 20:27
@vinistock vinistock force-pushed the vs-disable-diagnostics-on-large-files branch from e12db10 to dfe3aca Compare August 23, 2024 20:58
@vinistock vinistock requested a review from st0012 August 23, 2024 20:58
lib/ruby_lsp/utils.rb Outdated Show resolved Hide resolved
lib/ruby_lsp/server.rb Outdated Show resolved Hide resolved
@vinistock vinistock force-pushed the vs-disable-diagnostics-on-large-files branch from dfe3aca to 1e5029c Compare August 23, 2024 21:06
@vinistock vinistock enabled auto-merge (squash) August 23, 2024 21:08
@vinistock vinistock merged commit 84de078 into main Aug 23, 2024
35 checks passed
@vinistock vinistock deleted the vs-disable-diagnostics-on-large-files branch August 23, 2024 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request server This pull request should be included in the server gem's release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants