sublime-text-plugin
sublime-text-plugin copied to clipboard
2.1.14 Wrap with Abbreviation Causes Unexpected Behavior where Key Binding Changes the Buffer Syntax
Sublime Text 3, (3.2.2, Build 3211). Emmet v2.1.14. Windows 10. The Wrap with Abbreviation
command has a key binding of Ctrl+Shift+G
in my custom key bindings file.
Open Sublime Text and enable command logging in the console.
The syntax defaults to Plain Text
.
Use the command palette to set the syntax to HTML
.
Type !
then press the tab key to expand the default HTML document. (When repeatedly testing this process, sometimes I would press Esc
to cancel the 5 snippet fields created when inserting the !
snippet. This did not appear to make a difference with the result.)
Console says: command: emmet_expand_abbreviation {"tab": true}
Click the mouse to place the caret in the blank line between the <body>
and </body>
tags.
Type a few characters and select them.
Press Ctrl+Shift+G
to run Wrap with Abbreviation command.
The syntax changes to Ruby Haml
.
Console says: command: emmet_wrap_with_abbreviation
Press Ctrl+Shift+P
to open command palette.
Console says: command: show_overlay {"overlay": "command_palette"}
The top of the command palette is cut off and only the bottom is barely displayed. (If you try to enter a command at this time, ST will crash.)
Press Esc
to close the command palette.
Console says: command: hide_overlay
Press Ctrl+Shift+P
to open command palette, again. This time, the palette displays correctly.
Console says: command: show_overlay {"overlay": "command_palette"}
Use the command palette to set the syntax to HTML
.
Select the characters, then open the command palette with Ctrl+Shift+P
.
Console says: command: show_overlay {"overlay": "command_palette"}
Run the Wrap with Abbreviation
command from the command palette without using a key binding.
The command works as expected and nothing new added to console. From this point, I am sometimes able to successfully use the key binding to run the Wrap with abbreviation
command.
I have been able to reproduce this continuously through closing the file and/or closing and opening Sublime Text.
My key bindings file contains the following. This binding matches the Emmet reference key binding file.
{ "keys": ["shift+ctrl+g"], "command": "emmet_wrap_with_abbreviation", "context": [{"key": "setting.is_widget", "operand": false }] },
Thank you for very detailed report! As far as I can see, this issue happens when you change current document syntax with keyboard shortcut when you‘re in Wrap with Abbreviation mode (with opened panel for abbreviation input)?
You are welcome.
No, the Wrap with Abbreviation panel is not open when I change the syntax.
It happens after I change the syntax using the command palette, then, I try to use the Wrap command.
Thank you for looking at this.
I recorded a video of this process to replicate the erratic behavior of using the command palette and a key binding. It appears that until you first use the command palette to "wrap", you can't successfully use a key binding to "wrap".
I upgraded to ST4 4087 recently, and this problem doesn't occur on this version. It still occurs on ST3 3211, however. I used the same /user/ package contents for both versions of ST.