-
Notifications
You must be signed in to change notification settings - Fork 270
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
^0.5 is broken for LanguageClient-neovim, likely others #192
Comments
@JPinkney you need to check if the client capabilities support that feature, during initialization |
Indeed! it looks like all of the properties of |
Perhaps something as blunt as: workspaceFolders = params.workspaceFolders || [];
try {
hierarchicalDocumentSymbolSupport = !!capabilities.textDocument.documentSymbol.hierarchicalDocumentSymbolSupport;
} catch { }
try {
clientDynamicRegisterSupport = !!(capabilities.textDocument.rangeFormatting && capabilities.textDocument.rangeFormatting.dynamicRegistration);
} catch { } |
I'm still trying to get neovim working and everything installed but can we do something like:
instead? @bollwyvl do you mind submitting a pr with this code? |
I'd be happy to PR, but am not strictly a user or downstream... kind of
still surveying the language server space, and finding a fair number of
edge cases like this. As a spec, it seems rather loosely implemented across
the ecosystem. Perhaps the versioned headers (once broadly supported) will
help.
IIRC in this case there are multiple levels of potential undefinedness...
lodash.get or something, if you have that around...
I guess a !!((x || {}).y || {}).z would be reasonable as well.
That being said, I'd take the readability/performance trade of a
conservative default and try/catch for a once-per-connection, unversioned,
unvalidated, untrusted data, most days.
…On Wed, Oct 16, 2019, 11:05 Josh Pinkney ***@***.***> wrote:
I'm still trying to get neovim working and everything installed but can we
do something like:
if (!!capabilities.textDocument && !!capabilities.textDocument.documentSymbol......)
instead?
@bollwyvl <https://github.com/bollwyvl> do you mind submitting a pr with
this code?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#192?email_source=notifications&email_token=AAALCRDXH54RB6EYMXNX633QO4UUVA5CNFSM4I7O4BKKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBM2TSI#issuecomment-542747081>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAALCRHLJONUTFSZUL4RU4LQO4UUVANCNFSM4I7O4BKA>
.
|
I've just released 0.6.0 which contains these fixes! |
First, thanks for this language server. It's awesome and I look forward to it becoming even more awesome.
Problem
A combination of changes between 0.4.1 and 0.5.0 broke compatibility with my LSP client (LanguageClient-neovim, latest version, commit hash ee6cdb0940d9c2c95f31488f7d463b2d12abcbc4. Using neovim 0.5.0 dev). I suspect it's broken for other Vim/neovim clients as well.
Error with yaml-language-server version ^0.5
"Cannot read property 'hierarchicalDocumentSymbolSupport' of undefined"
Plethora of problems
Line 351 of src/server.ts contains the following line:
This errors out when the server capabilities does not contain a documentSymbol. The LSP specification allows a client to omit this information, but the yaml-language-server does not elegantly handle this case (hierarchicalDocumentSymbolSupport is called on the undefined "documentSymbol" attribute).
I tried updating this line to:
But now I receive a new error:
Therefore, the remedy is more complex than simply catching the "undefined" case.
Full original error message
Evidence from coc.nvim
Coc's yaml extension pins this library to 0.4.0, which strengthens my suspicion that yaml-language-server is broken for other vim language clients; coc users wouldn't notice the breakage because they don't use the latest version.
https://github.com/neoclide/coc-yaml/blob/master/package.json
Reference
The text was updated successfully, but these errors were encountered: