fwcd / kotlin-debug-adapter

Kotlin/JVM debugging for any editor/IDE using the Debug Adapter Protocol
MIT License
119 stars 23 forks source link

Pass launch arguments. Pass JVM -D??? args. #16

Open ru5t opened 5 years ago

ru5t commented 5 years ago

Triying do debug Dropwizard project. It supposed to be launched with command line args like this: java -jar ???.jar server config.yml. So when launched I need to pass args server config.yml. From launch.json sample I don't see how is it possible. Also looking at source I don't see it either.

Also sometimes there's need to pass jvm args like this -Dlogback.configurationFile=/path/to/logback.xml

How can it be done?

fwcd commented 5 years ago

Command line arguments are not yet supported.

To implement these, the launch configuration (on the VSCode side) would require the specificiation of an additional args property:

https://github.com/fwcd/KotlinDebugAdapter/blob/017929c84d624d8ac090a2bbe7ced2ed55b1e8bc/package.json#L65-L97

On the server side, the initialization method would have to be updated accordingly:

https://github.com/fwcd/KotlinDebugAdapter/blob/017929c84d624d8ac090a2bbe7ced2ed55b1e8bc/src/main/kotlin/fwcd/ktda/adapter/KotlinDebugAdapter.kt#L84-L104

minkir014 commented 5 years ago

Is the args parameter in the launch method on the server side related to the args on launch.json configuration on the client side?

fwcd commented 4 years ago

Should be fixed as of #41.

philipbel commented 4 months ago

I think this should be reopened. I don't believe #41 addresses @ru5t's original issue...

vmArguments get passed to the JVM and cannot be used to pass arguments to the Java application itself.

For example, following snippet will call java --foo [...] App which fails because java doesn't recognize the argument.

{
    // ...
    "mainClass": "App",
    "vmArguments": "--foo"
}

As a workaround, I am using

{
    // ...
    "mainClass": "App --foo",
}

which seems to work, as java passes --foo to the main method. Still, having support args is the solution.