-
Notifications
You must be signed in to change notification settings - Fork 72
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
Support for 'xml/executeClientCommand' protocol extension #543
Conversation
Signed-off-by: BoykoAlex <[email protected]>
@@ -0,0 +1,168 @@ | |||
package org.eclipse.wildwebdeveloper.xml.internal; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add EPLv2 copyright header.
private static final String LSP_COMMAND_PARAMETER_TYPE_ID = "org.eclipse.lsp4e.commandParameterType"; //$NON-NLS-1$ | ||
private static final String LSP_PATH_PARAMETER_TYPE_ID = "org.eclipse.lsp4e.pathParameterType"; //$NON-NLS-1$ | ||
|
||
public CompletableFuture<Object> executeClientCommand(String id, Object... params) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like all that should be placed in LSP4E, and even that LSP4E does already have such code available. We should instead investigate a better way to expose the LSP4E command handling as API and consume it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alex is a bit busy so I will continue to push this forwards. I just created a gerrit patch merging in this code with the lsp4e 'CommandExecutor'.
See: https://git.eclipse.org/r/c/lsp4e/lsp4e/+/170859
I suggest we start by discussion / resolving that patch via gerrit. And once that is done I can then amend this PR here to remove the obsolete wild web copy of CommandExecutor and use the one from lsp4e instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: you will see that my patch exports internal package. This is probably not what we want in the end. But I wanted to avoid moving the CommandExecutor
class to another package as that would make it a lot harder to see what was changed in this class. So I think its better we review the change details first, and once we are agreed they are fine, we can then discuss / decide how to expose the api publically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay so I just updated the PR. The CommandExecutor has been removed and now using the lsp4e CommandExecutor instead.
@BoykoAlex @kdvolder While I'm not fundamentally against that change, I believe thas such |
There's a couple of related LSP issue tickets:
The first one is probably the most closely related, one part of what it needs/asks for is a mechanism for server to request client to execute a command. The second one has a discussion around whether commands live in a 'shared/global' name space or whether the commands belong only to a specific client<->server session. With a shared namespace one server could define a command and another one could use it (e.g. in code action, or also in a potential The third one is about how server could know what commands 'exist' on the client. (I.e. kind of the inverse of how a server advertises commands as a capability so client can execute them). I'm not sure how realistic it is to get this resolved in LSP protocol in the short term, which is why it may be best to move forward with custom protocol extensions such as 'xml/executeClientCommand' at this time. This is not ideal of course, but lacking consensus on how to handle it in the LSP itself, we may not have much choice. |
BTW: Another option might be to have a 'executeClientCommand' provided by lsp4e. That way at least different eclipse based clients wouldn't all need to implement their own version of it. |
Interesting, however none seems easily actionable, and it looks that they are more brainstorming than actual concrete proposals. Can you please open one about "Introduce a client/executeCommand server->client operation" ? Since you have mostly implemented it for LemMinX already, this proposal might be easily actionable.
I agree.
I think that in parallel of just making things work here for XML, it's just time to open finer grain issues and maybe even PRs to the LSP spec to handle that.
I already don't like a lot the idea of specific operations in Wild Web Developer, but I like much less the idea of placing them in LSP4E ;) |
I understand, but... in a way putting into lsp4e is one small step closer to making it 'standardized'. So to me this would be better than having every individual Eclipse based client have their own But I totally agree putting non-standard protocol extension in lsp4e vs putting it in xml, java and spring boot individually, neither is great. The best solution is this be standard part of lsp spec (and then it can be part of lsp4e as well as every other client library that cares to implement the spec faifully). Anyhow, yes, I think it is probably time to create that LSP ticket to request a protocol extension and see what traction it gets. At least we can write up a bit more carefully what we think this extension should do, and then maybe we implement it in lsp4e accordingly. I'll try and get round to this in the next couple of days. |
I've made the requested change to use CommandExecutor from lsp4e. However, jenkins doesn't like it:
Seems like it isn't there? I beleave that @mickaelistria did already merge that change into lsp4e. See: https://git.eclipse.org/r/c/lsp4e/lsp4e/+/170859 So... can someone help figure out why the build isn't happy? |
Signed-off-by: Kris De Volder <[email protected]>
8219188
to
22f9c78
Compare
Thanks Kris. Note that another possibility would be that you manage to implement support for the |
Okay, no problem.
Sure. I'll post a message to lsp4edev list shortly as you suggest.
I was assuming we keep pursuing the LSP protocol PR independently in parallel. Also I don't see how it would solve the 'we don't want to use snapshot build right now' concern. We'd still need a change to lsp4e to adopt the new standard protocol and so also a new release/snapshot would be needed. I think. So it just adds more steps in between that need to be done before the release. |
Right, but those steps are more definitive and will be required anyway in a near future; while here is means we do a series of steps for the interim solution, then some steps for the final solution and then some steps to undo the interim. That greatly increase the cost of the feature implementation. |
Okay, wait, I think I didn't fully understand what you were saying at first. You suggesting we implement the 'client/executeCommand' message directly in lsp4j / lsp4e and then we don't even need this PR? Actually yes that makes sense to me. Are you fine with doing it this way even without yet having a 'formal' acceptance of the LSP PR to become officially part of the protocol? If so, yes, I agree that might actually be the best solution. But if we have to first work through LSP protocol acceptance, then maybe it takes too long and I think we should probably stick with the custom protocol instead. |
I'd be fine from my LSP4E-centric perspective; however I think the LSP4J people may have some other (fair) considerations. I think it's more or less their call here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a request to release LSP4E soon, with the CommandExecution class made public, so we'll probably merge it before 2020-12 if it still makes sense until then.
In the meantime please ensure that
- .target file references the snapshots of TM4E (so CommandExecutor is visible)
- the minimal version for org.eclipse.lsp4e in org.eclipse.wildwebdeveloper.xml is 0.10.0 (which does expose CommandExecutor)
Is that correct? Near as I can tell the 'master clone' of lsp4e in my workspace is version 0.13.4. So that should be one where we added 'CommandExecutor' as public api? |
I don't understand. Did you mean LSP4E snapshot (instead of TM4E)? Earlier you said we should not depend on the snapshot so now I'm confused. |
Signed-off-by: Kris De Volder <[email protected]>
Sorry, you're right, it's LSP4E 0.13.4, I'm lost in too many topics these days... And keep in mind is not really a "public api" but more a temporary exposure of internal stuff until we completed the same story more elegantly ;) |
@mickaelistria I've made the changes I think you wanted but not sure I understood what you wanted (see my confusion / questions above). Please have a look at the changes in last commit and let me know :-) Link to latest commit for easy access/inspection: BoykoAlex@afdde86 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please bump the version of the bundle to 0.10.0 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Version in the pom.xml must be matching the version in MANIFEST.MF (except that .qualifier is to be replaced by -SNAPSHOT). You can try tocal builds with mvn verify
to see such issues more immediately.
It's possible that some other features need similar change as a result of the bundle changing.
I allways forget to modify the pom on version bumps :-( Thanks for the tip on
Not really sure this is an actual problem or not, or just something about running the build locally on my machine. So I'll just push the change adn see what jenkins makes of it. |
61439ed
to
8514f2f
Compare
Signed-off-by: Kris De Volder <[email protected]>
8514f2f
to
6079efd
Compare
I've merged a commit that's partly conflicting here, adding 1 level of annoyance ;) |
Signed-off-by: Kris De Volder <[email protected]>
Signed-off-by: Kris De Volder <[email protected]>
I noticed, pushed something to try and address that conflict already. |
There a test fail now. I'd try running this test locally in my runtime workbench, but I'm not sure how to satisfy the dependency on:
So at the moment I can't get the test compiling / running. |
This is merged now. Thanks a lot Alex and Kris! |
@mickaelistria Thanks a lot for shepherding this through :-) |
Thanks even more to you for keeping this change moving forward despite my numerous change requests! |
Trying to 'consume' this in STS builds but we can't it seems because of:
This is 'pinning' us to version 9.0.0. |
Support for handling
xml/executeClientCommand
request.First attempt to find a matching command registered by one of the Language Servers.
Try to execute eclipse registered command if no LS command found.
A good chunk of client command handling logic (no LS registered command case) taken from LSP4E... Perhaps it'd make sense to make API for this in LSP4E...
Server side PR: eclipse-lemminx/lemminx#905