Add command: eglot-execute-server-command#846
Open
nemethf wants to merge 1 commit into
Open
Conversation
The new command allows the users to ask the server to execute a command advertised in the server's initial capabilities (:executeCommandProvider/:commands). * eglot.el (eglot-execute-server-command): New command.
joaotavora
reviewed
Feb 25, 2022
| "Ask current server to execute COMMAND | ||
| (Server announces the available commands in its _initialize_ reply.)" | ||
| ;; This defun simply calls cl-defmethod `eglot-execute-command', because | ||
| ;; that cannot be interactive. |
Owner
There was a problem hiding this comment.
really? it can't? What a pity.
Collaborator
Author
There was a problem hiding this comment.
Yeah, (info "(elisp) Generic Functions") says
Functions defined using ‘cl-defmethod’ cannot be made interactive,
i.e. commands (*note Defining Commands::), by adding the
‘interactive’ form to them. If you need a polymorphic command, we
recommend defining a normal command that calls a polymorphic
function defined via ‘cl-defgeneric’ and ‘cl-defmethod’.
Owner
There was a problem hiding this comment.
😢 maybe @monnier can explain this. I can't see a technical reason why Emacs wouldn't allow this, but surely there must be one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The new command's discoverability or usability can later be improved by putting the possible commands into Eglot's mode-line-menu. (If someday PR #808 or something similar is merged.)
Besides my own unreleased toy server, I know only one server that advertises its commands. It's pygls' example server: json-extension. I'm guessing this is because you always need to specify these commands in package.json for VS Code. Or so it seems.
The new command allows the users to ask the server to execute a
command advertised in the server's initial capabilities
(:executeCommandProvider/:commands).