Open kiennq opened 4 years ago
Seems like we are applying text edits that are incompatible with the
already applied changes to the buffer. We may consider changes on the
current line as something incompatible(or check if (> end first-edited)
shouldn't be changed to (>= end first-edited)
. We may
also revert and keep on type formatting as tick
.
I also wonder in general, what is the correct way to handle this case, becase apparently the same problem will exist in vscode as well.
I think that it should be better to rever the latest changes related to onTypeFormatting until we sort that out - soon we will start getting issue reports for that.
Ok, I will put it back to tick
.
Before we never applied on type formatting on Enter since the text will be changed by indent-line-function
. The latest change on onTypeFormatting
allowing text to be applied, since it's compatible (really, the indent-line-function
change text after \n
, while the onTypeFormatting
change text before and at \n
).
Ok, I will put it back to
tick
. Before we never applied on type formatting on Enter since the text will be changed byindent-line-function
. The latest change ononTypeFormatting
allowing text to be applied, since it's compatible (really, theindent-line-function
change text after\n
, while theonTypeFormatting
change text before and at\n
).
Yes.
A simple snippet to demonstrate problem using
clangd
withThe
<|>
is cursor position. Now if we press Enter, theonTypeFormatting
is kicked in and resulted in something likeNote that the cursor position on the next line is over-indented. The server trace
So you can se that the second text edit from server already contained indenting information, plus the indentation done by
indent-line-function
, that makes the new line is doubled indented.