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
Now Helix automatically creates a trailing line ending if there is not one already, there is a problem in that the CSS, JSON and HTML language servers remove the last line ending when they format. This means that Helix adds a trailing line ending, then the servers remove it (or some other order of operations, the outcome is the same). Each step is added into the undo history which is a problem, especially if auto format is enabled.
Basically now you need to press undo several times in order to undo the last thing you changed. As Helix has format on save enabled by default then this happens constantly.
A quick partial fix would be to remove auto-save from the affected language servers, this would remove the majority of the problem. Not using the built in formatting, but instead using Prettier, is the current best full workaround.
What do people think the best solution is? #7155 describes it, I am not sure why it was closed. In the JSON language server you can add { "keepLines" = { "enable" = true } } to stop it removing the last line, but it also stops it getting rid of any blank lines which is not ideal. I have searched the APIs of the other language servers and can't seem to get anywhere with a command to stop them deleting the final line. I noticed some seem to have settings that suggest they might do the job, but then they do nothing when added to the Helix config.
Reproduction Steps
Make a change in an HTML, CSS or JSON file such as selecting a word and deleting it.
Save the file, autoformat is used by default (you can see the EOL character at the bottom of the file flicker)
Press undo and you won't undo your last change, but instead undo the inserting and deleting of the final trailing line ending.
Helix log
NA
Platform
Linux
Terminal Emulator
Kitty
Helix Version
latest master
The text was updated successfully, but these errors were encountered:
That would be ideal but hard to implement because autofromatting is async. If you didn't add an undopoint after adding the trailing newline and some other change happened before the autoformatting fi ished. The autoformatting is aborted but then the trailing newline and that new change take-up a single undopoint
Summary
Now Helix automatically creates a trailing line ending if there is not one already, there is a problem in that the CSS, JSON and HTML language servers remove the last line ending when they format. This means that Helix adds a trailing line ending, then the servers remove it (or some other order of operations, the outcome is the same). Each step is added into the undo history which is a problem, especially if auto format is enabled.
Basically now you need to press undo several times in order to undo the last thing you changed. As Helix has format on save enabled by default then this happens constantly.
A quick partial fix would be to remove auto-save from the affected language servers, this would remove the majority of the problem. Not using the built in formatting, but instead using Prettier, is the current best full workaround.
What do people think the best solution is? #7155 describes it, I am not sure why it was closed. In the JSON language server you can add
{ "keepLines" = { "enable" = true } }
to stop it removing the last line, but it also stops it getting rid of any blank lines which is not ideal. I have searched the APIs of the other language servers and can't seem to get anywhere with a command to stop them deleting the final line. I noticed some seem to have settings that suggest they might do the job, but then they do nothing when added to the Helix config.Reproduction Steps
Helix log
NA
Platform
Linux
Terminal Emulator
Kitty
Helix Version
latest master
The text was updated successfully, but these errors were encountered: