Please _thumbs-up_ 馃憤 this issue if it personally affects you! You can do this by clicking on the emoji-face on the top right of this post. Issues with more thumbs-up will be prioritized.
Open this file https://github.com/telerik/kendo-ui-core/blob/master/src/kendo.color.js in visual studio code and switch to NORMAL MODE, go to last line which begins with "}, typeof define == 'function' && define.amd", move cursor to col 1, that's should be under '}', now press %.
The cursor should go to '{' in line 3.
Nothing happens.
Many times, press % will cause the cursor go to wrong places.
Yeah, this is a known issue unfortunately, We don't correctly handle cases like ( ")" ). Feel free to add it if you want 馃槈
@johnfn This seems to be fixed?
Indeed, this looks to be working on 0.2.0.
That's super weird, because our matching algorithm has never changed!
https://github.com/VSCodeVim/Vim/blob/master/src/matching/matcher.ts#L21
Something like ( ")" ) continues to trip us up, so I'm gonna keep this one open for now. 馃槈
Is there any reason we don't just useeditor.action.jumpToBracket?
Oh, here's one... It doesn't support multiple cursors >:(
Ah multi cursors, the cause of, and solution to, all of VSCodeVim's problems.
Also affects motions like [{ and ]}. Would guess the same code is involved in finding pairs here?
I don't use multiple cursors, so I made this mapping in "vim.otherModesKeyBindings" and it has worked so far:
{
"before": ["%"],
"commands": [
{
"command": "editor.action.jumpToBracket",
"args": []
},
{
"command": "editor.action.moveCarretLeftAction",
"args": []
},
{
"command": "editor.action.moveCarretRightAction",
"args": []
}
]
}
The left-right carret motion at the end makes the window scroll to the new carret position.
The use of editor.action.moveCarretLeftAction and editor.action.moveCarretRightAction was the trick I needed to get % to work properly. I had found editor.action.jumpToBracket and bound it to % in normal mode, but it would only pretend to move the cursor to the matching bracket; any kind of interaction in normal mode would "jump" back to the previous cursor location.
Thank you, @bijoutrouvaille! My prefs JSON snippet looks like this:
"vim.normalModeKeyBindingsNonRecursive": [
{
"before": [
"%"
],
"commands": [
"editor.action.jumpToBracket",
"editor.action.moveCarretLeftAction",
"editor.action.moveCarretRightAction"
]
}
]
Most helpful comment
The use of
editor.action.moveCarretLeftActionandeditor.action.moveCarretRightActionwas the trick I needed to get%to work properly. I had foundeditor.action.jumpToBracketand bound it to%in normal mode, but it would only pretend to move the cursor to the matching bracket; any kind of interaction in normal mode would "jump" back to the previous cursor location.Thank you, @bijoutrouvaille! My prefs JSON snippet looks like this: