From a36e95c705d58c32438e1fc1ddbaa83fdb82aa1a Mon Sep 17 00:00:00 2001 From: Ryan Welcher Date: Fri, 20 Nov 2026 11:06:19 -0500 Subject: [PATCH 1/7] Offer Xdebug setup for Sublime Text Sublime Text's Debugger package runs the same Xdebug adapter as VS Code, configured in a .sublime-project. The setup gives a whole project file, naming the site's folder by its full path so it can be saved outside the checkout, and its first step says Node.js is required, with the node setting as the fix when Sublime opened from the Dock cannot find it. Fixes #758. --- docs/guide/step-debugging.md | 19 ++++++-- .../components/xdebug-setup-dialog.jsx | 34 +++++++++++--- src/renderer/index.jsx | 2 +- src/renderer/xdebug.cjs | 45 ++++++++++++++----- tests/e2e/journeys/xdebug.spec.js | 25 +++++++++-- tests/unit/xdebug.test.cjs | 38 +++++++++++++--- 6 files changed, 135 insertions(+), 28 deletions(-) diff --git a/docs/guide/step-debugging.md b/docs/guide/step-debugging.md index cd3fae7c..f1b8e5f0 100644 --- a/docs/guide/step-debugging.md +++ b/docs/guide/step-debugging.md @@ -2,7 +2,7 @@ A site's PHP can run with Xdebug, so you can stop on a breakpoint in your editor and step through Core one line at a time. It is off unless you turn it on, because it slows every request. -This is a proof of concept. It has setup for VS Code, Cursor, PhpStorm and Zed, and one running site has Xdebug at a time. +This is a proof of concept. It has setup for VS Code, Cursor, PhpStorm, Zed and Sublime Text, and one running site has Xdebug at a time. ## Turn it on @@ -14,7 +14,7 @@ The **Debugging** row of the site's details then names *Xdebug*, and while the s ![The site's details with the Debugging row reading WP_DEBUG · SCRIPT_DEBUG · Xdebug, and the Set up Xdebug for your editor menu open under it, listing VS Code and PhpStorm](/screenshots/xdebug-setup-menu.png) -The menu lists the editors the app finds on your computer that it has setup for. If it finds none of them, there is no menu. The app looks in each editor's usual install location, so it can miss one installed elsewhere, such as PhpStorm from JetBrains' own installer on Windows. Sublime Text has no setup: its PHP debugger needs Node.js installed on your computer. +The menu lists the editors the app finds on your computer that it has setup for. If it finds none of them, there is no menu. The app looks in each editor's usual install location, so it can miss one installed elsewhere, such as PhpStorm from JetBrains' own installer on Windows. If you chose one of these editors as your **Code editor** on the **General** tab of **Settings**, and the app finds it, the button is named for it instead, such as **Set up Xdebug for Zed**, and opens that editor's setup without the menu. In the steps below, select that button where they say to choose your editor from the menu. To set up a different editor, change the **Code editor** setting, or set it to **Ask each time** to have the menu back. @@ -56,6 +56,19 @@ Like the launch.json, the debug.json listens on `127.0.0.1` only. If Zed says no debug tasks were found, the PHP extension is not installed: Zed leaves out a debug task whose adapter it does not have. +## Connect Sublime Text + +Sublime Text debugs PHP with the **Debugger** package, which needs Node.js installed on your computer. The app does not install Node.js or check for it. + +1. Install [Node.js](https://nodejs.org/). If Debugger later says it cannot find node, run `which node` in a terminal, then run **Preferences: Debugger Settings** from the command palette and set `node` to the path it printed. This happens on macOS when you open Sublime Text from the Dock, because it does not get your terminal's `PATH`. +2. Run **Package Control: Install Package** from the command palette, and install **Debugger**. Then run **Debugger: Install Adapters**, and install **PHP**. +3. In the site's details, select **Set up Xdebug for your editor**, choose **Sublime Text**, then select **Copy project file**. +4. Paste it into a new file, and save it with a `.sublime-project` extension outside the site's folder, so it stays out of your patch. The file names the site's folder by its full path, so it works from anywhere. +5. Open it with **Project → Open Project**. +6. Run **Debugger: Open**, start **Listen for Xdebug**, set a breakpoint, and load a page of the site in the browser. + +Like the launch.json, the project file listens on `127.0.0.1` only. + ## Where to set breakpoints On a Core site, set breakpoints in `src/`, the files you edit. The server runs WordPress from `build/`, but the build copies the PHP from `src/` line for line, and the launch.json maps one to the other. @@ -76,7 +89,7 @@ A site you start while another site's server has Xdebug starts without it. Its * ## If your editor does not stop - Check that the site's details show **Set up Xdebug for your editor**, or **Set up Xdebug for** and your code editor's name, under **Debugging**. If they do not, restart the server. If they still do not, the app found no editor it has setup for. -- Check that **Listen for Xdebug** is running in VS Code, Cursor or Zed, or that PhpStorm is listening for debug connections, and that no other program uses port 9003. +- Check that **Listen for Xdebug** is running in VS Code, Cursor, Zed or Sublime Text, or that PhpStorm is listening for debug connections, and that no other program uses port 9003. - On a Core site, check that the breakpoint is in `src/`, not `build/`, and not in one of the three files above. - On a Gutenberg site, check that the breakpoint is in one of the checkout's own PHP files. - Check that no other site's server is running with Xdebug. diff --git a/src/renderer/components/xdebug-setup-dialog.jsx b/src/renderer/components/xdebug-setup-dialog.jsx index dd6a3098..95400e61 100644 --- a/src/renderer/components/xdebug-setup-dialog.jsx +++ b/src/renderer/components/xdebug-setup-dialog.jsx @@ -109,6 +109,29 @@ function ZedSteps({ config, onCopy }) { ); } +// Sublime Text debugs PHP with the Debugger package, which runs its Xdebug +// adapter on a Node.js installed on the computer (#758). Node comes first, so +// nobody finds out after the rest. The app does not look for Node itself: a +// Sublime opened from the Dock on macOS does not get the shell's PATH, so the +// app's answer could differ from the package's. +function SublimeSteps({ config, onCopy }) { + return ( +
    + Node.js on your computer. The Debugger package runs its PHP adapter with it. If Debugger later says it can’t find node, run which node in a terminal, then run Preferences: Debugger Settings and set node to the path it printed.')} /> + Package Control: Install Package from the command palette, and install Debugger. Then run Debugger: Install Adapters, and install PHP.')} /> + .sublime-project file outside the site’s folder, so it stays out of your patch, and open it with Project → Open Project:')}> +
    +
    {config}
    + + + +
    +
    + Debugger: Open, start “Listen for Xdebug”, set a breakpoint, and load the site.')} /> +
+ ); +} + // A value for PhpStorm's settings: its field's name over it, and its copy // button at the end, described by that name. function PhpStormValue({ value, onCopy }) { @@ -147,20 +170,20 @@ function PhpStormSteps({ values, onCopy }) { /** * How to stop on breakpoints while the site's server has Xdebug (#723), for * one editor, picked from the Debugging row's menu: VS Code or Cursor, with - * the launch.json they need, Zed, with its debug.json, or PhpStorm, with the - * values its settings need. The - * app shows and copies them, and never writes them into the checkout, where + * the launch.json they need, Zed, with its debug.json, Sublime Text, with its + * project file, or PhpStorm, with the values its settings need. The app shows and copies them, and never writes them into the checkout, where * they would end up in a patch. * * @param {Object} props * @param {?Object} props.editor The editor while open, from `xdebugEditors`: `{id, name, setup}`; or null. * @param {string} props.config The launch.json, from `xdebugLaunchConfig`. * @param {string} props.zed The debug.json, from `zedDebugConfig`. + * @param {string} props.sublime The .sublime-project, from `sublimeProjectConfig`. * @param {Array} props.phpStorm The PhpStorm values, from `phpStormSettings`. * @param {Function} props.onCopy Copies a text, resolving to whether it worked. * @param {Function} props.onClose */ -export function XdebugSetupDialog({ editor, config, zed, phpStorm, onCopy, onClose }) { +export function XdebugSetupDialog({ editor, config, zed, sublime, phpStorm, onCopy, onClose }) { // The editor stays drawn while the dialog closes, when `editor` is already // null. const [shown, setShown] = useState(editor); @@ -170,7 +193,8 @@ export function XdebugSetupDialog({ editor, config, zed, phpStorm, onCopy, onClo const phpStormShown = setup === 'phpstorm'; const steps = { phpstorm: , - zed: + zed: , + sublime: }; return ( { if (!next) onClose(); }}> diff --git a/src/renderer/index.jsx b/src/renderer/index.jsx index 182d6b51..8b4327f3 100644 --- a/src/renderer/index.jsx +++ b/src/renderer/index.jsx @@ -2614,7 +2614,7 @@ function SiteRow({ sitePath, initialized, createdAt, label, projectType = null, onClose={() => setDirtyModalOpen(false)} /> ) : null} - entry.id === xdebugEditor) || null : null} config={xdebug ? xdebug.config : ''} zed={xdebug ? xdebug.zed : ''} phpStorm={xdebug ? xdebug.phpStorm : []} onCopy={copyXdebugConfig} onClose={() => setXdebugEditor(null)} /> + entry.id === xdebugEditor) || null : null} config={xdebug ? xdebug.config : ''} zed={xdebug ? xdebug.zed : ''} sublime={xdebug ? xdebug.sublime : ''} phpStorm={xdebug ? xdebug.phpStorm : []} onCopy={copyXdebugConfig} onClose={() => setXdebugEditor(null)} /> asking.action()} onClose={() => setAsking(null)} /> {isPatchOpen && ( diff --git a/src/renderer/xdebug.cjs b/src/renderer/xdebug.cjs index 30c7ab21..c4734fb7 100644 --- a/src/renderer/xdebug.cjs +++ b/src/renderer/xdebug.cjs @@ -66,6 +66,29 @@ function zedDebugConfig({ sitePath, serve }) { ], null, 2); } +/** + * The .sublime-project a contributor saves for Sublime Text's Debugger + * package, which runs the same Xdebug adapter as VS Code's PHP Debug, as + * "php", and reads its setups from `debugger_configurations` in the project + * file. The project names the site's folder by its full path, so the file + * works wherever it is saved, and is saved outside the checkout, where it + * would otherwise end up in a patch. + * + * @param {Object} root0 + * @param {string} root0.sitePath The checkout's folder, in this platform's form. + * @param {Object} root0.serve The project's serve model: `{strategy, pluginSlug}`. + * @return {string} The file's text. + */ +function sublimeProjectConfig({ sitePath, serve }) { + const { server, local } = xdebugMapping({ sitePath, serve }); + return JSON.stringify({ + folders: [{ path: sitePath }], + debugger_configurations: [ + { name: 'Listen for Xdebug', type: 'php', request: 'launch', hostname: XDEBUG_HOST, port: XDEBUG_PORT, pathMappings: { [server]: local } } + ] + }, null, 2); +} + /** * The one mapping between the path PHP sees and the folder on this machine, * which every editor needs; see `xdebugLaunchConfig` for why it is this one. @@ -147,9 +170,9 @@ function xdebugStatus({ setting, running, startedWith, holder = '', heldAtStart /** * What the server's details say of Xdebug: null when there is nothing to * say; otherwise whether the server has it, the note from `xdebugStatus`, - * and the launch.json for VS Code, the debug.json for Zed and the values for - * PhpStorm while it has - * it (and nothing when it would not connect). + * and the launch.json for VS Code, the debug.json for Zed, the project file + * for Sublime Text and the values for PhpStorm while it has it (and nothing + * when it would not connect). * * @param {Object} root0 * @param {boolean} root0.setting What the settings hold. @@ -161,7 +184,7 @@ function xdebugStatus({ setting, running, startedWith, holder = '', heldAtStart * @param {Function} [root0.nameFor] A site's name, by its path. * @param {Object} root0.serve The project's serve model. * @param {string} root0.url The running server's address. - * @return {?{on: boolean, note: string, config: string, zed: string, phpStorm: Array}} + * @return {?{on: boolean, note: string, config: string, zed: string, sublime: string, phpStorm: Array}} */ function xdebugSection({ setting, running, startedWith, heldAtStart = false, sitePath, servers = {}, nameFor = (dir) => dir, serve, url }) { const holderPath = xdebugHolder({ sitePath, servers }); @@ -171,6 +194,7 @@ function xdebugSection({ setting, running, startedWith, heldAtStart = false, sit ...status, config: status.on ? xdebugLaunchConfig({ sitePath, serve }) : '', zed: status.on ? zedDebugConfig({ sitePath, serve }) : '', + sublime: status.on ? sublimeProjectConfig({ sitePath, serve }) : '', phpStorm: status.on ? phpStormSettings({ sitePath, serve, url }) : [] }; } @@ -193,19 +217,20 @@ function xdebugHolder({ sitePath, servers }) { /** * The editors the setup menu offers: those found on this machine that have a * setup, in this order. Cursor reads VS Code's launch.json, so it gets that - * setup under its own name. Sublime Text has none: its PHP debugger needs - * Node.js installed, which the toolkit does not ask for. With none found - * that has a setup, there is nothing to set up, and the list is empty. + * setup under its own name. Sublime Text's needs Node.js on the computer, + * which its steps say first (#758). With none found that has a setup, there + * is nothing to set up, and the list is empty. * * @param {Array<{id: string}>} [detected] From `editor:list`. - * @return {Array<{id: string, name: string, setup: string}>} `setup` is 'vscode', 'phpstorm' or 'zed'. + * @return {Array<{id: string, name: string, setup: string}>} `setup` is 'vscode', 'phpstorm', 'zed' or 'sublime'. */ function xdebugEditors(detected) { const editors = [ { id: 'vscode', name: __('VS Code'), setup: 'vscode' }, { id: 'cursor', name: __('Cursor'), setup: 'vscode' }, { id: 'phpstorm', name: __('PhpStorm'), setup: 'phpstorm' }, - { id: 'zed', name: __('Zed'), setup: 'zed' } + { id: 'zed', name: __('Zed'), setup: 'zed' }, + { id: 'sublime', name: __('Sublime Text'), setup: 'sublime' } ]; const ids = new Set((detected || []).map((editor) => editor.id)); return editors.filter((editor) => ids.has(editor.id)); @@ -229,4 +254,4 @@ function xdebugSetupEditor({ editors = [], preferred = null } = {}) { return { ...chosen, label: sprintf(__('Set up Xdebug for %s'), chosen.name) }; } -module.exports = { XDEBUG_PORT, xdebugLaunchConfig, phpStormSettings, xdebugStatus, xdebugSection, xdebugHolder, xdebugEditors, xdebugSetupEditor, zedDebugConfig }; +module.exports = { XDEBUG_PORT, xdebugLaunchConfig, phpStormSettings, xdebugStatus, xdebugSection, xdebugHolder, xdebugEditors, xdebugSetupEditor, zedDebugConfig, sublimeProjectConfig }; diff --git a/tests/e2e/journeys/xdebug.spec.js b/tests/e2e/journeys/xdebug.spec.js index 7f19a5fe..a50d36d8 100644 --- a/tests/e2e/journeys/xdebug.spec.js +++ b/tests/e2e/journeys/xdebug.spec.js @@ -319,8 +319,8 @@ test( 'a setup dialog closed by the server going does not open again by itself a } ); // The menu offers the editors found on this machine that have a setup (#723): -// Cursor gets VS Code's, Zed its own, and Sublime Text none. Finding none of -// them, there is nothing to set up, and no setup is offered. +// Cursor gets VS Code's, and Zed and Sublime Text their own (#758). Finding +// none of them, there is nothing to set up, and no setup is offered. test( 'the setup menu offers the detected editors that have a setup, and no setup when it finds none', async ( { session } ) => { const site = await makeSite( session ); const { app, page } = await session.start( site.settings ); @@ -334,7 +334,7 @@ test( 'the setup menu offers the detected editors that have a setup, and no setu await ui.startDevServerButton( page ).click(); await setup.click(); // INVARIANT — only the detected editors with a setup, in a fixed order. - await expect.poll( items ).toEqual( [ 'Cursor', 'Zed' ] ); + await expect.poll( items ).toEqual( [ 'Cursor', 'Zed', 'Sublime Text' ] ); // INVARIANT — Cursor's is VS Code's launch.json, under Cursor's name. await page.getByRole( 'menuitem', { name: 'Cursor', exact: true } ).click(); @@ -362,9 +362,26 @@ test( 'the setup menu offers the detected editors that have a setup, and no setu await page.keyboard.press( 'Escape' ); await expect( zed ).toHaveCount( 0 ); + // INVARIANT — Sublime Text's is a .sublime-project for the Debugger + // package's PHP adapter, with the same listener and mapping, and its first + // step is the Node.js the package needs, before anything else is done. + await setup.click(); + await page.getByRole( 'menuitem', { name: 'Sublime Text', exact: true } ).click(); + const sublime = page.getByRole( 'dialog', { name: 'Set up Sublime Text', exact: true } ); + await expect( sublime ).toBeVisible(); + await expect( sublime.locator( '.xdebug-setup-step' ).first() ).toContainText( 'Install Node.js on your computer.' ); + await expect( sublime.locator( '.xdebug-setup-step' ).first() ).toContainText( 'which node' ); + const project = JSON.parse( await sublime.locator( '.xdebug-launch-config' ).textContent() ); + expect( project.folders ).toEqual( [ { path: site.dir } ] ); + expect( project.debugger_configurations[ 0 ] ).toMatchObject( { type: 'php', request: 'launch', port: 9003, hostname: '127.0.0.1' } ); + expect( project.debugger_configurations[ 0 ].pathMappings ).toEqual( { '/wordpress': path.join( site.dir, 'src' ) } ); + await expect( sublime.getByRole( 'button', { name: 'Copy project file', exact: true } ) ).toBeVisible(); + await page.keyboard.press( 'Escape' ); + await expect( sublime ).toHaveCount( 0 ); + // INVARIANT — with nothing detected that has a setup, the row still names // Xdebug and offers no setup. - await app.evaluate( () => { global.e2eEditors = [ 'sublime' ]; } ); + await app.evaluate( () => { global.e2eEditors = []; } ); await ui.stopDevServerButton( page ).click(); await ui.startDevServerButton( page ).click(); await expect( ui.stopDevServerButton( page ) ).toBeVisible(); diff --git a/tests/unit/xdebug.test.cjs b/tests/unit/xdebug.test.cjs index db208a62..c1f2071c 100644 --- a/tests/unit/xdebug.test.cjs +++ b/tests/unit/xdebug.test.cjs @@ -1,7 +1,7 @@ const test = require('node:test'); const assert = require('node:assert/strict'); -const { xdebugLaunchConfig, phpStormSettings, xdebugStatus, xdebugSection, xdebugHolder, xdebugEditors, xdebugSetupEditor, zedDebugConfig } = require('../../src/renderer/xdebug.cjs'); +const { xdebugLaunchConfig, phpStormSettings, xdebugStatus, xdebugSection, xdebugHolder, xdebugEditors, xdebugSetupEditor, zedDebugConfig, sublimeProjectConfig } = require('../../src/renderer/xdebug.cjs'); const mappings = (text) => JSON.parse(text).configurations[0].pathMappings; @@ -171,7 +171,8 @@ test('the setup menu lists the detected editors that have a setup, in a fixed or assert.deepEqual(xdebugEditors(found('zed', 'sublime', 'phpstorm', 'vscode')), [ { id: 'vscode', name: 'VS Code', setup: 'vscode' }, { id: 'phpstorm', name: 'PhpStorm', setup: 'phpstorm' }, - { id: 'zed', name: 'Zed', setup: 'zed' } + { id: 'zed', name: 'Zed', setup: 'zed' }, + { id: 'sublime', name: 'Sublime Text', setup: 'sublime' } ]); }); @@ -183,7 +184,7 @@ test('Cursor gets the VS Code setup, under its own name', () => { // menu has no entries, and the Debugging row offers no setup. test('with no detected editor that has a setup, the menu offers nothing', () => { assert.deepEqual(xdebugEditors([]), []); - assert.deepEqual(xdebugEditors(found('sublime')), []); + assert.deepEqual(xdebugEditors(found('notepad')), []); assert.deepEqual(xdebugEditors(undefined), []); }); @@ -197,9 +198,9 @@ test('the setup opens the editor chosen in Settings directly when it has a setup }); test('the setup is the menu with no editor chosen, one with no setup, or one no longer found', () => { - const editors = xdebugEditors(found('vscode', 'sublime')); + const editors = xdebugEditors(found('vscode', 'notepad')); assert.equal(xdebugSetupEditor({ editors, preferred: null }), null); - assert.equal(xdebugSetupEditor({ editors, preferred: 'sublime' }), null); + assert.equal(xdebugSetupEditor({ editors, preferred: 'notepad' }), null); assert.equal(xdebugSetupEditor({ editors, preferred: 'zed' }), null); assert.equal(xdebugSetupEditor({ editors: undefined, preferred: 'vscode' }), null); }); @@ -226,3 +227,30 @@ test('a server with Xdebug gets its Zed config', () => { assert.equal(section.zed, zedDebugConfig({ sitePath: '/sites/wp', serve: { strategy: 'docroot' } })); assert.equal(xdebugSection({ sitePath: '/sites/wp', serve: { strategy: 'docroot' }, setting: true, running: true, startedWith: false }).zed, ''); }); + +// Sublime Text's Debugger package reads `debugger_configurations` from a +// .sublime-project and runs the same Xdebug adapter as VS Code, as "php" +// (#758). The project names the site's folder by its full path, so it works +// saved outside the checkout. +test('the Sublime Text project file opens the site and listens on 127.0.0.1:9003 with the launch.json mapping', () => { + for (const sitePath of ['/sites/wp', 'C:\\sites\\wp']) { + for (const serve of [{ strategy: 'docroot' }, { strategy: 'plugin-mount', pluginSlug: 'gutenberg' }]) { + const project = JSON.parse(sublimeProjectConfig({ sitePath, serve })); + assert.deepEqual(project.folders, [{ path: sitePath }]); + assert.equal(project.debugger_configurations.length, 1); + const [listen] = project.debugger_configurations; + assert.equal(listen.type, 'php'); + assert.equal(listen.request, 'launch'); + assert.equal(listen.port, 9003); + assert.equal(listen.hostname, '127.0.0.1'); + assert.equal(listen.name, 'Listen for Xdebug'); + assert.deepEqual(listen.pathMappings, mappings(xdebugLaunchConfig({ sitePath, serve }))); + } + } +}); + +test('a server with Xdebug gets its Sublime Text project file', () => { + const section = xdebugSection({ sitePath: '/sites/wp', serve: { strategy: 'docroot' }, url: 'http://127.0.0.1:9400/', setting: true, running: true, startedWith: true }); + assert.equal(section.sublime, sublimeProjectConfig({ sitePath: '/sites/wp', serve: { strategy: 'docroot' } })); + assert.equal(xdebugSection({ sitePath: '/sites/wp', serve: { strategy: 'docroot' }, setting: true, running: true, startedWith: false }).sublime, ''); +}); From 7343cbac125e9fecbf69a19c6e28a1d2a11e64ca Mon Sep 17 00:00:00 2001 From: Ryan Welcher Date: Fri, 20 Nov 2026 11:12:49 -0500 Subject: [PATCH 2/7] Say where Sublime Text's Debugger settings are, and that which node is macOS's Preferences: Debugger Settings is a command palette entry the Debugger package adds, not an item in Sublime's Preferences menu, and exists only once the package is installed. which node does not exist on Windows, where restarting Sublime after installing Node is the fix. Also adds Sublime Text to the README's list of editors. --- README.md | 2 +- docs/guide/step-debugging.md | 2 +- src/renderer/components/xdebug-setup-dialog.jsx | 7 ++++--- tests/e2e/journeys/xdebug.spec.js | 7 +++++-- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 475bbf7b..d7654dd7 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Each of these has a page in the user guide. - **[Link a Trac ticket](https://wordpress.github.io/contributor-toolkit/guide/trac-tickets)** to a Core site and read its facts in the app: summary, status and resolution, type, milestone, component, keywords, age. A ticket can also arrive from a browser: the app answers `wpct://ticket/62281` links and offers the ticket to the site you have open. On a Gutenberg site, **[link a GitHub issue](https://wordpress.github.io/contributor-toolkit/guide/gutenberg-issues)** instead, and the app lists the pull requests that cite it. - **[Try the work that already exists on it](https://wordpress.github.io/contributor-toolkit/guide/applying-patches)**: pull requests are checked out on their own branches with the author's commits, on both projects, while on Core `.diff` and `.patch` files are previewed and applied to the current ticket as removable layers. When a patch file will not apply, the app says which regions failed and why, and leaves the checkout untouched. - **[Hold work for several tickets or issues in one site](https://wordpress.github.io/contributor-toolkit/guide/ticket-branches)**. Each one gets its own branch inside the site, so moving between them is a file swap of seconds instead of another clone and another install. -- **[Run the site](https://wordpress.github.io/contributor-toolkit/guide/running-the-site)** and debug it: a [debug log tab](https://wordpress.github.io/contributor-toolkit/guide/logs-and-debugging) with fatals surfaced instead of hidden behind the recovery screen, [the database](https://wordpress.github.io/contributor-toolkit/guide/database), [captured mail](https://wordpress.github.io/contributor-toolkit/guide/mail), [a terminal](https://wordpress.github.io/contributor-toolkit/guide/terminal) using the Node.js runtime the app bundles, and [step debugging with Xdebug](https://wordpress.github.io/contributor-toolkit/guide/step-debugging) in VS Code, Cursor, PhpStorm or Zed. +- **[Run the site](https://wordpress.github.io/contributor-toolkit/guide/running-the-site)** and debug it: a [debug log tab](https://wordpress.github.io/contributor-toolkit/guide/logs-and-debugging) with fatals surfaced instead of hidden behind the recovery screen, [the database](https://wordpress.github.io/contributor-toolkit/guide/database), [captured mail](https://wordpress.github.io/contributor-toolkit/guide/mail), [a terminal](https://wordpress.github.io/contributor-toolkit/guide/terminal) using the Node.js runtime the app bundles, and [step debugging with Xdebug](https://wordpress.github.io/contributor-toolkit/guide/step-debugging) in VS Code, Cursor, PhpStorm, Zed or Sublime Text. - **[Send the change back](https://wordpress.github.io/contributor-toolkit/guide/submitting-changes)**: [a GitHub pull request](https://wordpress.github.io/contributor-toolkit/guide/submit-github-pr) to `wordpress-develop` or `WordPress/gutenberg`, opened through device sign-in with no credential on disk, [a patch attached to Trac](https://wordpress.github.io/contributor-toolkit/guide/submit-trac) (Core only), or [a patch handed to a mentor](https://wordpress.github.io/contributor-toolkit/guide/submit-mentor) that keeps your name on the work. - **[Keep the site current with trunk](https://wordpress.github.io/contributor-toolkit/guide/trunk-updates)** without recreating it, fetching only what changed. diff --git a/docs/guide/step-debugging.md b/docs/guide/step-debugging.md index f1b8e5f0..893b8b22 100644 --- a/docs/guide/step-debugging.md +++ b/docs/guide/step-debugging.md @@ -60,7 +60,7 @@ If Zed says no debug tasks were found, the PHP extension is not installed: Zed l Sublime Text debugs PHP with the **Debugger** package, which needs Node.js installed on your computer. The app does not install Node.js or check for it. -1. Install [Node.js](https://nodejs.org/). If Debugger later says it cannot find node, run `which node` in a terminal, then run **Preferences: Debugger Settings** from the command palette and set `node` to the path it printed. This happens on macOS when you open Sublime Text from the Dock, because it does not get your terminal's `PATH`. +1. Install [Node.js](https://nodejs.org/), then restart Sublime Text. On macOS, if Debugger later says it cannot find node, run `which node` in a terminal. Then, from the command palette, run **Preferences: Debugger Settings** and set `node` to the path it printed. This happens when you open Sublime Text from the Dock, because it does not get your terminal's `PATH`. The command comes with the Debugger package, so it is there only after step 2. 2. Run **Package Control: Install Package** from the command palette, and install **Debugger**. Then run **Debugger: Install Adapters**, and install **PHP**. 3. In the site's details, select **Set up Xdebug for your editor**, choose **Sublime Text**, then select **Copy project file**. 4. Paste it into a new file, and save it with a `.sublime-project` extension outside the site's folder, so it stays out of your patch. The file names the site's folder by its full path, so it works from anywhere. diff --git a/src/renderer/components/xdebug-setup-dialog.jsx b/src/renderer/components/xdebug-setup-dialog.jsx index 95400e61..ccf5b38b 100644 --- a/src/renderer/components/xdebug-setup-dialog.jsx +++ b/src/renderer/components/xdebug-setup-dialog.jsx @@ -117,7 +117,7 @@ function ZedSteps({ config, onCopy }) { function SublimeSteps({ config, onCopy }) { return (
    - Node.js on your computer. The Debugger package runs its PHP adapter with it. If Debugger later says it can’t find node, run which node in a terminal, then run Preferences: Debugger Settings and set node to the path it printed.')} /> + Node.js on your computer, then restart Sublime Text. The Debugger package runs its PHP adapter with it. On macOS, if Debugger later says it can’t find node, run which node in a terminal. Then, from the command palette, run Preferences: Debugger Settings and set node to the path it printed.')} /> Package Control: Install Package from the command palette, and install Debugger. Then run Debugger: Install Adapters, and install PHP.')} /> .sublime-project file outside the site’s folder, so it stays out of your patch, and open it with Project → Open Project:')}>
    @@ -171,8 +171,9 @@ function PhpStormSteps({ values, onCopy }) { * How to stop on breakpoints while the site's server has Xdebug (#723), for * one editor, picked from the Debugging row's menu: VS Code or Cursor, with * the launch.json they need, Zed, with its debug.json, Sublime Text, with its - * project file, or PhpStorm, with the values its settings need. The app shows and copies them, and never writes them into the checkout, where - * they would end up in a patch. + * project file, or PhpStorm, with the values its settings need. The app + * shows and copies them, and never writes them into the checkout, where they + * would end up in a patch. * * @param {Object} props * @param {?Object} props.editor The editor while open, from `xdebugEditors`: `{id, name, setup}`; or null. diff --git a/tests/e2e/journeys/xdebug.spec.js b/tests/e2e/journeys/xdebug.spec.js index a50d36d8..e48d81dd 100644 --- a/tests/e2e/journeys/xdebug.spec.js +++ b/tests/e2e/journeys/xdebug.spec.js @@ -369,8 +369,11 @@ test( 'the setup menu offers the detected editors that have a setup, and no setu await page.getByRole( 'menuitem', { name: 'Sublime Text', exact: true } ).click(); const sublime = page.getByRole( 'dialog', { name: 'Set up Sublime Text', exact: true } ); await expect( sublime ).toBeVisible(); - await expect( sublime.locator( '.xdebug-setup-step' ).first() ).toContainText( 'Install Node.js on your computer.' ); - await expect( sublime.locator( '.xdebug-setup-step' ).first() ).toContainText( 'which node' ); + const nodeStep = sublime.locator( '.xdebug-setup-step' ).first(); + await expect( nodeStep ).toContainText( 'Install Node.js on your computer, then restart Sublime Text.' ); + // INVARIANT — the settings command is named as a command palette entry: + // it is not in Sublime's Preferences menu. + await expect( nodeStep ).toContainText( 'On macOS, if Debugger later says it can’t find node, run which node in a terminal. Then, from the command palette, run Preferences: Debugger Settings' ); const project = JSON.parse( await sublime.locator( '.xdebug-launch-config' ).textContent() ); expect( project.folders ).toEqual( [ { path: site.dir } ] ); expect( project.debugger_configurations[ 0 ] ).toMatchObject( { type: 'php', request: 'launch', port: 9003, hostname: '127.0.0.1' } ); From 60b322527032477d7a5df6644882051c69b2ce73 Mon Sep 17 00:00:00 2001 From: Ryan Welcher Date: Fri, 20 Nov 2026 11:18:02 -0500 Subject: [PATCH 3/7] Say to install Package Control first in Sublime Text's Xdebug setup A fresh Sublime Text has no Package Control, so Package Control: Install Package is not in the command palette. Sublime Text 4's own Install Package Control command adds it. --- docs/guide/step-debugging.md | 2 +- src/renderer/components/xdebug-setup-dialog.jsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/guide/step-debugging.md b/docs/guide/step-debugging.md index 893b8b22..6eccda9a 100644 --- a/docs/guide/step-debugging.md +++ b/docs/guide/step-debugging.md @@ -61,7 +61,7 @@ If Zed says no debug tasks were found, the PHP extension is not installed: Zed l Sublime Text debugs PHP with the **Debugger** package, which needs Node.js installed on your computer. The app does not install Node.js or check for it. 1. Install [Node.js](https://nodejs.org/), then restart Sublime Text. On macOS, if Debugger later says it cannot find node, run `which node` in a terminal. Then, from the command palette, run **Preferences: Debugger Settings** and set `node` to the path it printed. This happens when you open Sublime Text from the Dock, because it does not get your terminal's `PATH`. The command comes with the Debugger package, so it is there only after step 2. -2. Run **Package Control: Install Package** from the command palette, and install **Debugger**. Then run **Debugger: Install Adapters**, and install **PHP**. +2. If you have not used Package Control before, run **Install Package Control** from the command palette first. Then run **Package Control: Install Package**, and install **Debugger**. Then run **Debugger: Install Adapters**, and install **PHP**. 3. In the site's details, select **Set up Xdebug for your editor**, choose **Sublime Text**, then select **Copy project file**. 4. Paste it into a new file, and save it with a `.sublime-project` extension outside the site's folder, so it stays out of your patch. The file names the site's folder by its full path, so it works from anywhere. 5. Open it with **Project → Open Project**. diff --git a/src/renderer/components/xdebug-setup-dialog.jsx b/src/renderer/components/xdebug-setup-dialog.jsx index ccf5b38b..93ae47e8 100644 --- a/src/renderer/components/xdebug-setup-dialog.jsx +++ b/src/renderer/components/xdebug-setup-dialog.jsx @@ -118,7 +118,7 @@ function SublimeSteps({ config, onCopy }) { return (
      Node.js on your computer, then restart Sublime Text. The Debugger package runs its PHP adapter with it. On macOS, if Debugger later says it can’t find node, run which node in a terminal. Then, from the command palette, run Preferences: Debugger Settings and set node to the path it printed.')} /> - Package Control: Install Package from the command palette, and install Debugger. Then run Debugger: Install Adapters, and install PHP.')} /> + Install Package Control from the command palette first. Then run Package Control: Install Package, and install Debugger. Then run Debugger: Install Adapters, and install PHP.')} /> .sublime-project file outside the site’s folder, so it stays out of your patch, and open it with Project → Open Project:')}>
      {config}
      From 2a4c52e1b9378a28035bfec9f133b51f7c97cf7a Mon Sep 17 00:00:00 2001 From: Ryan Welcher Date: Fri, 20 Nov 2026 11:22:46 -0500 Subject: [PATCH 4/7] Keep Sublime Text's project file in the site's folder, out of the patch The Xdebug setup asked for the .sublime-project to be saved outside the site's folder. It now goes in the site's folder, like VS Code's and Zed's files, and opens it as '.'. A block of its own in .git/info/exclude keeps *.sublime-project and the .sublime-workspace Sublime writes beside it out of a patch, so sites seeded before this get it too. --- docs/guide/step-debugging.md | 2 +- src/main.js | 16 ++++++++-- .../components/xdebug-setup-dialog.jsx | 2 +- src/renderer/xdebug.cjs | 8 ++--- tests/e2e/journeys/xdebug.spec.js | 2 +- tests/unit/ipc-wiring.test.cjs | 31 +++++++++++++++++++ tests/unit/xdebug.test.cjs | 5 ++- 7 files changed, 54 insertions(+), 12 deletions(-) diff --git a/docs/guide/step-debugging.md b/docs/guide/step-debugging.md index 6eccda9a..7bfb303c 100644 --- a/docs/guide/step-debugging.md +++ b/docs/guide/step-debugging.md @@ -63,7 +63,7 @@ Sublime Text debugs PHP with the **Debugger** package, which needs Node.js insta 1. Install [Node.js](https://nodejs.org/), then restart Sublime Text. On macOS, if Debugger later says it cannot find node, run `which node` in a terminal. Then, from the command palette, run **Preferences: Debugger Settings** and set `node` to the path it printed. This happens when you open Sublime Text from the Dock, because it does not get your terminal's `PATH`. The command comes with the Debugger package, so it is there only after step 2. 2. If you have not used Package Control before, run **Install Package Control** from the command palette first. Then run **Package Control: Install Package**, and install **Debugger**. Then run **Debugger: Install Adapters**, and install **PHP**. 3. In the site's details, select **Set up Xdebug for your editor**, choose **Sublime Text**, then select **Copy project file**. -4. Paste it into a new file, and save it with a `.sublime-project` extension outside the site's folder, so it stays out of your patch. The file names the site's folder by its full path, so it works from anywhere. +4. Paste it into a new file, and save it in the site's folder with a `.sublime-project` extension. The app keeps it out of your patch. 5. Open it with **Project → Open Project**. 6. Run **Debugger: Open**, start **Listen for Xdebug**, set a breakpoint, and load a page of the site in the browser. diff --git a/src/main.js b/src/main.js index 8bf29cd4..f1b37e60 100644 --- a/src/main.js +++ b/src/main.js @@ -128,6 +128,16 @@ const EDITOR_EXCLUDES = [ '/.nova/' ]; +// Sublime Text keeps a project in a file rather than a folder, and writes a +// .sublime-workspace beside it. The Xdebug setup asks for one in the site's +// folder (#758). A block of its own for the reason above: a site seeded +// before this has the editor block already. +const SUBLIME_EXCLUDES_MARKER = '# WordPress Contributor Toolkit Sublime Text'; +const SUBLIME_EXCLUDES = [ + '/*.sublime-project', + '/*.sublime-workspace' +]; + /** * Seeds per-site ignores for machine-local files that must never become part * of a contribution. This lives in `.git/info/exclude`, not the repository's @@ -157,11 +167,13 @@ async function ensureLocalExcludes(dir) { // Playground CLI links its VFS root into the folder the server runs from, // which for a plugin-mount site is the checkout, and leaves the link behind // when the server stops. The launch.json and debug.json the editor setups - // ask for are under the editor folders excluded below. + // ask for are under the editor folders excluded below, and the Sublime Text + // project file is in a block of its own. await appendExcludeBlock(dir, '# WordPress Contributor Toolkit Xdebug', ['/.playground-xdebug-root'], { once: true }); const agents = await appendExcludeBlock(dir, LOCAL_EXCLUDES_MARKER, LOCAL_EXCLUDES, { once: true }); const editors = await appendExcludeBlock(dir, EDITOR_EXCLUDES_MARKER, EDITOR_EXCLUDES, { once: true }); - return agents || editors; + const sublime = await appendExcludeBlock(dir, SUBLIME_EXCLUDES_MARKER, SUBLIME_EXCLUDES, { once: true }); + return agents || editors || sublime; } // Screenshot harness only (scripts/screenshots/): point userData at a throwaway diff --git a/src/renderer/components/xdebug-setup-dialog.jsx b/src/renderer/components/xdebug-setup-dialog.jsx index 93ae47e8..2490164b 100644 --- a/src/renderer/components/xdebug-setup-dialog.jsx +++ b/src/renderer/components/xdebug-setup-dialog.jsx @@ -119,7 +119,7 @@ function SublimeSteps({ config, onCopy }) {
        Node.js on your computer, then restart Sublime Text. The Debugger package runs its PHP adapter with it. On macOS, if Debugger later says it can’t find node, run which node in a terminal. Then, from the command palette, run Preferences: Debugger Settings and set node to the path it printed.')} /> Install Package Control from the command palette first. Then run Package Control: Install Package, and install Debugger. Then run Debugger: Install Adapters, and install PHP.')} /> - .sublime-project file outside the site’s folder, so it stays out of your patch, and open it with Project → Open Project:')}> + .sublime-project file. Then open that file with Project → Open Project:')}>
        {config}
        diff --git a/src/renderer/xdebug.cjs b/src/renderer/xdebug.cjs index c4734fb7..2b088cb1 100644 --- a/src/renderer/xdebug.cjs +++ b/src/renderer/xdebug.cjs @@ -70,9 +70,9 @@ function zedDebugConfig({ sitePath, serve }) { * The .sublime-project a contributor saves for Sublime Text's Debugger * package, which runs the same Xdebug adapter as VS Code's PHP Debug, as * "php", and reads its setups from `debugger_configurations` in the project - * file. The project names the site's folder by its full path, so the file - * works wherever it is saved, and is saved outside the checkout, where it - * would otherwise end up in a patch. + * file. It is saved in the site's folder, like the other editors' files, so + * the folder it opens is that one; the site's `.git/info/exclude` keeps it, + * and the .sublime-workspace Sublime writes beside it, out of a patch. * * @param {Object} root0 * @param {string} root0.sitePath The checkout's folder, in this platform's form. @@ -82,7 +82,7 @@ function zedDebugConfig({ sitePath, serve }) { function sublimeProjectConfig({ sitePath, serve }) { const { server, local } = xdebugMapping({ sitePath, serve }); return JSON.stringify({ - folders: [{ path: sitePath }], + folders: [{ path: '.' }], debugger_configurations: [ { name: 'Listen for Xdebug', type: 'php', request: 'launch', hostname: XDEBUG_HOST, port: XDEBUG_PORT, pathMappings: { [server]: local } } ] diff --git a/tests/e2e/journeys/xdebug.spec.js b/tests/e2e/journeys/xdebug.spec.js index e48d81dd..149c01dc 100644 --- a/tests/e2e/journeys/xdebug.spec.js +++ b/tests/e2e/journeys/xdebug.spec.js @@ -375,7 +375,7 @@ test( 'the setup menu offers the detected editors that have a setup, and no setu // it is not in Sublime's Preferences menu. await expect( nodeStep ).toContainText( 'On macOS, if Debugger later says it can’t find node, run which node in a terminal. Then, from the command palette, run Preferences: Debugger Settings' ); const project = JSON.parse( await sublime.locator( '.xdebug-launch-config' ).textContent() ); - expect( project.folders ).toEqual( [ { path: site.dir } ] ); + expect( project.folders ).toEqual( [ { path: '.' } ] ); expect( project.debugger_configurations[ 0 ] ).toMatchObject( { type: 'php', request: 'launch', port: 9003, hostname: '127.0.0.1' } ); expect( project.debugger_configurations[ 0 ].pathMappings ).toEqual( { '/wordpress': path.join( site.dir, 'src' ) } ); await expect( sublime.getByRole( 'button', { name: 'Copy project file', exact: true } ) ).toBeVisible(); diff --git a/tests/unit/ipc-wiring.test.cjs b/tests/unit/ipc-wiring.test.cjs index d8ed6c8b..41720c32 100644 --- a/tests/unit/ipc-wiring.test.cjs +++ b/tests/unit/ipc-wiring.test.cjs @@ -1931,6 +1931,37 @@ test('site:status excludes editor folders from a site seeded before they were ad assert.equal(exclude.split('# WordPress Contributor Toolkit local excludes').length - 1, 1, 'the agent block is not written again'); }); +// The Xdebug setup for Sublime Text asks for a .sublime-project in the site's +// folder (#758). A site seeded before then has the editor block, written only +// once, so the project file arrives in a block of its own. +test('site:status excludes a Sublime Text project from a site seeded before it was added (issue #758)', async (t) => { + const dir = adoptedRepo(t, 'ipc-wiring-sublime-exclude-'); + fs.writeFileSync(path.join(dir, 'README.md'), 'managed wordpress-develop site\n'); + commitFiles(dir, ['README.md'], 'init'); + fs.writeFileSync(path.join(dir, '.git', 'info', 'exclude'), '# WordPress Contributor Toolkit local excludes\n/.claude/\n# WordPress Contributor Toolkit editor folders\n/.vscode/\n'); + fs.writeFileSync(path.join(dir, 'wordpress.sublime-project'), '{}\n'); + fs.writeFileSync(path.join(dir, 'wordpress.sublime-workspace'), '{}\n'); + fs.appendFileSync(path.join(dir, 'README.md'), 'real contributor edit\n'); + + const main = loadMain({ + stubs: { + ...silentLogging(), + ...fakeSettingsStore({ sites: [dir], siteMeta: { [dir]: {} } }).stubs + } + }); + await main.invoke('site:status', dir); + const result = await main.invoke('git:get-patch', dir); + + assert.equal(result.ok, true); + assert.match(result.patch, /README\.md/, 'the contributor\'s WordPress change stays visible'); + assert.doesNotMatch(result.patch, /sublime-project/); + assert.doesNotMatch(result.patch, /sublime-workspace/); + + await main.invoke('site:status', dir); + const exclude = fs.readFileSync(path.join(dir, '.git', 'info', 'exclude'), 'utf8'); + assert.equal(exclude.split('# WordPress Contributor Toolkit Sublime Text').length - 1, 1, 'the Sublime Text block is added only once'); +}); + // --- what the patch says about deletions, additions and binaries (#85) --- // A repository with a committed base, for the generation tests below. Returns diff --git a/tests/unit/xdebug.test.cjs b/tests/unit/xdebug.test.cjs index c1f2071c..5c5868e9 100644 --- a/tests/unit/xdebug.test.cjs +++ b/tests/unit/xdebug.test.cjs @@ -230,13 +230,12 @@ test('a server with Xdebug gets its Zed config', () => { // Sublime Text's Debugger package reads `debugger_configurations` from a // .sublime-project and runs the same Xdebug adapter as VS Code, as "php" -// (#758). The project names the site's folder by its full path, so it works -// saved outside the checkout. +// (#758). The file is saved in the site's folder, so it opens that folder. test('the Sublime Text project file opens the site and listens on 127.0.0.1:9003 with the launch.json mapping', () => { for (const sitePath of ['/sites/wp', 'C:\\sites\\wp']) { for (const serve of [{ strategy: 'docroot' }, { strategy: 'plugin-mount', pluginSlug: 'gutenberg' }]) { const project = JSON.parse(sublimeProjectConfig({ sitePath, serve })); - assert.deepEqual(project.folders, [{ path: sitePath }]); + assert.deepEqual(project.folders, [{ path: '.' }]); assert.equal(project.debugger_configurations.length, 1); const [listen] = project.debugger_configurations; assert.equal(listen.type, 'php'); From da6c589d3129ac469451f267f1e08095ad077e21 Mon Sep 17 00:00:00 2001 From: Ryan Welcher Date: Fri, 20 Nov 2026 11:35:47 -0500 Subject: [PATCH 5/7] Link to the Debugger package's guide for setting up Sublime Text The Sublime Text Xdebug setup walked through installing Package Control, the Debugger package, its PHP adapter and Node.js, and how to fix Node not being found. That is the package's to explain, so the dialog now says what the package needs, links to its setup guide, and keeps only this site's project file and how to start it. The file now has a name, xdebug.sublime-project, since a file named only .sublime-project is hidden on macOS and Open Project cannot choose it. The last step says to choose Listen for Xdebug when play asks, since the Debugger selects no configuration by itself. --- docs/guide/step-debugging.md | 14 +++--- .../components/xdebug-setup-dialog.jsx | 43 +++++++++++-------- src/renderer/xdebug.cjs | 4 +- tests/e2e/journeys/xdebug.spec.js | 22 +++++++--- 4 files changed, 48 insertions(+), 35 deletions(-) diff --git a/docs/guide/step-debugging.md b/docs/guide/step-debugging.md index 7bfb303c..18517e01 100644 --- a/docs/guide/step-debugging.md +++ b/docs/guide/step-debugging.md @@ -58,14 +58,12 @@ If Zed says no debug tasks were found, the PHP extension is not installed: Zed l ## Connect Sublime Text -Sublime Text debugs PHP with the **Debugger** package, which needs Node.js installed on your computer. The app does not install Node.js or check for it. - -1. Install [Node.js](https://nodejs.org/), then restart Sublime Text. On macOS, if Debugger later says it cannot find node, run `which node` in a terminal. Then, from the command palette, run **Preferences: Debugger Settings** and set `node` to the path it printed. This happens when you open Sublime Text from the Dock, because it does not get your terminal's `PATH`. The command comes with the Debugger package, so it is there only after step 2. -2. If you have not used Package Control before, run **Install Package Control** from the command palette first. Then run **Package Control: Install Package**, and install **Debugger**. Then run **Debugger: Install Adapters**, and install **PHP**. -3. In the site's details, select **Set up Xdebug for your editor**, choose **Sublime Text**, then select **Copy project file**. -4. Paste it into a new file, and save it in the site's folder with a `.sublime-project` extension. The app keeps it out of your patch. -5. Open it with **Project → Open Project**. -6. Run **Debugger: Open**, start **Listen for Xdebug**, set a breakpoint, and load a page of the site in the browser. +Sublime Text debugs PHP with the **Debugger** package and its PHP adapter, which needs [Node.js](https://nodejs.org/) installed on your computer. If you have not set them up, follow the [Debugger package's setup guide](https://github.com/daveleroy/SublimeDebugger). The app does not install Node.js or check for it. + +1. In the site's details, select **Set up Xdebug for your editor**, choose **Sublime Text**, then select **Copy project file**. +2. Save it in the site's folder as `xdebug.sublime-project`, and open it with **Project → Open Project**. The app keeps it out of your patch. +3. Press the Debugger's play button, choose **Listen for Xdebug**, then press play again. +4. Set a breakpoint, and load a page of the site in the browser. Like the launch.json, the project file listens on `127.0.0.1` only. diff --git a/src/renderer/components/xdebug-setup-dialog.jsx b/src/renderer/components/xdebug-setup-dialog.jsx index 2490164b..a735aeb4 100644 --- a/src/renderer/components/xdebug-setup-dialog.jsx +++ b/src/renderer/components/xdebug-setup-dialog.jsx @@ -1,5 +1,6 @@ import { useCallback, useEffect, useId, useRef, useState } from 'react'; import { speak } from '@wordpress/a11y'; +import { Button as LinkButton } from '@wordpress/components'; import { createInterpolateElement } from '@wordpress/element'; import { __, sprintf } from '@wordpress/i18n'; import { check as checkIcon, copy as copyIcon, error as errorIcon } from '@wordpress/icons'; @@ -109,26 +110,32 @@ function ZedSteps({ config, onCopy }) { ); } -// Sublime Text debugs PHP with the Debugger package, which runs its Xdebug -// adapter on a Node.js installed on the computer (#758). Node comes first, so -// nobody finds out after the rest. The app does not look for Node itself: a -// Sublime opened from the Dock on macOS does not get the shell's PATH, so the -// app's answer could differ from the package's. +// Sublime Text debugs PHP with the Debugger package, a third-party package +// whose setup, and what to do when it fails, is its own README's to say +// (#758). The dialog gives only what this site needs. Its README does not +// say the PHP adapter needs Node.js, so the dialog does. +const SUBLIME_DEBUGGER_URL = 'https://github.com/daveleroy/SublimeDebugger'; + function SublimeSteps({ config, onCopy }) { + const link = window.api.openExternal(SUBLIME_DEBUGGER_URL)} />; return ( -
          - Node.js on your computer, then restart Sublime Text. The Debugger package runs its PHP adapter with it. On macOS, if Debugger later says it can’t find node, run which node in a terminal. Then, from the command palette, run Preferences: Debugger Settings and set node to the path it printed.')} /> - Install Package Control from the command palette first. Then run Package Control: Install Package, and install Debugger. Then run Debugger: Install Adapters, and install PHP.')} /> - .sublime-project file. Then open that file with Project → Open Project:')}> -
          -
          {config}
          - - - -
          -
          - Debugger: Open, start “Listen for Xdebug”, set a breakpoint, and load the site.')} /> -
        + <> + {createInterpolateElement( + __('Sublime Text debugs PHP with the Debugger package and its PHP adapter, which needs Node.js. If you haven’t set them up, follow the Debugger package’s setup guide.'), + { ...STEP_MARKUP, link } + )} +
          + xdebug.sublime-project, and open it with Project → Open Project:')}> +
          +
          {config}
          + + + +
          +
          + +
        + ); } diff --git a/src/renderer/xdebug.cjs b/src/renderer/xdebug.cjs index 2b088cb1..b6cbf22f 100644 --- a/src/renderer/xdebug.cjs +++ b/src/renderer/xdebug.cjs @@ -217,8 +217,8 @@ function xdebugHolder({ sitePath, servers }) { /** * The editors the setup menu offers: those found on this machine that have a * setup, in this order. Cursor reads VS Code's launch.json, so it gets that - * setup under its own name. Sublime Text's needs Node.js on the computer, - * which its steps say first (#758). With none found that has a setup, there + * setup under its own name. Sublime Text's Debugger package needs Node.js + * on the computer, which its setup says (#758). With none found that has a setup, there * is nothing to set up, and the list is empty. * * @param {Array<{id: string}>} [detected] From `editor:list`. diff --git a/tests/e2e/journeys/xdebug.spec.js b/tests/e2e/journeys/xdebug.spec.js index 149c01dc..9f19ef75 100644 --- a/tests/e2e/journeys/xdebug.spec.js +++ b/tests/e2e/journeys/xdebug.spec.js @@ -363,17 +363,25 @@ test( 'the setup menu offers the detected editors that have a setup, and no setu await expect( zed ).toHaveCount( 0 ); // INVARIANT — Sublime Text's is a .sublime-project for the Debugger - // package's PHP adapter, with the same listener and mapping, and its first - // step is the Node.js the package needs, before anything else is done. + // package's PHP adapter, with the same listener and mapping. Setting the + // package up is its own guide's to say; the dialog links to it and names + // the Node.js that guide leaves out. await setup.click(); await page.getByRole( 'menuitem', { name: 'Sublime Text', exact: true } ).click(); const sublime = page.getByRole( 'dialog', { name: 'Set up Sublime Text', exact: true } ); await expect( sublime ).toBeVisible(); - const nodeStep = sublime.locator( '.xdebug-setup-step' ).first(); - await expect( nodeStep ).toContainText( 'Install Node.js on your computer, then restart Sublime Text.' ); - // INVARIANT — the settings command is named as a command palette entry: - // it is not in Sublime's Preferences menu. - await expect( nodeStep ).toContainText( 'On macOS, if Debugger later says it can’t find node, run which node in a terminal. Then, from the command palette, run Preferences: Debugger Settings' ); + await expect( sublime ).toContainText( 'Sublime Text debugs PHP with the Debugger package and its PHP adapter, which needs Node.js.' ); + // The link opens the guide in the browser; the function that would open it + // records the address instead. + await app.evaluate( ( { shell } ) => { + global.e2eOpened = []; + shell.openExternal = async ( url ) => { global.e2eOpened.push( url ); }; + } ); + await sublime.getByRole( 'button', { name: 'Debugger package’s setup guide', exact: true } ).click(); + await expect.poll( () => app.evaluate( () => global.e2eOpened ) ).toEqual( [ 'https://github.com/daveleroy/SublimeDebugger' ] ); + // INVARIANT — the file has a name before its extension: a file named only + // .sublime-project is hidden on macOS, and Open Project cannot choose it. + await expect( sublime.locator( '.xdebug-setup-step' ).first() ).toContainText( 'Save this in the site’s folder as xdebug.sublime-project' ); const project = JSON.parse( await sublime.locator( '.xdebug-launch-config' ).textContent() ); expect( project.folders ).toEqual( [ { path: '.' } ] ); expect( project.debugger_configurations[ 0 ] ).toMatchObject( { type: 'php', request: 'launch', port: 9003, hostname: '127.0.0.1' } ); From c7c9f4e2223f599139cb72a698149099681fe4d7 Mon Sep 17 00:00:00 2001 From: Ryan Welcher Date: Fri, 20 Nov 2026 11:43:12 -0500 Subject: [PATCH 6/7] Say what the Sublime Text setup leaves to the Debugger package, accurately The comment said the package's README covers what to do when its setup fails. It does not cover the node setting that fixes a Sublime opened from the Dock not finding Node, which the dialog leaves out on purpose. --- src/renderer/components/xdebug-setup-dialog.jsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/renderer/components/xdebug-setup-dialog.jsx b/src/renderer/components/xdebug-setup-dialog.jsx index a735aeb4..cf92fcea 100644 --- a/src/renderer/components/xdebug-setup-dialog.jsx +++ b/src/renderer/components/xdebug-setup-dialog.jsx @@ -111,9 +111,12 @@ function ZedSteps({ config, onCopy }) { } // Sublime Text debugs PHP with the Debugger package, a third-party package -// whose setup, and what to do when it fails, is its own README's to say -// (#758). The dialog gives only what this site needs. Its README does not -// say the PHP adapter needs Node.js, so the dialog does. +// whose setup is its own README's to say (#758). The dialog gives only what +// this site needs, and names the Node.js the PHP adapter needs, which the +// README does not. It deliberately leaves out the fix for a Sublime opened +// from the macOS Dock not finding an nvm or Homebrew Node (the package's +// `node` setting): the README does not cover that either, and the app does +// not troubleshoot a third-party package. const SUBLIME_DEBUGGER_URL = 'https://github.com/daveleroy/SublimeDebugger'; function SublimeSteps({ config, onCopy }) { From f84227099f91e1e6203f691a3f321cb9f18163d2 Mon Sep 17 00:00:00 2001 From: Ryan Welcher Date: Mon, 23 Nov 2026 11:35:42 -0500 Subject: [PATCH 7/7] Make the Sublime Text setup guide a real link, and list the new excludes The guide was a link-styled button with no address, announced as a button. ExternalLink renders an anchor with the address and says it opens in a new tab; the click still goes through url:open. Also names the Sublime Text block where the docs and comments list the app's excludes. --- docs/guide/editors.md | 2 +- src/exclude-file.cjs | 3 ++- src/main.js | 5 +++-- src/renderer/components/xdebug-setup-dialog.jsx | 11 +++++++++-- src/renderer/xdebug.cjs | 4 ++-- tests/e2e/journeys/xdebug.spec.js | 4 +++- 6 files changed, 20 insertions(+), 9 deletions(-) diff --git a/docs/guide/editors.md b/docs/guide/editors.md index 8918e4fb..3ce904a3 100644 --- a/docs/guide/editors.md +++ b/docs/guide/editors.md @@ -32,7 +32,7 @@ The **Changed files** section of the site's details lists, as folder trees, the - With **Ask each time**, a menu labelled **Open in** opens next to the file, with the same editors and **Other application…**. Press Escape to close it without opening anything. - If the app found no editor, the file is shown in your file manager. -Folders that editors create for their own settings are not listed: `.idea`, `.vscode`, `.vs`, `.fleet`, `.zed` and `.nova`. The app adds them to the site's local Git excludes (`.git/info/exclude`), so they also stay out of your patch. If you remove a rule from that file, the app does not add it again. A file that the project itself tracks in one of these folders, such as Gutenberg's own `.vscode` files, is still listed when you change it. +Folders that editors create for their own settings are not listed: `.idea`, `.vscode`, `.vs`, `.fleet`, `.zed` and `.nova`. The app adds them to the site's local Git excludes (`.git/info/exclude`), so they also stay out of your patch. If you remove a rule from that file, the app does not add it again. A file that the project itself tracks in one of these folders, such as Gutenberg's own `.vscode` files, is still listed when you change it. Sublime Text project files at the top of the site's folder, `*.sublime-project` and the `*.sublime-workspace` beside each, are left out the same way, in a block of their own. ## How detection works diff --git a/src/exclude-file.cjs b/src/exclude-file.cjs index f4501a83..63c42948 100644 --- a/src/exclude-file.cjs +++ b/src/exclude-file.cjs @@ -3,7 +3,8 @@ /** * The one writer of the app's blocks in a site's `.git/info/exclude` (#523): * the machine-local excludes and the generated Gutenberg download main.js - * seeds (#19), the editor folders (#737), and the files another branch + * seeds (#19), the editor folders (#737), the link Xdebug leaves (#723), + * Sublime Text's project files (#758), and the files another branch * ignored that a switch leaves behind (#521). No Electron, so * ticket-branches.js can use it too. * diff --git a/src/main.js b/src/main.js index f1b37e60..a78dee41 100644 --- a/src/main.js +++ b/src/main.js @@ -149,8 +149,9 @@ const SUBLIME_EXCLUDES = [ * Existing rules above or below the block are never rewritten. * * @param {string} dir Repository working directory. - * @return {Promise} Whether the agent or editor block was appended; - * the Gutenberg block is not counted. + * @return {Promise} Whether the agent, editor or Sublime Text block + * was appended; the Gutenberg and Xdebug blocks + * are not counted. */ async function ensureLocalExcludes(dir) { const gitDir = path.join(dir, '.git'); diff --git a/src/renderer/components/xdebug-setup-dialog.jsx b/src/renderer/components/xdebug-setup-dialog.jsx index cf92fcea..54649438 100644 --- a/src/renderer/components/xdebug-setup-dialog.jsx +++ b/src/renderer/components/xdebug-setup-dialog.jsx @@ -1,6 +1,6 @@ import { useCallback, useEffect, useId, useRef, useState } from 'react'; import { speak } from '@wordpress/a11y'; -import { Button as LinkButton } from '@wordpress/components'; +import { ExternalLink } from '@wordpress/components'; import { createInterpolateElement } from '@wordpress/element'; import { __, sprintf } from '@wordpress/i18n'; import { check as checkIcon, copy as copyIcon, error as errorIcon } from '@wordpress/icons'; @@ -120,7 +120,14 @@ function ZedSteps({ config, onCopy }) { const SUBLIME_DEBUGGER_URL = 'https://github.com/daveleroy/SublimeDebugger'; function SublimeSteps({ config, onCopy }) { - const link = window.api.openExternal(SUBLIME_DEBUGGER_URL)} />; + // A real link, so it is announced as one and its address can be copied; + // the browser opens it, not the window. + const link = ( + { event.preventDefault(); window.api.openExternal(SUBLIME_DEBUGGER_URL); }} + /> + ); return ( <> {createInterpolateElement( diff --git a/src/renderer/xdebug.cjs b/src/renderer/xdebug.cjs index b6cbf22f..0c2c0935 100644 --- a/src/renderer/xdebug.cjs +++ b/src/renderer/xdebug.cjs @@ -218,8 +218,8 @@ function xdebugHolder({ sitePath, servers }) { * The editors the setup menu offers: those found on this machine that have a * setup, in this order. Cursor reads VS Code's launch.json, so it gets that * setup under its own name. Sublime Text's Debugger package needs Node.js - * on the computer, which its setup says (#758). With none found that has a setup, there - * is nothing to set up, and the list is empty. + * on the computer, which its setup says (#758). With none found that has a + * setup, there is nothing to set up, and the list is empty. * * @param {Array<{id: string}>} [detected] From `editor:list`. * @return {Array<{id: string, name: string, setup: string}>} `setup` is 'vscode', 'phpstorm', 'zed' or 'sublime'. diff --git a/tests/e2e/journeys/xdebug.spec.js b/tests/e2e/journeys/xdebug.spec.js index 9f19ef75..b77d6023 100644 --- a/tests/e2e/journeys/xdebug.spec.js +++ b/tests/e2e/journeys/xdebug.spec.js @@ -377,7 +377,9 @@ test( 'the setup menu offers the detected editors that have a setup, and no setu global.e2eOpened = []; shell.openExternal = async ( url ) => { global.e2eOpened.push( url ); }; } ); - await sublime.getByRole( 'button', { name: 'Debugger package’s setup guide', exact: true } ).click(); + const guide = sublime.getByRole( 'link', { name: /^Debugger package’s setup guide/ } ); + await expect( guide ).toHaveAttribute( 'href', 'https://github.com/daveleroy/SublimeDebugger' ); + await guide.click(); await expect.poll( () => app.evaluate( () => global.e2eOpened ) ).toEqual( [ 'https://github.com/daveleroy/SublimeDebugger' ] ); // INVARIANT — the file has a name before its extension: a file named only // .sublime-project is hidden on macOS, and Open Project cannot choose it.