Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lsp] Weird issue with completion in v0.97.0 #7659

Closed
d4ncer opened this issue Apr 22, 2019 · 4 comments
Closed

[lsp] Weird issue with completion in v0.97.0 #7659

d4ncer opened this issue Apr 22, 2019 · 4 comments
Assignees

Comments

@d4ncer
Copy link

d4ncer commented Apr 22, 2019

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

flow lsp 0.97.0 breaks completion

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!

@kirbycool
Copy link

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

@d4ncer
Copy link
Author

d4ncer commented Apr 25, 2019

@vicapow did you observe similar behaviour in VSCode or any other editors while you were working on this functionality?

@Mayank1791989
Copy link

Fixed in v0.101.0 (see 909e50e)

@d4ncer
Copy link
Author

d4ncer commented Jun 11, 2019

Thanks for pointing that out @Mayank1791989! Closing this.

@d4ncer d4ncer closed this as completed Jun 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants