-
-
Notifications
You must be signed in to change notification settings - Fork 305
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
Provide a Language Server for bnd instructions #5833
Comments
I think the current documentation in LSP4J ( https://github.com/eclipse-lsp4j/lsp4j/blob/main/documentation/README.md ) already gives good advice. I suggest you get started from there, and if you have further questions, you may try opening issues against LSP4J to ask for details. |
I did some work in this a couple of years ago. I maintain a LSP in the Alloys projects and it was easier than I thought. Although I was highly disappointed how many functions still required client side code. There is a Red Hat project that uses LSP for Gradle + Maven. Seeing it was OSGi based I thought it would be easy to integrate bnd support there. I think this would still be a very valid approach but the code base, based on Maven, did not build out of the box and I could not get it to work quickly. They do not have some nice extension mechanism like services that I could see. However, combining effort with this would imho be the best approach. If bnd(tools) has any future, then I think it would be in this direction. I am interested in pursuing this further if some other people are interested. |
@pkriens I think a standalone LanguageServer would be sufficient here, I would expect it to have similar features like current BNDEditor but still things can be made on top of this on clientside so to summarize:
|
Hi Peter, thanks for this hint. We currently trying different approaches with the LSP and wanna start something within next year. Guido is already trying to get firm with all that stuff. We are really interested to get something work in that direction |
@mickaelistria What I'm missing a bit is how to get a minimal working example e.g having a document with just for example one keyword ... last time I played around with LS it was quite hard to get something basic working ... |
This is a very minimal LS for Alloy made specifically for Alloy: https://github.com/AlloyTools/org.alloytools.alloy/tree/master/org.alloytools.alloy.lsp It works like a charm on VS Code but does require a lot of client side code. I once tried to quickly change it for bnd but Eclipse started to force me to do all kinds of Eclipse specific extension points and the Eclipse LSP client wasn't, I recall, overly impressive. I think Vogella has a tutorial on LSP. We could setup a meeting to have a short discussion. It might be related to any PDE efforts. An LSP approach would have a huge number of advantages. |
I do not think it would harm to see if any code could also be made to run in the Red Hat LSP. From what I know of it, that shouldn't be too hard. |
I agree with Peter regarding the Eclipse stuff in LSP4E. But here are my current links: https://www.vogella.com/tutorials/EclipseLanguageServer/article.html |
This was very useful for me: https://www.vogella.com/tutorials/EclipseLanguageServer/article.html |
If we get some active interest & commitments to work on this I suggest we move this work to a branch & a PR? |
I'll probably do some prototyping the next days... |
LanguageServer server = new LanguageServer() {
//...
@Override
public TextDocumentService getTextDocumentService() {
return new TextDocumentService() {
//...
@Override
public CompletableFuture<Either<List<CompletionItem>, CompletionList>> completion(CompletionParams position) {
return CompletableFuture.completedFuture(Either.forLeft(List.of(new CompletionItem("keyword"));
}
};
Launcher<LanguageClient> launcher = LSPLauncher.createServerLauncher(server, System.in, System.out); Just looking for createServerLauncher on GitHub should give some example. I used to show https://github.com/mickaelistria/eclipse-languageserver-demo/blob/master/Le LanguageServer de Chamrousse/ in demos, which is basic Java code allowing to complete track names and validating routes on the local ski resort, it's basic Java code.
While the goal is not to make it impressive, your feedback about what can be missing in LSP4E is welcome on LSP4E issues channels. Note that LSP is unavoidable, and LSP4E is the only Eclipse client that is likely to ever exist, so don't expect much alternative ;) I support the idea that the BND Language Server should try to remain independent from JDT or any other Language Server and should try to work standalone. |
Branch would be great. |
@mickaelistria Thank you for the snippets and the hints! |
The correct URL is https://github.com/mickaelistria/eclipse-languageserver-demo/tree/master/Le%20LanguageServer%20de%20Chamrousse |
Thats looking very interesting, I think it would be great to link such "starter" projects at https://github.com/eclipse-lsp4j/lsp4j/blob/main/documentation/README.md#implement-your-language-server (maybe also the one from @pkriens and other implementations) |
I now created: to just have some branch for experimenting / pushing code and sharing current state ... the server part hopefully will then approach in bndlib some times soon so PDE only will consume that later on. |
I am unclear on this now? Are we going to make an LS in bnd or will it happen elsewhere? If it is going to happen elsewhere, please close this issue. If it is going to happen here, I think we should create a branch and maybe project? |
This all depends abit on the people working on it, I think it would make much sense if it would be part of "bndlib" somehow so it can evolve with changes there and then can be consumed by an artifact (lsp4j based). The client-side might be part of "bndtools" then for eclipse side, not sure if anyone has experience regarding vscode and/or intellij and if it makes sense to provide client here as well. |
More direct, what is the plan? Should we create a branch on this repository so people can collaborate? Who would be seriously interested to work on this? I do not want this issue to linger for months and then moved to abeyance by the stale bot. |
We are really interested doing some work. So I think a seperate branch would be fine for us. |
Created a new branch feature/lsp Issues can now be discussed in #5861. If needed I can enable projects if we get many people to collaborate? |
The Language Server protocol is used between a tool (the client) and a language smartness provider (the server) to integrate features like auto complete, go to definition, find all references and alike into the tool.
Like discussed on EclipseCon2023 BND instructions seem very well suited to be provided as a LSP so it can be used in an IDE agnostic way.
For Eclipse there is https://github.com/eclipse/lsp4e to easily integrate such servers.
FYI @maho7791 @juergen-albert @stbischof ...
@mickaelistria can you give some advice here how to best start using lsp4j?
The text was updated successfully, but these errors were encountered: