-
Notifications
You must be signed in to change notification settings - Fork 23
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
Question:executeCommand #470
Comments
Badly it doesn't exists a clean API which get LanguageServerItem form a given language server id. We need to provide it. |
We want to avoid doing that because as soon as we say that LanguageServiceAccessor is an API we will not able to do refactoring. And we prefer providing high level API like https://github.com/redhat-developer/lsp4ij/blob/main/docs/DeveloperGuide.md#language-server-manager Pay attention with your code:
|
fine, hope you can develop an API that can be called from other actions or windows. |
Our mail goal is to have a relevant and clean API. That's why we prefer developping API according the issues like you have written instead of trying to imagine non concrete usecases. When I will find time I will develop something. |
@pl0301 I have managed your use case in #543 (you can read the DeveloperGuide), but the idea is that you can write that: Command command= new Command("My command", "command.from.your.ls");
LSPCommandContext commandContext = new LSPCommandContext(command, project);
commandContext.setPreferredLanguageServerId("myLanguageServerId");
CommandExecutor.executeCommand(commandContext); |
Thank you! Your work is extremely valuable. |
@fbricon said me that in your sample you get the result and executeCommand return just a boolean. I need to investigate if it is possible to return something. But My PR provides which returns a LanguageServerManager.getInstance(project)
.getLanguageServer("myLanguageServerId")
.thenAccept(languageServerItem -> {
if (languageServerItem != null) {
// Language server item exists here...
// Get the LSPJ LanguageServer
org.eclipse.lsp4j.services.LanguageServer ls = languageServerItem.getServer();
// Do something with the language server
}}); so you could manage you usecase with this new API,but let me try to improve again the executeCommand. |
ok |
Ok, I manage that now,here a sample: Command command = new Command("My command", "command.from.your.ls");
LSPCommandContext commandContext = new LSPCommandContext(command, project);
commandContext.setPreferredLanguageServerId("myLanguageServerId");
CommandExecutor.executeCommand(commandContext)
.response()
.thenAccept(r -> {
// Do something with the workspace/executeCommand Object response
}); |
@pl0301 please try installing nightly-builds, read doc at https://github.com/redhat-developer/lsp4ij/blob/main/docs/DeveloperGuide.md#execute-a-command For more information ,see #561 |
Hello, I'm in the process of integrating LSP4IJ and would like to create a window for interacting with LSP commands. I have a question: how can I obtain the server within my custom window class?
The text was updated successfully, but these errors were encountered: