Skip to content
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

Incorrect classPath is used to launch debuggee #91

Open
NecroKote opened this issue Aug 13, 2024 · 2 comments
Open

Incorrect classPath is used to launch debuggee #91

NecroKote opened this issue Aug 13, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@NecroKote
Copy link

Possibly relates to #69

I stumbled upon similar issue while I was trying to launch a Ktor application.

After some debugging, I traced the root cause to the fact that DebugAdapter re-uses classPath discovery mechanism of kotlin-language-server and by default it only takes into account compileClasspath while it should use runtimeClasspath

For me, the issue was fixed after I've build my own debugAdapter with modified KLS with it.compileClasspath.forEach replaced with it.runtimeClasspath.forEach.

@fwcd can you please shed some light on the reason why debug adapter launches a "debuggee" with it's compile time dependencies and not runtimeDependencies ? I might be able to contribute if I understand the context better.

Sorry for the ping, and thanks for the great work you did!

@fwcd
Copy link
Owner

fwcd commented Aug 13, 2024

You are right, it should probably use the runtime classpath instead. I suggest adding a parameter (e.g. a flag that defines whether to use the compile/runtime classpath) to the upstream Gradle class path resolver in KLS, so we can still share most of the logic, haven't looked into what the best way of passing arguments to Gradle scripts is though. Feel free to open a PR.

@NecroKote
Copy link
Author

@fwcd hopefully I get it all right :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants