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

langserver: Avoid re-processing open files after file saving #1372

Merged
merged 1 commit into from
Sep 1, 2023

Conversation

radeksimko
Copy link
Member

@radeksimko radeksimko commented Sep 1, 2023

Closes #1366

Context

A common use case for workspace/didChangeWatchedFiles is to receive updates about files changed outside of the IDE - such as when the user runs git checkout to switch branches.

The LSP spec isn't 100% clear about whether clients should always send workspace/didChangeWatchedFiles also for open files. A popular language client (VS Code) always does - i.e. we receive both textDocument/didSave on save and then subsequently workspace/didChangeWatchedFiles even if the file content has not changed - only the modification timestamp has.

This leads us to processing the exact same files (content-wise) multiple times in row (1st on textDocument/didChange 2nd and any other time on workspace/didChangeWatchedFiles as followed after textDocument/didSave), in turn wasting resources.

Solution

Reduce the work we do after file saving by assuming that changes have already been processed as part of textDocument/didChange.

@radeksimko radeksimko added enhancement New feature or request performance Gotta go fast labels Sep 1, 2023
@radeksimko radeksimko marked this pull request as ready for review September 1, 2023 10:31
@radeksimko radeksimko requested a review from a team as a code owner September 1, 2023 10:31
Copy link
Member

@dbanck dbanck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@github-actions
Copy link

github-actions bot commented Oct 2, 2023

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request performance Gotta go fast
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Investigate possible reduction on job scheduling on workspace/didChangeWatchedFiles
2 participants