Skip to content
Merged
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
11 changes: 9 additions & 2 deletions crates/emmylua_code_analysis/src/db_index/module/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,12 +316,19 @@ impl LuaModuleIndex {
if matched_module_path.is_none() {
matched_module_path = Some((module_path, workspace.id));
} else {
let (matched, _) = match matched_module_path.as_ref() {
let (matched, matched_workspace_id) = match matched_module_path.as_ref() {
Some((matched, id)) => (matched, id),
None => continue,
};
if module_path.len() < matched.len() {
matched_module_path = Some((module_path, workspace.id));
// Libraries could be in a subdirectory of the main workspace
// In case of a conflict, we prioritise the non-main workspace ID
let workspace_id = if workspace.id.is_main() {
*matched_workspace_id
} else {
workspace.id
};
matched_module_path = Some((module_path, workspace_id));
}
}
}
Expand Down
Loading