Skip to content

Commit

Permalink
Merge branch 'master' into alfie/move-crates-and-version-bump-simple
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaBatty authored Sep 21, 2024
2 parents 522cbfa + 3a6e937 commit f9e3243
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
13 changes: 12 additions & 1 deletion sway-lsp/src/core/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,18 @@ pub fn parse_project(

if let Some(typed) = &session.compiled_program.read().typed {
session.runnables.clear();
create_runnables(&session.runnables, typed, engines.de(), engines.se());
let path = uri.to_file_path().unwrap();
let program_id = program_id_from_path(&path, engines)?;
if let Some(metrics) = session.metrics.get(&program_id) {
// Check if the cached AST was returned by the compiler for the users workspace.
// If it was, then we need to use the original engines.
let engines = if metrics.reused_programs > 0 {
&*session.engines.read()
} else {
engines
};
create_runnables(&session.runnables, typed, engines.de(), engines.se());
}
}
Ok(())
}
Expand Down
3 changes: 2 additions & 1 deletion sway-lsp/src/handlers/notification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ pub async fn handle_did_change_text_document(
session.clone(),
&uri,
Some(params.text_document.version),
true,
// TODO: Set this back to true once https://github.com/FuelLabs/sway/issues/6576 is fixed.
false,
file_versions,
);
Ok(())
Expand Down

0 comments on commit f9e3243

Please sign in to comment.