[DevTools] Add column to vscode editor preset (#33994)

We should jump to the right column.

Unfortunately, the way presets are set up now you have to switch off and
switch to the preset for this to take effect.
This commit is contained in:
Sebastian Markbåge 2025-07-25 10:21:00 -04:00 committed by GitHub
parent b1a6f03f8a
commit 190758e623
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 3 deletions

View File

@ -16,7 +16,7 @@ export function checkConditions(
try { try {
const url = new URL(editorURL); const url = new URL(editorURL);
const [, sourceURL, line] = source; const [, sourceURL, line, column] = source;
let filePath; let filePath;
// Check if sourceURL is a correct URL, which has a protocol specified // Check if sourceURL is a correct URL, which has a protocol specified
@ -47,12 +47,15 @@ export function checkConditions(
} }
const lineNumberAsString = String(line); const lineNumberAsString = String(line);
const columnNumberAsString = String(column);
url.href = url.href url.href = url.href
.replace('{path}', filePath) .replace('{path}', filePath)
.replace('{line}', lineNumberAsString) .replace('{line}', lineNumberAsString)
.replace('{column}', columnNumberAsString)
.replace('%7Bpath%7D', filePath) .replace('%7Bpath%7D', filePath)
.replace('%7Bline%7D', lineNumberAsString); .replace('%7Bline%7D', lineNumberAsString)
.replace('%7Bcolumn%7D', columnNumberAsString);
return {url, shouldDisableButton: false}; return {url, shouldDisableButton: false};
} catch (e) { } catch (e) {

View File

@ -17,7 +17,7 @@ import {getDefaultOpenInEditorURL} from 'react-devtools-shared/src/utils';
import styles from './SettingsShared.css'; import styles from './SettingsShared.css';
const vscodeFilepath = 'vscode://file/{path}:{line}'; const vscodeFilepath = 'vscode://file/{path}:{line}:{column}';
export default function CodeEditorOptions({ export default function CodeEditorOptions({
environmentNames, environmentNames,