-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #1655: Extends gf to line numbers #1708
Conversation
src/cmd_line/commands/file.ts
Outdated
@@ -85,6 +86,19 @@ export class FileCommand extends node.CommandBase { | |||
let folder = vscode.Uri.file(newFilePath); | |||
await vscode.commands.executeCommand("vscode.open", folder, | |||
this._arguments.position === FilePosition.NewWindow ? this.getViewColumnToRight() : this.getActiveViewColumn()); | |||
|
|||
await vscode.commands.executeCommand("cursorMove", { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do we handle the :50 command? This should be done the same way, this hack should not be necessary for sure... There should also be a vscode command to go to line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do :50
to open a new file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, go to line. The file action looks good to me, then jumping to the right line needs to be cleaned up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's no problem to do :50
in the same file, as we can just move the cursor ourselves. The problem is that once we call the API to open a new file, we don't have access to the new modeHandler yet, in this file.
Come to think of it though, there was another part of the code where we might have needed to do something similar. I'll take a look at that later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about a vscode command to go to line?
src/cmd_line/commands/file.ts
Outdated
|
||
if (this.arguments.lineNumber) { | ||
vscode.window.activeTextEditor!.revealRange(new vscode.Range(new vscode.Position(this.arguments.lineNumber, 0), new vscode.Position(this.arguments.lineNumber, 0))); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is probably better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it sure is
Thanks! |
Pretty simple, mostly. One thing to note is that I'm not sure what's the best way of setting cursor position after we change files. Any ideas?
Link to the regex used