Skip to content
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

Merged
merged 7 commits into from
May 17, 2017
Merged

Conversation

Chillee
Copy link
Member

@Chillee Chillee commented May 17, 2017

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

@@ -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", {
Copy link
Member

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

Copy link
Member Author

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?

Copy link
Member

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

Copy link
Member Author

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.

Copy link
Member

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?


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)));
}
Copy link
Member Author

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it sure is

@xconverge
Copy link
Member

Thanks!

@xconverge xconverge merged commit 8a4d89b into VSCodeVim:master May 17, 2017
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants