Skip to content

Commit c71627a

Browse files
authored
Merge pull request #23 from georgiy-belyanin/add-workspace-library-check
add support for `workspace.library` in check tool
2 parents c89713a + f322d7f commit c71627a

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
`NEW` Support compile by winodws mingw
1414

15+
`NEW` `emmylua_check` now supports `workspace.library`
16+
1517
# 0.4.3
1618

1719
`FIX` Fix std resource loaded for cli tools

crates/emmylua_check/src/init.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::{path::PathBuf, sync::Arc};
1+
use std::{path::PathBuf, sync::Arc, str::FromStr};
22

33
use emmylua_code_analysis::{
44
load_configs, load_workspace_files, update_code_style, EmmyLuaAnalysis, Emmyrc, LuaFileInfo,
@@ -13,7 +13,7 @@ pub fn load_workspace(
1313
let mut analysis = EmmyLuaAnalysis::new();
1414
analysis.init_std_lib(false);
1515

16-
let workspace_folders = vec![workspace_folder];
16+
let mut workspace_folders = vec![workspace_folder];
1717
for path in &workspace_folders {
1818
analysis.add_workspace_root(path.clone());
1919
}
@@ -28,8 +28,15 @@ pub fn load_workspace(
2828
]
2929
};
3030

31-
let emmyrc = Arc::new(load_configs(config_files, None));
32-
analysis.update_config(emmyrc);
31+
let mut emmyrc = load_configs(config_files, None);
32+
emmyrc.pre_process_emmyrc(&main_path);
33+
34+
for lib in &emmyrc.workspace.library {
35+
analysis.add_workspace_root(PathBuf::from_str(lib).unwrap());
36+
workspace_folders.push(PathBuf::from_str(lib).unwrap());
37+
}
38+
39+
analysis.update_config(Arc::new(emmyrc));
3340

3441
let file_infos = collect_files(&workspace_folders, &analysis.emmyrc, ignore);
3542
let files = file_infos

0 commit comments

Comments
 (0)