дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-06 10:07:11 +02:00
A failed Maven/Gradle reload left its error balloon on screen after a later reload succeeded: syncTool notified on failure under build-sync-<tool> but never expired that key on success. A clean sync now expires it (the Notifications tool window keeps the entry). The same holds for the language-server prompts (not installed, JDK required, outdated build): a server turning ready expires them, for when the fix came from a settings page rather than the prompt's button. expireNotification leaves the state untouched when no balloon is shown. Co-authored-by: wildcatDownstairs <[email protected]>
101 рядки
3.2 KiB
TypeScript
101 рядки
3.2 KiB
TypeScript
/**
|
||
* Tools installer: Settings › Languages & Frameworks › Language Servers, plus
|
||
* install prompts for missing language servers.
|
||
*
|
||
* Actions: `tools.languageServers` (open the page), `tools.install` (arg: tool name),
|
||
* `java.downloadJdk` (arg: `DownloadJdkArgs`).
|
||
*/
|
||
import { lazyComponent } from "@/ui";
|
||
import { executeAction, registerActions } from "@/platform/actions";
|
||
import { registerSettingsPage } from "@/workbench/contributions";
|
||
import { installExpiredServerPrompts } from "./expired";
|
||
import { installJdkPrompts, registerJdkActions } from "./jdk";
|
||
import {
|
||
installMissingServerPrompts,
|
||
installServerReadyExpiry,
|
||
installServerWarningPrompts,
|
||
promptInstall,
|
||
} from "./missing";
|
||
import { installTool, refreshTools, SETTINGS_PAGE_ID, toolByName, useTools } from "./store";
|
||
|
||
/** The Language Servers page (also used by the Settings window). */
|
||
export function activateSettingsPages(): () => void {
|
||
return registerSettingsPage({
|
||
id: SETTINGS_PAGE_ID,
|
||
title: "Language Servers",
|
||
group: "Languages & Frameworks",
|
||
order: 400,
|
||
keywords: [
|
||
"lsp",
|
||
"language server",
|
||
"debugger",
|
||
"adapter",
|
||
"dap",
|
||
"install",
|
||
"initialization options",
|
||
"rust-analyzer",
|
||
"gopls",
|
||
"pyright",
|
||
],
|
||
projectScope: true,
|
||
component: lazyComponent(() => import("./LanguageServersPage").then((m) => m.LanguageServersPage)),
|
||
});
|
||
}
|
||
|
||
export function activate(): () => void {
|
||
const disposers = [
|
||
activateSettingsPages(),
|
||
registerActions([
|
||
{
|
||
id: "tools.promptInstall",
|
||
title: "Install Missing Tool",
|
||
hidden: true,
|
||
run: async ({ arg }) => {
|
||
if (arg && typeof arg === "object" && "name" in arg && typeof arg.name === "string") {
|
||
await promptInstall(
|
||
arg.name,
|
||
!("sticky" in arg) || arg.sticky !== false,
|
||
new Set(),
|
||
"formatter" in arg && arg.formatter === true,
|
||
);
|
||
}
|
||
},
|
||
},
|
||
{
|
||
id: "tools.languageServers",
|
||
title: "Language Servers…",
|
||
category: "Tools",
|
||
icon: "package",
|
||
keywords: ["lsp", "install", "debugger", "adapter"],
|
||
run: () => void executeAction("file.settings", SETTINGS_PAGE_ID),
|
||
},
|
||
{
|
||
id: "tools.install",
|
||
title: "Install Language Server / Debugger",
|
||
category: "Tools",
|
||
hidden: true,
|
||
// Tools the IDE can't install (no recipe, missing npm/curl) open the page with the manual hint.
|
||
run: async ({ arg }) => {
|
||
if (typeof arg === "string") {
|
||
if (!useTools.getState().loaded) await refreshTools();
|
||
const tool = toolByName(arg);
|
||
// Unknown because the list failed to load: try anyway, so the failure is reported.
|
||
if (tool ? tool.canInstall : useTools.getState().error !== null) {
|
||
await installTool(arg);
|
||
return;
|
||
}
|
||
}
|
||
await executeAction("file.settings", SETTINGS_PAGE_ID);
|
||
},
|
||
},
|
||
]),
|
||
installMissingServerPrompts(),
|
||
installServerReadyExpiry(),
|
||
installServerWarningPrompts(),
|
||
installExpiredServerPrompts(),
|
||
registerJdkActions(),
|
||
installJdkPrompts(),
|
||
];
|
||
return () => disposers.reverse().forEach((d) => d());
|
||
}
|