Skip to content

Commit 9769c83

Browse files
authored
Merge branch 'master' into josh/inlay_hints_function_params
2 parents bc1f7f9 + 3a6e937 commit 9769c83

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

sway-lsp/src/core/session.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,18 @@ pub fn parse_project(
477477

478478
if let Some(typed) = &session.compiled_program.read().typed {
479479
session.runnables.clear();
480-
create_runnables(&session.runnables, typed, engines.de(), engines.se());
480+
let path = uri.to_file_path().unwrap();
481+
let program_id = program_id_from_path(&path, engines)?;
482+
if let Some(metrics) = session.metrics.get(&program_id) {
483+
// Check if the cached AST was returned by the compiler for the users workspace.
484+
// If it was, then we need to use the original engines.
485+
let engines = if metrics.reused_programs > 0 {
486+
&*session.engines.read()
487+
} else {
488+
engines
489+
};
490+
create_runnables(&session.runnables, typed, engines.de(), engines.se());
491+
}
481492
}
482493
Ok(())
483494
}

sway-lsp/src/handlers/notification.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ pub async fn handle_did_change_text_document(
111111
session.clone(),
112112
&uri,
113113
Some(params.text_document.version),
114-
true,
114+
// TODO: Set this back to true once https://github.com/FuelLabs/sway/issues/6576 is fixed.
115+
false,
115116
file_versions,
116117
);
117118
Ok(())

0 commit comments

Comments
 (0)