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

LSP: Don't recompile workspace when moving between files #5032

Merged
merged 6 commits into from
Aug 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions sway-lsp/src/handlers/notification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@ pub async fn handle_did_open_text_document(
.sessions
.uri_and_session_from_workspace(&params.text_document.uri)?;
session.handle_open_file(&uri);
state
.parse_project(uri, params.text_document.uri, session.clone())
.await;
// If the token map is empty, then we need to parse the project.
// Otherwise, don't recompile the project when a new file in the project is opened
// as the workspace is already compiled.
if session.token_map().is_empty() {
state
.parse_project(uri, params.text_document.uri, session.clone())
.await;
}
Ok(())
}

Expand Down
Loading