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

Quickfix for missing import duplicates identifier in coc.nvim #66

Open
triallax opened this issue Feb 18, 2020 · 8 comments
Open

Quickfix for missing import duplicates identifier in coc.nvim #66

triallax opened this issue Feb 18, 2020 · 8 comments
Labels

Comments

@triallax
Copy link

triallax commented Feb 18, 2020

I don't know if the issue stems from purescript-language-server or from coc.nvim. If the issue is indeed from coc.nvim, please tell me and then I'll create an issue there.

Here's a video demonstrating the issue.

(Sorry for bad quality, for some reason imgur trims down the video's quality)

@triallax
Copy link
Author

I'm quite tired right now, but after I get enough rest I'll investigate this issue more and then comment what I discover.

@nwolverson
Copy link
Owner

I'll take a look at what happens for similar in vscode, if that shows the same issue then the answer is clear. We should be able to find out what messages are sent to/from the LSP and find out what's at fault in that way

@triallax
Copy link
Author

Here's a log file that shows the communication between coc.nvim and purescript-language-server.
The file is really large and hard to read, so I recommend putting the log file in this website.

@nwolverson
Copy link
Owner

Looking at that log, we supply a single edit which seems to have 2 things going on:

{
  "edit": {
    "documentChanges": [
      {
        "textDocument": {
          "uri": "file:///Users/mhmdanas/Desktop/projecteuler-solutions/Some.purs",
          "version": 98
        },
        "edits": [
          {
            "range": {
              "start": {
                "line": 9,
                "character": 55
              },
              "end": {
                "line": 9,
                "character": 44
              }
            },
            "newText": "shouldEqual"
          }
        ]
      }
    ],
    "changes": {
      "file:///Users/mhmdanas/Desktop/projecteuler-solutions/Some.purs": [
        {
          "range": {
            "start": {
              "line": 9,
              "character": 55
            },
            "end": {
              "line": 9,
              "character": 44
            }
          },
          "newText": "shouldEqual"
        }
      ]
    }
  }
}

Firstly, the range start/end seem to be reversed, which may be why the text is not replaced but appended. Secondly, the edit is supplied in the "old" and "new" forms. I was of the belief that documentChanges would take precedence over changes, but I think the spec is a bit unclear - we should only provide 1, but documentChanges "are preferred":

The edit should either provide changes or documentChanges. If the client can handle versioned document edits and if documentChanges are present, the latter are preferred over changes

@nwolverson nwolverson added the bug label Jul 23, 2020
@nwolverson
Copy link
Owner

Hopefully fixed in 3941003

@triallax
Copy link
Author

triallax commented Aug 6, 2020

I tried to check if this bug was fixed, but even before I updated to 0.13.6 from 0.12.9, quickfix didn't work anymore. Same in 0.13.6. I get this text at the bottom in red:

[coc.nvim] No quickfix action available

I'll try to check later, as it seems that it's a problem from my side.

@nwolverson
Copy link
Owner

Quickfix was borken in vscode for a long time, not sure what the status is post-update - I assume I fixed it... but that may have broken others.

@triallax
Copy link
Author

triallax commented Aug 6, 2020

I tested this in coc.nvim. I might install VSCode to check if it works there or not.

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

No branches or pull requests

2 participants