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

[flow] Weird issue with completion post v0.97.0 #107

Closed
d4ncer opened this issue Apr 20, 2019 · 2 comments
Closed

[flow] Weird issue with completion post v0.97.0 #107

d4ncer opened this issue Apr 20, 2019 · 2 comments

Comments

@d4ncer
Copy link

d4ncer commented Apr 20, 2019

I upgraded to Flow 0.97.0, which contains support for snippets in completion in their LSP (see this PR) and have run into some weird issues where triggering the completion is deleting a single required char.

You can see it in action in the example below, one case where I run the completion directly after typing in ., and the other after narrowing it down a bit. In the first case, it deletes the . before adding in the completion, and in the second case, deletes the h and keeps the initial c instead of replacing all of it.

flow lsp 0.97.0 breaks completion

If this isn't the right place to handle this issue, let me know if I should post this issue somewhere else.

Thank you!

@yyoncho
Copy link
Contributor

yyoncho commented Apr 21, 2019

It seems like the flow language server send the character offset 1 based instead of 0 based.

Here it is the completion of "" in both jdtls and flow.

>>> jdtls
    "textEdit": {
      "range": {
        "start": {
          "line": 13,
          "character": 3
        },
        "end": {
          "line": 13,
          "character": 5
        }
      },
      "newText": "charAt(${1:index})"
    }

>> flow
    "textEdit": {
      "range": {
        "start": {
          "line": 1,
          "character": 2
        },
        "end": {
          "line": 1,
          "character": 4
        }
      },
      "newText": "charAt(${1:pos})"
    }

So I assume it is either flow ls bug or there is some setting that should be passed to the server to make it work properly.

@d4ncer
Copy link
Author

d4ncer commented Apr 22, 2019

Thanks for doing the heavy lifting @yyoncho! I'll open an issue with Flow and see what the best course of action is. Will close this out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants