Skip to content

Commit

Permalink
fix: fix lsp folder workspace options. (kcl-lang#1818)
Browse files Browse the repository at this point in the history
fix: fix lsp folder workspace options. In a folder kind Workspace, it will recursively search upwards for kcl.mod to find dependencies

Signed-off-by: he1pa <18012015693@163.com>
  • Loading branch information
He1pa authored Jan 14, 2025
1 parent a93ccad commit 9bd64f2
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion kclvm/driver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,20 @@ pub fn lookup_compile_workspaces(
if load_pkg {
if folder.is_dir() {
if let Ok(files) = get_kcl_files(folder.clone(), false) {
workspaces.insert(workspace, (files, Some(load_opt), metadata));
match lookup_the_nearest_file_dir(folder.to_path_buf(), KCL_MOD_FILE) {
Some(dir) => {
let nearest_mod = dir.join(KCL_MOD_FILE);
let (_, opt, metadata) = lookup_compile_workspace(
tool,
&nearest_mod.adjust_canonicalization(),
load_pkg,
);
workspaces.insert(workspace, (files, opt, metadata));
}
None => {
workspaces.insert(workspace, (files, Some(load_opt), metadata));
}
}
return (workspaces, None);
}
}
Expand Down

0 comments on commit 9bd64f2

Please sign in to comment.