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

improves bracket undo behavior when vscode autocloses brackets #649

Merged
merged 4 commits into from
Aug 27, 2016
Merged

improves bracket undo behavior when vscode autocloses brackets #649

merged 4 commits into from
Aug 27, 2016

Conversation

xconverge
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
  • Each commit does a logical chunk of work.
  • It builds and tests pass (e.g gulp tslint)

More info can be found by clicking the "guidelines for contributing" link above.

const letterToTheRight = TextEditor.getLineAt(vimState.cursorPosition).text[vimState.cursorPosition.character];
if (letterToTheRight !== undefined) {
switch (key) {
case "{":
Copy link
Member

Choose a reason for hiding this comment

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

Generally when there are giant switch statements that's a sign that you could better represent your stuff as a data structure. In this case, maybe something like this:

const pairings = { 
    "{" : "}",
    "[" : "]",
    "<" : ">",

    /* etc... */
}

Copy link
Member

Choose a reason for hiding this comment

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

I think this idea would also let you DRY up this code a little bit. It's a little repetitive right now.

@xconverge
Copy link
Member Author

Ok definitely a little cleaner now

@johnfn
Copy link
Member

johnfn commented Aug 26, 2016

@xconverge
Copy link
Member Author

I should be able to... this looks perfect...

@johnfn
Copy link
Member

johnfn commented Aug 27, 2016

Wonderful, thank you!

@johnfn johnfn merged commit c092ef5 into VSCodeVim:master Aug 27, 2016
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