Open gandalfas opened 2 years ago
Same problem here.
My configurations:
launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "kotlin",
"request": "launch",
"name": "Kotlin Launch",
"projectRoot": "${workspaceFolder}/app",
"mainClass": "kotlin_free_map_backend_system.KotlinApp",
"preLaunchTask": "build"
},
]
}
tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "./gradlew build -x test",
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"echo": true,
"reveal": "silent", // <== open only on problems
"focus": false,
"panel": "shared",
"showReuseMessage": true,
"clear": false
}
},
{
"label": "run",
"type": "shell",
"command": "./gradlew run",
"problemMatcher": []
},
]
}
Suggestion
I would like to be able to debug (VS Code > Run > Start Debugging) a Kotlin/JVM program - without gradle or maven. Using VS Code's Run > Start Debugging, with a breakpoint set, the program simply runs to competion without stopping.
This is akin to #15. Ability to writing kotlin code without gradle or maven.
I am using your great extension (THANKS!!) in the experimental way - with a standalone Kotlin JVM compiler, no gradle, no maven. I hope to get this working - I am new at VS Code and Kotlin, but I love them both. I plan to write simple programs with it, so I don't want to use Gradle if I can avoid it. I am coming from the slow-starting IntelliJ IDEA (CE), and so far am loving the quick VS Code tool!
So if you can, please suggest any missing files, folders, or name changes I could do to get this working (short of installing Gradle and using it), and if possible, make fixes to your debug adapter where it might be expecting a gradle artifact.
Following are some details. Please let me know if you need anything else.
Thanks so much! Kim
1. SOURCE - Main.kt
2. BUILDING - works
With VS Code, your extension, and a build task, I can successfully compile a simple program from VS Code.
3. EXECUTING - works
I started with source and .class files in the workspace root dir. There were errors in VS Code's Output Pane, Kotlin channel, that reported files missing from expected locations (dictated by gradle, I'm guessing). Based on those, I moved my source code to the 'src' subfolder and class files to the 'build\classes\kotlin\main' subfolder. That allowed me to execute the program from VS Code's Run > Run without Debugging. VS Code's Debug Console gave:
SIDE NOTE: It would be great if you could append a note to your "Support for Kotlin source files with a standalone compiler (kotlinc) is experimental." - the note could say to put your stuff into 'src' and 'build' folders.
4. DEBUGGING - fails to stop at breakpoint
The program simply runs to completion. I saw no errors that would lead me to a correct setup of files, folders, or other gradle-like setup.
Debug Console:
launch config:
5. MY ENVIRONMENT