дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-04 17:21:13 +02:00
Offline mode in the Maven tool window only added -o to sync's mvn; jdtls's m2e kept downloading. Each sync now records the offline mode (in the build cache, like profiles) and jdtls follows it via java.import.maven.offline.enabled, reconfigured when it changes; toggling offline reloads Maven. Offline sync keeps maven-dependency-plugin 3.8.1 when the local repository has it, and "No plugin found for prefix 'help'" now explains why and offers Open Maven Settings. Co-authored-by: wildcatDownstairs <[email protected]>
69 рядки
3.2 KiB
TypeScript
69 рядки
3.2 KiB
TypeScript
import { afterEach, expect, it, vi } from "vitest";
|
|
|
|
const executeAction = vi.hoisted(() => vi.fn());
|
|
vi.mock("./actions", async (original) => ({
|
|
...(await original<typeof import("./actions")>()),
|
|
executeAction,
|
|
}));
|
|
import { buildToolRecovery } from "./buildToolRecovery";
|
|
|
|
afterEach(() => vi.clearAllMocks());
|
|
|
|
it.each([
|
|
["cannot start mvn: No such file or directory (os error 2)", "maven"],
|
|
["command not found: mvn", "maven"],
|
|
["command not found: /opt/apache maven/bin/mvn", "maven"],
|
|
["command not found: C:\\Maven\\bin\\mvn.cmd", "maven"],
|
|
["cannot start gradle: No such file or directory (os error 2)", "gradle"],
|
|
["command not found: gradle", "gradle"],
|
|
["command not found: C:\\Gradle\\bin\\gradle.bat", "gradle"],
|
|
["command not found: ./gradlew", "gradle"],
|
|
])("links missing build tool to its settings: %s", (message, tool) => {
|
|
const result = buildToolRecovery(message);
|
|
expect(result.body).toContain(`${tool === "maven" ? "Maven" : "Gradle"} could not be started`);
|
|
expect(result.body).toContain(message);
|
|
expect(result.actions).toHaveLength(1);
|
|
result.actions[0]!.run();
|
|
expect(executeAction).toHaveBeenCalledWith("file.settings", `build.${tool}`);
|
|
});
|
|
|
|
it("links the reported Gradle import rejection to the Gradle JVM picker and its JDK download", () => {
|
|
const message =
|
|
"Nov 9, 2026, 3:49:11 PM Can't use Java 27.0.1.0.3 and Gradle 9.7.1 to import Gradle project kotlin-gradle.";
|
|
const result = buildToolRecovery(message);
|
|
expect(result.body).toContain("Download JDK");
|
|
expect(result.actions[0]!.label).toBe("Choose Gradle JVM");
|
|
result.actions[0]!.run();
|
|
expect(executeAction).toHaveBeenCalledWith("file.settings", "build.gradle");
|
|
});
|
|
|
|
it.each([
|
|
"command not found: npm",
|
|
"Maven tests failed",
|
|
"Gradle build failed",
|
|
"cannot start mvn: Permission denied (os error 13)",
|
|
])("leaves unrelated failures alone: %s", (message) => {
|
|
expect(buildToolRecovery(message)).toEqual({ body: message, actions: [] });
|
|
});
|
|
|
|
it("links tsserver running out of memory to the language server settings", () => {
|
|
const message =
|
|
"tsserver stopped because it reached its memory limit and is restarted, so code intelligence may pause or miss results. Raise typescript.tsserver.maxTsServerMemory (in MB) in the server's Workspace Configuration.";
|
|
const result = buildToolRecovery(message);
|
|
expect(result.body).toBe(message);
|
|
expect(result.actions.map((a) => a.label)).toEqual(["Language Servers…"]);
|
|
result.actions[0]!.run();
|
|
expect(executeAction).toHaveBeenCalledWith("file.settings", "languages.servers");
|
|
});
|
|
|
|
it("explains a plugin prefix Maven cannot resolve offline and links Maven settings", () => {
|
|
const message =
|
|
"No plugin found for prefix 'help' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\\Users\\dev\\.m2\\repository)]";
|
|
const result = buildToolRecovery(message);
|
|
expect(result.body).toContain("turn offline mode off and reload once");
|
|
expect(result.body).toContain(message);
|
|
expect(result.actions.map((a) => a.label)).toEqual(["Open Maven Settings"]);
|
|
result.actions[0]!.run();
|
|
expect(executeAction).toHaveBeenCalledWith("file.settings", "build.maven");
|
|
});
|