Follow-up from the comprehensive review of PR #239 (LSP server). Line numbers reference the PR branch at review time.
Severity: major (reproduced by execution during review; known v1 trade-off, now confirmed user-visible)
Import paths are source-root-relative for every file in a closure (one src_root per walk; project.rs enqueue_imports uses module_file_path(self.src_root, ...)), but RootDatabase analyzes each open file as its own entry with its own directory as source root (ide/ide-db/src/database.rs:14 area).
Repro: project main.inf (use lib::a;), lib/a.inf (use lib::b;), lib/b.inf. From the entry all 3 files resolve with 0 import problems. Opening lib/a.inf standalone resolves lib::b against /proj/lib as root, probing /proj/lib/lib/b.inf → 1 missing-import problem. Since the LSP server pushes diagnostics per open document from that document's own-entry analysis, any user who goto-defs or browses into a subdirectory file of a multi-directory project immediately gets false "file not found for import" squiggles (plus missing symbols / type errors) on a file the compiler accepts — the exact compiler/IDE disagreement the shared FileLoader seam was built to prevent.
This is the AD-4 limitation from the original design (open non-entry file analyzed as its own entry); manifest-aware entry mapping was noted as the forward path.
Suggested fix: resolve a project root for opened files (walk up to a workspace/manifest root, or reuse the closure of an already-analyzed entry that contains the file) before falling back to file-as-own-entry; at minimum suppress missing-import diagnostics for documents already present in another open entry's closure.
Follow-up from the comprehensive review of PR #239 (LSP server). Line numbers reference the PR branch at review time.
Severity: major (reproduced by execution during review; known v1 trade-off, now confirmed user-visible)
Import paths are source-root-relative for every file in a closure (one
src_rootper walk;project.rsenqueue_importsusesmodule_file_path(self.src_root, ...)), butRootDatabaseanalyzes each open file as its own entry with its own directory as source root (ide/ide-db/src/database.rs:14area).Repro: project
main.inf(use lib::a;),lib/a.inf(use lib::b;),lib/b.inf. From the entry all 3 files resolve with 0 import problems. Openinglib/a.infstandalone resolveslib::bagainst/proj/libas root, probing/proj/lib/lib/b.inf→ 1 missing-import problem. Since the LSP server pushes diagnostics per open document from that document's own-entry analysis, any user who goto-defs or browses into a subdirectory file of a multi-directory project immediately gets false "file not found for import" squiggles (plus missing symbols / type errors) on a file the compiler accepts — the exact compiler/IDE disagreement the shared FileLoader seam was built to prevent.This is the AD-4 limitation from the original design (open non-entry file analyzed as its own entry); manifest-aware entry mapping was noted as the forward path.
Suggested fix: resolve a project root for opened files (walk up to a workspace/manifest root, or reuse the closure of an already-analyzed entry that contains the file) before falling back to file-as-own-entry; at minimum suppress missing-import diagnostics for documents already present in another open entry's closure.