[lsp] Weird issue with completion in v0.97.0
Hello!
I'm having a strange issue when triggering a completion with v0.97.0 - it looks like the Flow LSP is sending back character offsets based on 1 instead of 0, as found here (thanks to @yyoncho for investigating this!). This results in broken code after triggering the completion (see the GIF below).
Environment
Flow version: v0.97.0
Client: Emacs + lsp-mode + company-lsp
Expected behavior
When triggering a completion, I expect the result code to be correct.
Actual behavior

On a very brief investigation into the PR that introduced this change, I think this behaviour could be caused by this line, but I could be wrong; my OCaml knowledge is non-existent.
Let me know if there's something I can configure on the LSP server to fix this behaviour. Thank you!
I think you're right about that logic being the problem. Looking at the lsp spec, the textEdit range should denote the text to replace i.e. you've already typed part of the completion. So:
x.|
start.character = character // 2
end.character = character // 2
x.toEx|
start.character = character - 4 // 2
end.character = character // 6
@vicapow did you observe similar behaviour in VSCode or any other editors while you were working on this functionality?
Fixed in v0.101.0 (see 909e50ec472aa7a2c52678ba2ba94668b483368f)
Thanks for pointing that out @Mayank1791989! Closing this.