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

Set correct cursor and selection after code format. #478

Merged
merged 1 commit into from
Jul 20, 2016

Conversation

rebornix
Copy link
Member

Yay! We love PRs! 🎊

Please include a description of your change & check your PR against this list, thanks:

  • Commit message has a short title & issue references
  • Commits are squashed
  • It builds and tests pass (e.g gulp tslint)

After code format, the cursor should be set to the first character of the first line of original selection.

@@ -610,6 +610,18 @@ class CommandFormatCode extends BaseCommand {

public async exec(position: Position, vimState: VimState): Promise<VimState> {
await vscode.commands.executeCommand("editor.action.format");

let selection = vscode.window.activeTextEditor.selection;
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason you aren't using vimState.cursorPosition and cursorStartPosition?

@rebornix rebornix force-pushed the FormatWithCorrectCursor branch from f3c1ad0 to 1443142 Compare July 20, 2016 00:01
@rebornix
Copy link
Member Author

rebornix commented Jul 20, 2016

Give it a quick turnaound and understand vimState cursor stuff more.

@rebornix rebornix mentioned this pull request Jul 20, 2016
12 tasks
@jpoon jpoon merged commit 8b003f5 into VSCodeVim:master Jul 20, 2016
@jpoon
Copy link
Member

jpoon commented Jul 20, 2016

Thanks! this issue has been bugging me.

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.

3 participants