дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-08 19:02:17 +02:00
fix(editor): say when a file is outside the language server's projects (#1046)
jdtls only checks the syntax of a Java file outside every module's source folders (or outside any imported project) and answers navigation with nothing. The editor then said only "Cannot find declaration to go to", and the server's explanation was a warning squiggle on line 1. - A banner above the editor explains it while the server reports it, for jdtls (not on the classpath of a project / non-project file), gopls (no package, build constraints — this replaces the Go-only banner) and rust-analyzer (unlinked file). For Java it offers the Maven / Gradle reload when available. - Go to Declaration / Implementation / Type Declaration that finds nothing in such a file gives the reason in its hint. Fixes #827
Цей коміт міститься в:
1 джерело
ae406ca2fb
коміт
98517019e7
9 files changed
+201
-38
No files matched your search
@@ -303,6 +303,29 @@ describe("navigation wiring", () => {
|
||||
expect(document.querySelector(".cm-lsp-hint")?.textContent).toBe("Cannot find declaration to go to");
|
||||
});
|
||||
|
||||
it("says why when the server only checks the file's syntax", async () => {
|
||||
const { setFileDiagnostics } = await import("./diagnostics");
|
||||
setFileDiagnostics("/p/a.ts", "jdtls", [
|
||||
{
|
||||
range: { start: { line: 0, col: 0 }, end: { line: 0, col: 1 } },
|
||||
severity: "warning",
|
||||
message: "a.ts is not on the classpath of project app, only syntax errors are reported",
|
||||
source: "Java",
|
||||
code: "32",
|
||||
},
|
||||
]);
|
||||
try {
|
||||
cmd.lspGoto.mockReturnValueOnce(ok([]));
|
||||
const view = editor("const x = 1;\nx;", "typescript", 13);
|
||||
await gotoTargets(view, "definition");
|
||||
expect(document.querySelector(".cm-lsp-hint")?.textContent).toBe(
|
||||
"Cannot find declaration to go to. This file is outside the source folders of its Java module: only syntax errors are reported, and navigation and completion don't work.",
|
||||
);
|
||||
} finally {
|
||||
setFileDiagnostics("/p/a.ts", "jdtls", []);
|
||||
}
|
||||
});
|
||||
|
||||
it("falls back to the local definition when the server is not ready", async () => {
|
||||
cmd.syntaxLocals.mockReturnValueOnce(ok(local({ references: [r(1, 0, 1)] })));
|
||||
const view = editor("const x = 1;\nx;", "typescript", 13);
|
||||
|
||||
Reference in new issue
Заблокувати користувача