Closed nela closed 1 year ago
Was the application built before debugging? I have gotten some weird errors if not building, or if build is older.
Yep, the application(s) build and run successfully.
$ ./gradlew build
BUILD SUCCESSFUL in 1s
8 actionable tasks: 8 up-to-date
Also built and run prior to running debugger.
Would it be possible for you to log the request/responses (json objects) of the debug adapter to file? (in Emacs I can do this with dap-print-io
, but unsure about the various vim-variants). Might be that the neovim plugin sends data in a way that confuses the language server or something :/ Would be easier to look for possible issues in that regard if I could see the request/responses. Larger chunks of the logs might also help if you could upload that :)
Tried cloning the quickstart project now, and was able to use it without issues in Emacs. The arguments you have supplied seems to be the same as I used when setting up the dap-kotlin setup in Emacs (might be worth a look for inspiration in case I have overlooked something above).
Thanks for the reply! I've been looking into the issue and it turns out that it the error indeed was with nvim-dap and the way it handles thread execution. Here is the link to the discussion and fix for the problem. Although, there still might be some issues regarding two stopped events for the same thread without any continue/step in-between - see this comment
Here is a gist showing full logs between nvim-dap end Kotlin Debug Adapter.
I am also experiencing some issues with the spring boot projects. Using a spring-boot-kotlin demo, the Debugger seems to have problems with dependency resolutions. Here is the output I get when trying to set breakpoints and debug:
[INFO] main Connected to client
[INFO] async1 Found mvn at /home/nela/.local/share/asdf/shims/mvn
[INFO] async1 Run [/home/nela/.local/share/asdf/shims/mvn, dependency:list, -DincludeScope=test, -DoutputFile=/tmp/deps15176148338603586867.txt, -Dstyle.color=never] in /home/nela/projects/kotlin-tutorials/spring-boot-kotlin
[INFO] async1 Run [/home/nela/.local/share/asdf/shims/mvn, dependency:sources, -DincludeScope=test, -DoutputFile=/tmp/sources2061694013933146372.txt, -Dstyle.color=never] in /home/nela/projects/kotlin-tutorials/spring-boot-kotlin
[WARN] async1 Couldn't find io.netty:netty-transport-native-epoll:4.1.34.Final in /home/nela/.m2/repository/io/netty/netty-transport-native-epoll/4.1.34.Final/netty-transport-native-epoll-4.1.34.Final.jar
[INFO] async1 Run [/home/nela/.local/share/asdf/shims/mvn, dependency:list, -DincludeScope=test, -DoutputFile=/tmp/deps3469807033879373704.txt, -Dstyle.color=never] in /home/nela/projects/kotlin-tutorials/spring-boot-kotlin
[INFO] async1 Found 120 artifacts in /home/nela/projects/kotlin-tutorials/spring-boot-kotlin/pom.xml
[WARN] async1 Couldn't find io.netty:netty-transport-native-epoll:4.1.34.Final in /home/nela/.m2/repository/io/netty/netty-transport-native-epoll/4.1.34.Final/netty-transport-native-epoll-4.1.34.Final.jar
[INFO] async1 Starting JVM debug session with main class com.baeldung.springbootkotlin.KotlinDemoApplication
Error: Main method not found in class com.baeldung.springbootkotlin.KotlinDemoApplication, please define the main method as:
public static void main(String[] args)
or a JavaFX application class must extend javafx.application.Application
[INFO] eventBus Sent exit event
I find it strange that warnings for not finding libs is issued, because they do exists on the specified path. I assume this has something to do with setting the mainClass in spring boot projects. Any advice on how to approach this?
@nela , Have you named the class with @JvmName
? If not I would guess that you could add Kt
to the end of the name to make it work. Something like com.baeldung.springbootkotlin.KotlinDemoApplicationKt
. The Kotlin compiler adds Kt to the filenames when generating classes.
The issue must have been the improper mainClass configuration. Anyhow, my initial issue was resolved as stated above so I'll go ahead and close this. Thanks for the help!
@nela i also had issues with the auto_continue_if_many and dependency injections. keen to understand if you were able to effectively write and debug in neovim on these more complex projects. how did it go?
@mairs8 I've managed to get it working with this config, although it's been some time since I've used it so some tweaking might be necessary. I did use it for a short time, however, it kept bothering me that it data was shown in a Java context, rather than Kotlin context. Ultimately, I had to switch to IntelliJ due to the performance difficulties of Kotlin LSP and DAP.
Hey,
Thanks for your work on this project! Looking forward to using it. I am however unable to use it properly yet. I use neovim with nvim-dap for my current setup.
System
Setup
Relevant configuration (hardcoded the paths to ensure it is working properly - changed when testing different projects):
Issues
I'm having troubles with stopping at breakpoints and continuing execution after the breakpoint.
Using the Kotlin Quick Start, the debugger is unable to stop at given breakpoints. It outputs the greeting line and then
[INFO] eventBus Sent exit event
. Adding a loop such as :for (i in 1..5) { println(i) }
and setting a breakpoint gives the following error:Trying it out on another project the debugger indeed stops at given breakpoints, but stepping over or continuing gives the following error:
Setting the breakpoint at another place, the debugger does execute the line under the breakpoint (it shouldn't) and produces following error:
The author of nvim-dap seems also to have tried running the Kotlin Debug Adapter, experiencing the same issues - which is why I am posting here.
Any thoughts on how to proceed with a fix?