-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Consider using VSCode's type command to improve multicursor support #4522
Comments
Another similar issue from 2017 #1946 |
I too have observed a couple of issues and I'd really appreciate any improvements to the multicursor support. Can I help? |
@cvaldev This seems very reasonable, though there could obviously be unforeseen consequences. A WIP pull request would be great, thanks as always for digging into these thorny issues!
Pull requests are always welcome, and I'm happy to provide guidance where it's needed. I agree multicursor support is a bit lacking @trkoch. |
Fixes multicursor snippets, and adds support for stuff like auto-bracketing and auto-completion on multicursor mode. Backspace Support: Makes range represent the selection at position. This way we delete the correct range rather than the primary selection as it was before these changes. Multicursor Character Insert: Makes multicursor text insertion behave like single cursor text insertion by ultimately using the default: type command rather than vscode.TextEditor.insert() which doesn't have support for snippet mode, auto completion, bracketing, etc. To accomplish this, I've added an optional property (isMultiCursor) to InsertTextVSCodeTransformation which represents vimState.isMultiCursorat the time the transformation was created. This property is used to filter the multicursor transformations into multicursorTextTransformations. Because the default: type command handles inserting the text into the correct cursor positions there's no need to repeat the transformation multiple times and we can just execute the command once, as long as we know all transformations are trying to do the same thing. Fixes #4281, fixes #4223, fixes #3005, fixes #4522, fixes #4515, fixes #1946, fixes #3976
Is your feature request related to a problem? Please describe.
There are many issues with the extension's poor multicursor support, but one of the most annoying ones is that it breaks snippets and auto-completion. On single cursor mode the extension passes over the text to the
default: type
command throughTextEditor.insert()
, this way vscode has control over the text input and can do stuff like auto-completion, snippet mode, closing brackets, etc.Multiple cursors, however, are handled differently.
vscode.TextEditorEdit.insert()
is used instead, which doesn't allow vscode to do its regular stuff that it'd do on text insertion by default.Describe the solution you'd like
Use the
default: type
command to process text insertion on multicursor mode like it is used on single cursor mode.Describe alternatives you've considered
Here is a rudimentary prototype of my suggestion that solves issues like #4281, #4515, #4223.
VSCode's
type
command handles replicating what happens at the first cursor on the other cursors, and unless I'm wrong we can't do things like placex
at cursor[0] andy
at cursor[1] so there is no need to create an edit for each individual cursor as long as we know they're all the same.I believe a better solution would be to introduce a new transformation (
MulticursorInsert
) that can know the cursor position likeInsertTextTransformation
, but is processed similarly to anInsertTextVSCodeTransformation
.Additional context
Before getting any further into it I'd like to know if this would be a welcomed change. I could submit a WIP PR if that's the case.
The text was updated successfully, but these errors were encountered: