Skip to content

Set correct cursor and selection after code format. - #478

Merged
jpoon merged 1 commit into
VSCodeVim:masterfrom
rebornix:FormatWithCorrectCursor
Jul 20, 2016
Merged

jpoon merged 1 commit into
VSCodeVim:masterfrom
rebornix:FormatWithCorrectCursor

Conversation

@rebornix

Copy link
Copy Markdown
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.

Comment thread src/actions/actions.ts Outdated
public async exec(position: Position, vimState: VimState): Promise<VimState> {
await vscode.commands.executeCommand("editor.action.format");

let selection = vscode.window.activeTextEditor.selection;

Copy link
Copy Markdown
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

rebornix commented Jul 20, 2016 •

Copy link
Copy Markdown
Member Author

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

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

jpoon commented Jul 20, 2016

Copy link
Copy Markdown
Member

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