-
Notifications
You must be signed in to change notification settings - Fork 43
Description
Description of the bug
A major issue with Vue Syntax Highlight 4.0.1 has been observed, which causes the following text snippet
a) to be pasted with line 7 ('error': status === 'error'
) being wrongly indented
b) and "\n
in line 8 being deleted when re-indenting line 7 by hitting tab at the beginning of the line.
<template>
<figure class="image">
<img
:src="image"
:class="{
'waiting': status === 'waiting',
'error': status === 'error'
}"
>
</figure>
</template>
The result can not be undone via ctrl+z and may even cause ST to crash when saving the file if LSP-vue is present.
It appears embedded JavaScript syntax somehow causes syntax engine to get into a weird state, causing the text to get corrupted.
source: https://discord.com/channels/280102180189634562/280157083356233728/1070248043938590720
The good news: This bug is worked around by vuejs/vue-syntax-highlight#216
The bad news:
- This fix has not been released, yet.
- It may happen to other syntaxes as well, given JavaScript being embedded in HTML and various other syntaxes.
The one way or the other: This kind of weird text manipulation which also breaks the undo stack should not happen under all circumstances.
Steps to reproduce
- Start ST in SAFE MODE
- Extract Vue.zip to Data\Packages\Vue
- Open a new view
- Set syntax to Vue Component (Broken)
- Paste the given template code
- Navigate to the beginning of line 7
- Hit tab
- Observe "Actual behavior"
- Open another view
- Set syntax to Vue Component
- Paste the given template code
- Observe "Expected behavior"
Expected behavior
After pasting code
After hitting tab (even though not needed)
The commit which fixes the bug is vuejs/vue-syntax-highlight@78f5c47
The crucial part of the fix is to embed scope:source.js#expression-statement
instead of scope:source.js
.
Actual behavior
After pasting code
After hitting tab
... the closing "
and the following newline are deleted.
ST's console prints:
command: insert {"characters": "\t"}
Sublime Text build number
4147
Operating system & version
Windows 11
(Linux) Desktop environment and/or window manager
No response
Additional information
No response
OpenGL context information
No response