Skip to content

Commit 190758e

Browse files
authored
[DevTools] Add column to vscode editor preset (facebook#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.
1 parent b1a6f03 commit 190758e

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

packages/react-devtools-shared/src/devtools/views/Editor/utils.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export function checkConditions(
1616
try {
1717
const url = new URL(editorURL);
1818

19-
const [, sourceURL, line] = source;
19+
const [, sourceURL, line, column] = source;
2020
let filePath;
2121

2222
// Check if sourceURL is a correct URL, which has a protocol specified
@@ -47,12 +47,15 @@ export function checkConditions(
4747
}
4848

4949
const lineNumberAsString = String(line);
50+
const columnNumberAsString = String(column);
5051

5152
url.href = url.href
5253
.replace('{path}', filePath)
5354
.replace('{line}', lineNumberAsString)
55+
.replace('{column}', columnNumberAsString)
5456
.replace('%7Bpath%7D', filePath)
55-
.replace('%7Bline%7D', lineNumberAsString);
57+
.replace('%7Bline%7D', lineNumberAsString)
58+
.replace('%7Bcolumn%7D', columnNumberAsString);
5659

5760
return {url, shouldDisableButton: false};
5861
} catch (e) {

packages/react-devtools-shared/src/devtools/views/Settings/CodeEditorOptions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {getDefaultOpenInEditorURL} from 'react-devtools-shared/src/utils';
1717

1818
import styles from './SettingsShared.css';
1919

20-
const vscodeFilepath = 'vscode://file/{path}:{line}';
20+
const vscodeFilepath = 'vscode://file/{path}:{line}:{column}';
2121

2222
export default function CodeEditorOptions({
2323
environmentNames,

0 commit comments

Comments
 (0)