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

Protocol violation leading to type Missing has no field rename on init #1008

Closed
krassowski opened this issue Dec 12, 2021 · 0 comments · Fixed by #1020
Closed

Protocol violation leading to type Missing has no field rename on init #1008

krassowski opened this issue Dec 12, 2021 · 0 comments · Fixed by #1020
Labels

Comments

@krassowski
Copy link

ClientCapabilities has an optional property textDocument, but the latest version of LanguageServer.jl incorrectly assumes that it is always present:

function ServerCapabilities(client::ClientCapabilities)
prepareSupport = !ismissing(client.textDocument.rename) && client.textDocument.rename.prepareSupport === true

leading to the following error:

ERROR: type Missing has no field rename
Stacktrace:
 [1] getproperty
   @ ./Base.jl:42 [inlined]
 [2] LanguageServer.ServerCapabilities(client::LanguageServer.ClientCapabilities)
   @ LanguageServer ~/.julia/packages/LanguageServer/JrIEf/src/requests/init.jl:2

This was introduced in 4.1 in 5380cbf

A similar issue was already present on ClientCapabilities.workspace which also is optional in protocol, but incorrectly treated as required by LanguageServer.jl:

if !ismissing(params.capabilities.workspace) && (ismissing(params.capabilities.workspace.workspaceFolders) || params.capabilities.workspace.workspaceFolders == false)

I think that this could be fixed by changing !ismissing(client.textDocument.rename) to !ismissing(client.textDocument) && !ismissing(client.textDocument.rename) (and analogously for .workspace)

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

Successfully merging a pull request may close this issue.

3 participants