Skip to content
This repository has been archived by the owner on Mar 22, 2021. It is now read-only.

Problem decoding completion responses #69

Closed
astoff opened this issue Jun 6, 2020 · 7 comments
Closed

Problem decoding completion responses #69

astoff opened this issue Jun 6, 2020 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@astoff
Copy link

astoff commented Jun 6, 2020

Since updating from lsp-test 0.10 to 0.11, I get the following error in my tests:

   uncaught exception: ErrorCall
   Couldn't decode response for the request type: TextDocumentCompletion
   "{\"jsonrpc\":\"2.0\",\"result\":[{\"label\":\"raisebox\"}],\"id\":1}"
   CallStack (from HasCallStack):
     error, called at src/Language/Haskell/LSP/Test/Decoding.hs:120:32 in lsp-test-0.11.0.0-GD7z03pTFQZ9YYbBqXNnp9:Language.Haskell.LSP.Test.Decoding

Tests for other LSP methods still work, so it must really be something specific to how responses to completion requests are decoded. I also tried to make my server return a CompletionList object instead of just a list of CompletionItem objects, but that didn't help either.

@lukel97 lukel97 added the bug Something isn't working label Jun 6, 2020
@lukel97 lukel97 self-assigned this Jun 6, 2020
@lukel97
Copy link
Owner

lukel97 commented Jun 6, 2020

This looks like an decoding issue with haskell-lsp, trying to decode that bit of JSON there gives:

*Language.Haskell.LSP.Test Data.Aeson BS> eitherDecode x :: Either String CompletionResponse
Left "Error in $.result[0]: When parsing the record CompletionItem of type Language.Haskell.LSP.Types.Completion.CompletionItem the key tags was not present."

@lukel97
Copy link
Owner

lukel97 commented Jun 6, 2020

Thanks for reporting this. Can you try out haskell-lsp master now and see if this fixes your crash? If that works then we can make a new release

@astoff
Copy link
Author

astoff commented Jun 6, 2020

I didn't want to look into how to build a Haskell library manually right now, but I can confirm that forcing every completion item to have a tags property makes the tests with the current Hackage version succeed again. So you must be on the right track here.

@lukel97
Copy link
Owner

lukel97 commented Jun 6, 2020

If you're using a cabal.project, try dropping this in

source-repository-package
    type: git
    location: https://github.com/alanz/haskell-lsp.git
    branch: master
    subdir: haskell-lsp-types

@kritzcreek
Copy link

kritzcreek commented Oct 5, 2020

Any chance for a bugfix release including the fix? I can work around it by pulling from git, but it would be nicer if I could just point at a hackage release, thanks for the great library!

@lukel97
Copy link
Owner

lukel97 commented Oct 5, 2020

@kritzcreek haskell-lsp-0.23.0.0 and haskell-lsp-types-0.23.0.0 are up on hackage now, and lsp-test should have a new revision bump for them too!

@kritzcreek
Copy link

Wow, what was quick! Thank you :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants