Skip to content

Commit a6b8bbf

Browse files
authored
Merge pull request #520 from lewis6991/fix/check/emmyrcstdlib
fix(check): init stdlib after applying emmyrc
2 parents 4570dea + ac9b9e9 commit a6b8bbf

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

crates/emmylua_check/src/init.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,7 @@ pub fn load_workspace(
3030
config_paths: Option<Vec<PathBuf>>,
3131
ignore: Option<Vec<String>>,
3232
) -> Option<EmmyLuaAnalysis> {
33-
let mut analysis = EmmyLuaAnalysis::new();
34-
analysis.init_std_lib(None);
35-
3633
let mut workspace_folders = vec![workspace_folder];
37-
for path in &workspace_folders {
38-
analysis.add_main_workspace(path.clone());
39-
}
40-
4134
let main_path = workspace_folders.first()?.clone();
4235
let (config_files, config_root): (Vec<PathBuf>, PathBuf) =
4336
if let Some(config_paths) = config_paths {
@@ -65,16 +58,22 @@ pub fn load_workspace(
6558
);
6659
emmyrc.pre_process_emmyrc(&config_root);
6760

68-
for root in &emmyrc.workspace.workspace_roots {
69-
analysis.add_main_workspace(PathBuf::from_str(root).unwrap());
70-
}
71-
7261
for lib in &emmyrc.workspace.library {
73-
analysis.add_main_workspace(PathBuf::from_str(lib).unwrap());
7462
workspace_folders.push(PathBuf::from_str(lib).unwrap());
7563
}
7664

65+
let mut analysis = EmmyLuaAnalysis::new();
66+
67+
for path in &workspace_folders {
68+
analysis.add_main_workspace(path.clone());
69+
}
70+
71+
for root in &emmyrc.workspace.workspace_roots {
72+
analysis.add_main_workspace(PathBuf::from_str(root).unwrap());
73+
}
74+
7775
analysis.update_config(Arc::new(emmyrc));
76+
analysis.init_std_lib(None);
7877

7978
let file_infos = collect_files(&workspace_folders, &analysis.emmyrc, ignore);
8079
let files = file_infos

0 commit comments

Comments
 (0)