Skip to content

The IDE you know, rebuilt in Rust. IntelliJ IDEA–style keymap, tool windows and search-everywhere in a fast native app: editor, code insight, debugger, Git, terminal, database and HTTP clients for 60+ languages.

fix(debugger): offer to install php-debug when it is missing (#1633)

Vadim Lazuk3ec30fff3fc9
diff --git a/languages/php.toml b/languages/php.toml
index b0fc0f4e3..e3dcf927d 100644
--- a/languages/php.toml
+++ b/languages/php.toml
@@ -29,4 +29,4 @@ install-hint = "Install phpactor (https://phpactor.readthedocs.io/en/master/usag
[debugger]
adapter = "php-debug"
command = "php-debug-adapter"
-install-hint = "Install vscode-php-debug (Xdebug) as `php-debug-adapter` (e.g. via mason.nvim) and enable Xdebug"
+install-hint = "Install PHP Debug (Xdebug) in Settings › Languages & Frameworks › Language Servers, and enable Xdebug"
diff --git a/src/features/debugger/__tests__/missingAdapter.test.ts b/src/features/debugger/__tests__/missingAdapter.test.ts
index feb17d383..f791778f2 100644
--- a/src/features/debugger/__tests__/missingAdapter.test.ts
+++ b/src/features/debugger/__tests__/missingAdapter.test.ts
@@ -27,6 +27,17 @@ describe("missing debug adapters", () => {
expect(missingAdapter("delve", unavailable("debug adapter `delve` not found (x)"))?.tool).toBe("delve");
});
+ it("offers the managed install of the missing php-debug adapter", () => {
+ const e = unavailable(
+ "debug adapter `php-debug` not found (`php-debug-adapter` is neither installed by OpenIDEA nor on PATH). Install PHP Debug (Xdebug) in Settings › Languages & Frameworks › Language Servers, and enable Xdebug",
+ );
+ expect(missingAdapter("php-debug", e)).toMatchObject({
+ tool: "php-debug",
+ title: "PHP Debug (Xdebug) is not installed",
+ body: e.message,
+ });
+ });
+
it("leaves other failures and adapters without an installer alone", () => {
expect(missingAdapter("js-debug", unavailable("connection refused"))).toBeNull();
expect(missingAdapter("js-debug", new Error("debug adapter `js-debug` not found"))).toBeNull();
diff --git a/src/features/debugger/missingAdapter.ts b/src/features/debugger/missingAdapter.ts
index dabfb4024..357b10b9b 100644
--- a/src/features/debugger/missingAdapter.ts
+++ b/src/features/debugger/missingAdapter.ts
@@ -12,6 +12,7 @@ const INSTALLABLE: Record<string, { tool: string; title: string }> = {
"js-debug": { tool: "js-debug", title: "The JavaScript debugger (vscode-js-debug) is not installed" },
delve: { tool: "delve", title: "Delve is not installed" },
codelldb: { tool: "codelldb", title: "CodeLLDB is not installed" },
+ "php-debug": { tool: "php-debug", title: "PHP Debug (Xdebug) is not installed" },
};
export interface MissingAdapter {
diff --git a/src/platform/locales/text/zh.json b/src/platform/locales/text/zh.json
index 80a549de1..50a54d8b1 100644
--- a/src/platform/locales/text/zh.json
+++ b/src/platform/locales/text/zh.json
@@ -4123,6 +4123,7 @@
"The JavaScript debugger (vscode-js-debug) is not installed": "JavaScript 调试器 (vscode-js-debug) 未安装",
"Delve is not installed": "Delve 未安装",
"CodeLLDB is not installed": "CodeLLDB 未安装",
+ "PHP Debug (Xdebug) is not installed": "PHP Debug (Xdebug) 未安装",
"{name} (child)": "{name}(子进程)",
"Enable breakpoint at {path}:{line}": "启用位于 {path}:{line} 的断点",
"Headers ({count})": "标头 ({count})",