You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Wrap with abbreviation and Expand abbr commands do not work with multiple cursors #27621
bugIssue identified by VS Code Team member as probable bugemmetEmmet related issuesimportantIssue identified as high-priorityverifiedVerification succeeded
changed the title [-]Wrap with abbreviation doesn't work with multiple cursors[/-][+]Wrap with abbreviation and Expand abbr commands do not work with multiple cursors[/+]on May 31, 2017
Don't call insert in a loop over the selection but invoke it just once. First build all ranges and then call insert will all of them. That should do it, the ranges are being set as selection
Johannes Rieken (@jrieken) That will work if the same snippet has to be inserted in all ranges. But that is not the case here. We could technically have 3 different emmet abbr in 3 different locations
Then you cannot do it without manual work. Snippets, like all multi-cursor operations, insert the same text at all cursors. You could combine all emmet expansions into one snippets and that snippet would replace those three lines, the SnippetString and its builder functions might help you.
Test multi-cursor by trying to expand the same abbreviation at multiple cursors.
- All abbreviations should expand
- Cursor should be at the first tab stop of each expanded snippet
- Further tabs should take you through each of the tabstops for each cursor
Test multi-cursor by trying to expand different abbreviation at different cursors.
- All abbreviation should expand
- Only the snippet at the last cursor will end up having its cursor maintained. Its a known issue
For the cursor issue in #27621 (comment), since the text being wrapped is different, the final snippets are different in which case it is not possible to preserve all the cursors as explained #27621 (comment)
The extra space and tab issue occurs only when the wrapping abbreviation is for an inline element (a, span etc).
bugIssue identified by VS Code Team member as probable bugemmetEmmet related issuesimportantIssue identified as high-priorityverifiedVerification succeeded
Activity
[-]Wrap with abbreviation doesn't work with multiple cursors[/-][+]Wrap with abbreviation and Expand abbr commands do not work with multiple cursors[/+]Multi cursor for Emmet Expand Abbreviation command #27621
Multi cursor for Wrap with Abbreviation command #27621
ramya-rao-a commentedon Jun 22, 2017
Multi cursor now works for both
Emmet: Expand AbbreviationandEmmet: Wrap with abbreviationcommand.But once the commands get executed, the multi cursors are lost and the cursor is in the last snippet that got expanded.
Johannes Rieken (@jrieken) This is how I am inserting the snippets. What can I do to ensure that the multi cursor remain ?
jrieken commentedon Jun 22, 2017
Don't call insert in a loop over the selection but invoke it just once. First build all ranges and then call insert will all of them. That should do it, the ranges are being set as selection
ramya-rao-a commentedon Jun 22, 2017
Johannes Rieken (@jrieken) That will work if the same snippet has to be inserted in all ranges. But that is not the case here. We could technically have 3 different emmet abbr in 3 different locations
jrieken commentedon Jun 22, 2017
Then you cannot do it without manual work. Snippets, like all multi-cursor operations, insert the same text at all cursors. You could combine all emmet expansions into one snippets and that snippet would replace those three lines, the
SnippetStringand its builder functions might help you.Improve multi cursor in abbr actions #27621
ramya-rao-a commentedon Jun 22, 2017
Thanks Johannes Rieken (@jrieken)
You mean combine the text in between the lines as well into one big snippet? I'll re-visit this based on user feedback.
For now I am taking this approach
editor.insertSnippet. All cursors will be maintainededitor.insertSnippetfor each range/abbreviation. A single cursor will remain in the last snippet that was enteredramya-rao-a commentedon Jun 26, 2017
Note to verifier:
- All abbreviations should expand
- Cursor should be at the first tab stop of each expanded snippet
- Further tabs should take you through each of the tabstops for each cursor
- All abbreviation should expand
- Only the snippet at the last cursor will end up having its cursor maintained. Its a known issue
Tyriar commentedon Jun 29, 2017
Same repro steps above, I get:
Problems:
Tyriar commentedon Jun 29, 2017
This actually applies to the non multiple cursor case as well, I think this is a bad regression:
Fix extra tabs when wrapping with inline element #27621
ramya-rao-a commentedon Jun 29, 2017
For the cursor issue in #27621 (comment), since the text being wrapped is different, the final snippets are different in which case it is not possible to preserve all the cursors as explained #27621 (comment)
The extra space and tab issue occurs only when the wrapping abbreviation is for an inline element (a, span etc).
Fixed with 605ee59