You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working in a vscode extension and I would like to open a file with the cursor in a given line (just as the -g flag of the command line tool). I've been looking at the API commands and I don't see any command that does this.
The solution that I was looking at was the following:
but the workbench.action.gotoLine only opens the Go to Line dialog. Is there any support for this feature in the API? or can this command be modified so that if a line number is provided as an argument it automatically jumps to the line?
Thanks!
The text was updated successfully, but these errors were encountered:
let editor = vscode.window.activeTextEditor;
let range = editor.document.lineAt(lineNumber-1).range;
editor.selection = new vscode.Selection(range.start, range.end);
editor.revealRange(range);
I'm working in a vscode extension and I would like to open a file with the cursor in a given line (just as the
-g
flag of the command line tool). I've been looking at the API commands and I don't see any command that does this.The solution that I was looking at was the following:
but the
workbench.action.gotoLine
only opens theGo to Line
dialog. Is there any support for this feature in the API? or can this command be modified so that if a line number is provided as an argument it automatically jumps to the line?Thanks!
The text was updated successfully, but these errors were encountered: