diff --git a/kclvm/tools/src/LSP/src/test_data/completion_test/import/external/external_0/kcl.mod b/kclvm/tools/src/LSP/src/test_data/completion_test/import/external/external_0/kcl.mod index 4ae72f07f..8ea06569b 100644 --- a/kclvm/tools/src/LSP/src/test_data/completion_test/import/external/external_0/kcl.mod +++ b/kclvm/tools/src/LSP/src/test_data/completion_test/import/external/external_0/kcl.mod @@ -2,3 +2,4 @@ [dependencies] k8s = { oci = "oci://ghcr.io/kcl-lang/k8s", tag = "1.28" } + diff --git a/kclvm/tools/src/LSP/src/test_data/goto_import_def_test/kcl.mod b/kclvm/tools/src/LSP/src/test_data/goto_import_def_test/kcl.mod index 7afba4cdb..05c442f22 100644 --- a/kclvm/tools/src/LSP/src/test_data/goto_import_def_test/kcl.mod +++ b/kclvm/tools/src/LSP/src/test_data/goto_import_def_test/kcl.mod @@ -5,3 +5,4 @@ version = "0.0.4" [dependencies] konfig = { git = "https://github.com/awesome-kusion/konfig.git", tag = "v0.0.1" } + diff --git a/kclvm/tools/src/LSP/src/tests.rs b/kclvm/tools/src/LSP/src/tests.rs index e4dae0a2e..64a5a1289 100644 --- a/kclvm/tools/src/LSP/src/tests.rs +++ b/kclvm/tools/src/LSP/src/tests.rs @@ -2,6 +2,7 @@ use crossbeam_channel::after; use crossbeam_channel::select; use indexmap::IndexSet; use kclvm_ast::MAIN_PKG; +use kclvm_driver::lookup_compile_workspace; use kclvm_driver::toolchain; use kclvm_driver::toolchain::Metadata; use kclvm_driver::WorkSpaceKind; @@ -78,7 +79,6 @@ use crate::app::main_loop; use crate::compile::Params; use crate::goto_def::goto_def; use crate::hover::hover; -use crate::state::KCLEntryCache; use crate::state::KCLGlobalStateCache; use crate::state::KCLVfs; use crate::to_lsp::kcl_diag_to_lsp_diags_by_file; @@ -155,7 +155,7 @@ pub(crate) fn compile_test_file_and_metadata( let file = test_file.to_str().unwrap().to_string(); - let entry_cache = KCLEntryCache::default(); + let metadata = lookup_compile_workspace(&toolchain::default(), &file, true).2; let (diags, compile_res) = compile_with_params(Params { file: Some(file.clone()), module_cache: Some(KCLModuleCache::default()), @@ -165,11 +165,6 @@ pub(crate) fn compile_test_file_and_metadata( }); let (program, gs) = compile_res.unwrap(); - let metadata = entry_cache - .read() - .get(&file) - .and_then(|metadata| metadata.0 .2.clone()); - (file, program, diags, gs, metadata) }