From 8581bbfcad409f23fadfdca9d05daf96ebe91b55 Mon Sep 17 00:00:00 2001 From: he1pa <18012015693@163.com> Date: Fri, 6 Sep 2024 15:56:04 +0800 Subject: [PATCH] update with lsp ast cache Signed-off-by: he1pa <18012015693@163.com> --- kclvm/parser/src/lib.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kclvm/parser/src/lib.rs b/kclvm/parser/src/lib.rs index 73c755fb7..8cec78cc5 100644 --- a/kclvm/parser/src/lib.rs +++ b/kclvm/parser/src/lib.rs @@ -302,6 +302,7 @@ pub type KCLModuleCache = Arc>; #[derive(Default, Debug)] pub struct ModuleCache { pub ast_cache: IndexMap, + pub asts: ASTCache, /// Invalid modules and new code, equivalent to paths and k_code_list. The difference is that paths is in the main package. pub invalidate_module: HashMap>, } @@ -341,7 +342,11 @@ impl Loader { fn _load_main(&mut self) -> Result { // for test: - // let asts = ASTCache::default(); + + // let asts = match &self.module_cache { + // Some(c) => c.read().unwrap().asts.clone(), + // None => ASTCache::default(), + // }; // return parse_kcl_program( // self.sess.clone(), // self.paths.clone(),