Skip to content
This repository has been archived by the owner on Jul 30, 2020. It is now read-only.

cquery returns a non-conforming textDocument:documentHighlight reply #682

Closed
jaelsasser opened this issue May 21, 2018 · 2 comments
Closed

Comments

@jaelsasser
Copy link
Contributor

While playing around with cquery support in eglot (a minimal Emacs language server library), I was having trouble getting the text document highlighting to work, I noticed that an extra member was getting appended to the documentHighlight replies:

client-request (id:10):
(:jsonrpc "2.0" :id 10 :method :textDocument/documentHighlight :params
          (:textDocument
           (:uri "file:///home/josh/Upstream/net-next/net/core/dev.c")
           :position
           (:line 9114 :character 9)))

server-reply (id:10):
(:jsonrpc "2.0" :id 10 :result
          [(:range
            (:start
             (:line 9111 :character 2)
             :end
             (:line 9111 :character 21))
            :kind 1 :role 32)])

This causes the eglot message-parsing to choke and abort the document highlight request.

From looking over the code it seems like Role is used internally for richer call trees, but it doesn't look like either the Emacs or VS Code clients use it. Is there any particular reason it was added? I've got a local patch applied to my eglot checkout that handles this, but I could see this biting future language server clients implementing cquery support down the road.

jacobdufault pushed a commit that referenced this issue May 21, 2018
Prevents an editor's language server client from choking on a JSON
RPC reply with unexpected arguments. There appear to be no current
users of this protocol extension, so removing it shouldn't cause any
regressions.

Fixes #682.
@jacobdufault
Copy link
Owner

We can readd if someone notices this is missing, but I suspect there are no users. I've been trying to remove cquery extensions that are very unlikely to be added to the spec as well.

@jaelsasser
Copy link
Contributor Author

jaelsasser commented May 21, 2018

I think I broke the tests… they're probably expecting the Role to be sent in the documentHighlight reply, I'll have a PR up shortly fixing that. Nvm, seems like the failure was there before.

decimad pushed a commit to decimad/cquery that referenced this issue Jul 13, 2018
Prevents an editor's language server client from choking on a JSON
RPC reply with unexpected arguments. There appear to be no current
users of this protocol extension, so removing it shouldn't cause any
regressions.

Fixes jacobdufault#682.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants