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
I'm trying to determine the root cause of microsoft/vscode-go#16, but I don't see any problem with the TextEdit object I'm providing back to the provideDocumentFormattingEdits. It seems that in some cases Code will corrupt the buffer in odd but deterministic ways.
I haven't been able to pin down the exact incorrect behaviour, but two example:
Note that the only difference between these examples is the "\t" vs " " in the original text. The result in Example 1 has corruption in the string result in a seemingly random location.
Two question:
Is this a bug in the extension API, or am I somehow calling it wrong?
If it's a bug, is there any workaround?
The text was updated successfully, but these errors were encountered:
@alexandrudima@bpasero Any thoughts on this? Any chance there is a workaround? This is currently blocking addressing the top piece of feedback on vscode-go and I'm not sure how to workaround it.
TL;DR; It is an issue in the formatCommand.ts edit trimming. A fix is on the way in the November recovery drop.
The format command tries to do some smart front/rear trimming of edits to reduce edit ranges. E.g.
Given a buffer containing "some cool cool text"
replace [0,19] with "some cool cool text" => no-op
replace [0,19] with "something interesting" => replace [4,19] with "thing interesting"
replace [0, 19] with "some interesting text" => replace [5,14] with "interesting"
It had a bug when prefix & suffix overlap. e.g.:
replace [0, 19] with "some cool and cool text" => invalid edit
replace [0, 19] with "some cool text" => invalid edit
You can either wait for our recovery drop due end of this week or early next week or you can try to massage the edits on your side such that there is no prefix & suffix overlap. Removing the same prefix would already work.
I'm trying to determine the root cause of microsoft/vscode-go#16, but I don't see any problem with the TextEdit object I'm providing back to the
provideDocumentFormattingEdits
. It seems that in some cases Code will corrupt the buffer in odd but deterministic ways.I haven't been able to pin down the exact incorrect behaviour, but two example:
Example 1
Before text:
Then replace the full range with:
The result will be
Example 2
Before text:
Then replace the full range with:
The result will be
Note that the only difference between these examples is the
"\t"
vs" "
in the original text. The result in Example 1 has corruption in the string result in a seemingly random location.Two question:
The text was updated successfully, but these errors were encountered: