Support for custom invocation of code actions' Commands #183
Description
Currently, the default client's flow of using code action works as follows -
- Client requests server for available code actions according to file & location
- Client receives the actions and shows them (and every action is associated with a
Command
object) - Client chooses one of the code actions in the UI
- Client calls
workspace/executeCommand
for the Command associated with the code action.
IMO the LSP specs state pretty clearly here that the response for code actions should return an array of Command
s that the Server is capable of running - the client should contact the server again with the associated Command
to executeCommand.
However, not all servers work that way - for example eclipses' java server returns Command
s it expects the calling client to understand, analyze and act to. (So obviously, non-standard/custom commands).
Since in our default implementation, in step 4 mentioned above, If I understand correctly, executeCommand is called automatically for Command
s the server can't handle,' there's a need to override that behavior (which includes copying redundant code to packages, like ide-java
, to implement a custom behavior).
Can the atom language client provide some hooks to registering custom commands (some Map
object that maps a Command
to a callback
function can do) for ide-* packages? the way I see it, the client can expose functions to register a custom Command
callback (without exposing the Map itself) and everytime a CodeAction
is executed, it will first check if the Map
contains custom implementation, and if it doesn't - it'll call workspace/executeCommand
on the server.
thoughts? is this something you think we should support? (if so, i'd like to start working on a PR for this matter)