Skip to content

Running Kotlin file without class #321

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

Closed
dvanderleij opened this issue Dec 1, 2021 · 2 comments
Closed

Running Kotlin file without class #321

dvanderleij opened this issue Dec 1, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@dvanderleij
Copy link

Motivation

In IntelliJ I can run a Kotlin file that does not have a class: e.g. a file named Main.kt

fun main() {
    println("hello World")
}

(No enclosing class)

Description

I would like to see a run/debug button just like in Java in VScode above this main function to run this.
image

Alternatives considered

Using IntelliJ, creating a class wrapper

@fwcd fwcd transferred this issue from fwcd/vscode-kotlin Dec 1, 2021
@fwcd fwcd added the enhancement New feature or request label Dec 1, 2021
themkat added a commit to themkat/kotlin-language-server that referenced this issue Apr 25, 2022
@themkat
Copy link
Collaborator

themkat commented Sep 21, 2022

This should work in VSCode thanks to fwcd/vscode-kotlin#92. (you might need to rebuild the project before running/debugging). (debug adapter should be installed, but that happens automatically in my knowledge). Maybe we can close this issue? @fwcd

For the people curious about the same in Emacs: If you are using lsp-mode, you can activate lsp-kotlin-lens-mode to see run/debug code lenses 🙂

@dvanderleij
Copy link
Author

Hi, Haven't tested extensively as I am currently not developing any Kotlin code but the run and debug now appear in the main branch version :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants