Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix lsp input file path #1649

Merged
merged 1 commit into from
Sep 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion kclvm/driver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ pub fn lookup_compile_workspace(
}
}
}

match lookup_compile_unit_path(file) {
Ok(CompileUnitPath::SettingFile(dir)) => {
let settings_files = lookup_setting_files(&dir);
Expand Down
11 changes: 6 additions & 5 deletions kclvm/tools/src/LSP/src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ pub fn compile(
// Ignore the kcl plugin sematic check.
let mut opts = opts.unwrap_or_default();
opts.load_plugins = true;
// Get input files
let files = match get_normalized_k_files_from_paths(files, &opts) {
// Get input files code from vfs
let normalized_files = match get_normalized_k_files_from_paths(files, &opts) {
Ok(file_list) => file_list,
Err(e) => {
return (
Expand All @@ -46,10 +46,10 @@ pub fn compile(
)
}
};
let files: Vec<&str> = files.iter().map(|s| s.as_str()).collect();
let normalized_files: Vec<&str> = normalized_files.iter().map(|s| s.as_str()).collect();
// Update opt.k_code_list
if let Some(vfs) = &params.vfs {
let mut k_code_list = match load_files_code_from_vfs(&files, vfs) {
let mut k_code_list = match load_files_code_from_vfs(&normalized_files, vfs) {
Ok(code_list) => code_list,
Err(e) => {
return (
Expand All @@ -60,7 +60,6 @@ pub fn compile(
};
opts.k_code_list.append(&mut k_code_list);
}

let mut diags = IndexSet::new();

if let Some(module_cache) = params.module_cache.as_ref() {
Expand All @@ -80,6 +79,8 @@ pub fn compile(
}
}

let files: Vec<&str> = files.iter().map(|s| s.as_str()).collect();

// Parser
let sess = ParseSessionRef::default();
let mut program = match load_program(sess.clone(), &files, Some(opts), params.module_cache) {
Expand Down
Loading