File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
crates/emmylua_code_analysis/src/db_index/module Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -316,12 +316,19 @@ impl LuaModuleIndex {
316
316
if matched_module_path. is_none ( ) {
317
317
matched_module_path = Some ( ( module_path, workspace. id ) ) ;
318
318
} else {
319
- let ( matched, _ ) = match matched_module_path. as_ref ( ) {
319
+ let ( matched, matched_workspace_id ) = match matched_module_path. as_ref ( ) {
320
320
Some ( ( matched, id) ) => ( matched, id) ,
321
321
None => continue ,
322
322
} ;
323
323
if module_path. len ( ) < matched. len ( ) {
324
- matched_module_path = Some ( ( module_path, workspace. id ) ) ;
324
+ // Libraries could be in a subdirectory of the main workspace
325
+ // In case of a conflict, we prioritise the non-main workspace ID
326
+ let workspace_id = if workspace. id . is_main ( ) {
327
+ * matched_workspace_id
328
+ } else {
329
+ workspace. id
330
+ } ;
331
+ matched_module_path = Some ( ( module_path, workspace_id) ) ;
325
332
}
326
333
}
327
334
}
You can’t perform that action at this time.
0 commit comments