Open lordmilko opened 2 years ago
Hmmm, we do assume that enumerations have fixed sets of values unless the spec says that they're extensible. The new, machine-readable version of the spec even has a special property for enumerations that allow custom values - and CompletionItemKind
does not have it. But I agree that the spec seems ambiguous here. I'll ask upstream.
Thanks, it seems like this is indeed a bug, and all enumerations are expected to be open. I'll fix this in my metamodel-generation branch, but I probably won't fix this in current versions of lsp
.
Thanks @michaelpj,
When you say it won't be fixed in current versions of lsp
are you able to clarify what you mean by that? I would imagine that all previous releases of lsp
would of course contain this bug (since they have already been released), but once the change is merged into master I would imagine this fix would be in the next release after that
Sorry, I meant the "current design" I guess. I have a very large PR that redoes almost the whole package, I'm not planning to modify the existing code until that hits. That said, if this is a real blocker for you I'd accept a PR and do a minor release.
Argh, I did not in fact fix this! I forgot about this insanity where literally all enums are open. Still need to do it.
I am attempting to build a language client against haskell-language-server in Visual Studio 2019.
When I follow the instructions for doing so however, haskell-language-server-wrapper fails with the following error
Upon further investigation, it seems the issue is that in the
CompletionItemKind
enumeration defined inMicrosoft.VisualStudio.LanguageServer.Protocol.dll
, the first element of this enumeration isNone
. Visual Studio attempts to pass all members of this enumeration as supported completion kinds to the language server. In the A.FromJSON declaration,None
is not a valid identifier, resulting infail "CompletionItemKind"
being called, which I believe is what leads to the exception above.According to the LSP Specifiaction:
There are actually 13 "additional" values in the
CompletionItemKind
enum ofMicrosoft.VisualStudio.LanguageServer.Protocol.dll
, so I believe the key issue here is that haskell/lsp (and by extension haskell-language-server) do not correctly ignore unknown enumeration values as recommended by the LSP specification. This may potentially affect other LSP enumeration kinds implemented by this project as wellAttached is the log output of haskell-language-server-wrapper that generated this error
log.log