GroovyLanguageServer / groovy-language-server

A language server for Groovy — designed for Moonshine IDE, but may be useful in other environments
https://moonshine-ide.com/
Apache License 2.0
185 stars 61 forks source link

Instructions for using this within VSCode? #69

Closed solvingj closed 2 years ago

solvingj commented 2 years ago

I want to debug groovy in vscode and this project seems to be a cornerstone in making that possible, but I don't understand the details of it yet. If that is not the case, apologies and disregard or correct me if possible.

I've read this article about the similar situation with kotlin debugging in vscode:

https://medium.com/@thunderz99/debugging-kotlin-program-using-vscode-318ed43fe2f0

Apparently, the language server for kotlin is made usable in vscode by the corresponding plugin (same author):

Even with the above, the article shows that achieving debugging still requires some annoying boilerplate of tasks.json and launch.json, but that's acceptable in lieu of whatever magic makes Java debugging "just work" the way it does.

So, is it the case that someone needs to create a vscode plugin which bundles/includes/exposes this language server implementation before it can be used in vscode? Is that what is required for debugging Groovy files?

joshtynjala commented 2 years ago

There is a basic sample VSCode plugin for Groovy in this repository. You can build it locally (instructions are in the README for the sample extension) and install the .vsix file manually in VSCode.

However, this project does not implement debugging.

For reference, VSCode provides two main protocols:

1) The Language Server Protocol (LSP) is for code intelligence for a language in the code editor. 2) The Debug Adapter Protocol (DAP) is for debugging.

This project implements the LSP for Groovy, but it does not implement the DAP. This project does not provide any capabilities that would help you with debugging Groovy code in VSCode.

Since Groovy compiles to the JVM, I assume that there's a way to use a Java debugger. However, I do not know how to do that.

solvingj commented 2 years ago

Isn't debugging groovy with vscode relevant to you and your projects?

joshtynjala commented 2 years ago

Not relevant to me at this time. If it were, though, I would create a new extension for that. It's common for the LSP and DAP implementation for a language to be distributed in separate extensions.