Replies: 2 comments 10 replies
-
As far as I can read from the code, yes Eglot sends context, of course it does. (jsonrpc-request
server
:textDocument/codeAction
(list :textDocument (eglot--TextDocumentIdentifier)
:range (list :start (eglot--pos-to-lsp-position beg)
:end (eglot--pos-to-lsp-position end))
:context
`(:diagnostics
[,@(cl-loop for diag in (flymake-diagnostics beg end)
when (cdr (assoc 'eglot-lsp-diag
(eglot--diag-data diag)))
collect it)]
,@(when action-kind `(:only [,action-kind]))))
:deferred t) The "context" that the Anyway, if it is then it is possible to transmit it to the server, but that depends how you invoke Reading your log, it seems the latter. It seems that |
Beta Was this translation helpful? Give feedback.
-
Resolved by 03fc783. Thanks, João. |
Beta Was this translation helpful? Give feedback.
-
Hi.
It seems that
eglot
does not sendcontext
incodeAction
requests. This prevent the server from responding with codeActions that are available for the same line when the point is not necessarily over some diagnostics.According to the spec,
For example, consider this sample
clojure
file:Suppose the point is in the last position of the last line, just after
bar
.Then,
eglot
sends thiscodeAction
request:and this is the server reply, containing only one action:
Now, if
eglot
sent context, it would return more code actions.For example, this is a sample from
lsp-mode
, with the same file:and the result contains many actions (I'll omit it here because it's too big, it's suggesting lots of imports whose name could be
str
).I think the most annoying situation that I miss without context is not being able to use an import code action when the point is just after part of a symbol.
For example, say the line is
where
|
is the point. It would like to useeglot-code-actions
for importingstr
as[clojure.string :as str]
just after pressing h. However, I need to move backward one char, moving the point above the missing import diagnostic. Only then eglot displays the code action that I need.Beta Was this translation helpful? Give feedback.
All reactions