Huge respect that you are trying to do it in an ecosystem which considers JVM/Java/Kotlin stack as almost hostile and competitive entities. As gradle is the build system chosen by OPENRNDR, I would suggest trying this integration:
However I’ve never used VS Studio, so I cannot tell much about maturity of these plugins. Knowing how fast gradle evolved in recent years, and how even JVM-native IntelliJ has sometimes troubles keeping up, I predict many obstacles on your way.
thank you for pointing that! I completely miss that way.
I just installed and wow you right that extention read gradle setting directly. but at the moment it cannot pass -P argument as terminal.
Configuration cache is an incubating feature.
Reusing configuration cache.
<==========---> 80% EXECUTING [95ms]
> :run
Error: Could not find or load main class extension 'application'Kt
Caused by: java.lang.ClassNotFoundException: extension 'application'Kt
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':run'.
> Process 'command '/home/icq4ever/.sdkman/candidates/java/17.0.5-ms/bin/java'' finished with non-zero exit value 1
for example, if I want to run src/main/kotlin/example/Example01.kt, terminal command like this
$ ./gradlew run -Pexample.Example01
gradle extension should work. I’ll take a deeper look.
well, my approach mainly rely on shell script so can be used in vim or other terminal based editor.
Executing task: gradle: run
Configuration cache is an incubating feature.
Reusing configuration cache.
<==========---> 80% EXECUTING [571ms]
> :run
Error: Could not find or load main class extension 'application'Kt
Caused by: java.lang.ClassNotFoundException: extension 'application'Kt
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':run'.
> Process 'command '/home/icq4ever/.sdkman/candidates/java/17.0.5-ms/bin/java'' finished with non-zero exit value 1
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
> Task :run FAILED
3 actionable tasks: 1 executed, 2 up-to-date
Configuration cache entry reused.
Could not execute build using connection to Gradle distribution 'https://services.gradle.org/distributions/gradle-7.6-bin.zip'.
* The terminal process terminated with exit code: 1.
Update: Ah I see what I did wrong. I just need to drop the .vscode folder and the openrndr-vscode-launcher.sh file inside openrndr-template.
Then it actually worked! For the 3 .kt files I tested. When I pasted Other.kt into foo it even added the right package automatically.
More feedback: I installed the Kotlin extension but I don’t know why most of the code is marked as an error, even if I can run it fine. I restarted the language server but it didn’t help.
And something minor: in Idea I can type drawer.stroke = WHITE and it will autocomplete to ColorRGBa.WHITE but vscode doesn’t do that. This is very convenient in Idea because it shows the constants I’m allowed to use in a given line.
and for the reason why kotelin extension not work properly because “kotlin language server”, not support “1.8.0” yet. (we talked about that last time here). it will work as change “1.8.0” to “1.6.0” here .
after change it, restart kotlin language server by command prompt in vscode.
kotlin extension start index for a while, and as soon as it ready, you can see code suggestion like this.
++ PLUS
sometimes kotlin language server is not launching because it cannot find proper JAVA bin.
in this case you can set java JAVA_HOME path in vscode setting for kotlin settings.
you can find JAVA_HOME by which java in terminal.
(FYI, I installed JAVA with sdk man)
Thank you, yeah I already forgot about the 1.6.0 vs 1.8.0 hehe
Maybe when this is updated in the Kotlin language server repo we could include the .vscode folder in openrndr-template, or at least create a openrndr-vscode-template so then one can just clone and start working
yeah that sounds good maybe add integrate with vscode? for advanced user.
btw I’m struggling with on windows. shellscript is not compatible with git bash. (‘/’ is not recognized with it)
so anyone have a experience with windows powershell, or cmd, git bash. it might be super helpful.