This package provides:
This package consumes:
Made for Pulsar!
This package was written specifically for Pulsar and did not exist in the Atom package repository.
Run Kotlin and Java files from Pulsar with one click.
A Run button over main, autocomplete and Kotlin syntax highlighting.
Lightweight, written in TypeScript, no language server required.
Run button over main: a ▶ Run button appears above every runnable main (Kotlin fun main, Java public static void main(String[] args) and Java 25 void main()), and ▶ Run Script on .kts files. Also available with F5, from the status bar, the editor context menu and Packages > Run JVM.
Debug button: Debug next to Run (or Ctrl+F5) starts the program suspended and shows how to attach a debugger (see Debugging).
Run with arguments: Run JVM > Run File With Arguments... asks for the arguments (with shell style quoting) and remembers them per file.
Fast reruns: unchanged Kotlin files are not compiled again (Using cached build).
Compiler errors in the editor: Kotlin and Java errors and warnings are marked on the line with their message, no extra package needed, and File.kt:12:5 in the panel is a link that opens the source.
Clean output: programs run in a JVM Run panel at the bottom that shows only what matters:
Compiling PlusMinus.kt...
0.5
0.3333333333333333
0.16666666666666666
Process finished with exit code 0 (2.4s)
Programs can read from stdin: type in the input line under the output and press Enter (Ctrl+D ends the input). Compiler errors are shown in red, and Shift+F5, the Stop button or Ctrl+C in the input line stops a running program.
Kotlin syntax highlighting for .kt and .kts: comments, KDoc (tags and [links]), raw strings, string templates ($name, ${expr}, multi dollar $$"..."), all number formats, annotations, declarations (including value class, fun interface, data object and context(...) parameters), generics and type parameters, named arguments, lambda parameters, implicit it, labels and operators. Java uses the grammar bundled with Pulsar.
Autocomplete for Kotlin and Java:
"abc". offers length, uppercase, substring; listOf(1). offers map, filter, size; person. offers the members of Person. The receiver type comes from literals, declared types, constructor and factory calls and chained calls ("a b".split(" ").)main, maina, fun, dataclass, when, fori, printv ...; Java main, psvm, sout, souf, fori, foreach, record, tryr ...println, listOf, buildString ...; System, String, List, HashMap, Scanner ...)${...})To run code you need, on your PATH or configured in the settings:
java 8 or newer for Kotlin, 11 or newer for Java fileskotlinc (installation guide; SDKMAN: sdk install kotlin)If they are not on PATH, KOTLIN_HOME, JAVA_HOME, SDKMAN and the usual Homebrew locations are tried. Run Run JVM > Check Setup to see what was found. Highlighting and autocomplete work without them.
If you also have the language-kotlin package installed, disable it so its grammar does not compete with this one.
| File | What happens |
|---|---|
.kt with main |
kotlinc File.kt -include-runtime -d File.jar, then java -cp File.jar <package>.FileKt |
.kts script |
kotlinc -script File.kts |
.java with main |
java File.java (the JDK source launcher compiles in memory and runs the first class) |
The file is saved before running. Compiled jars are kept in Pulsar's storage folder (~/.pulsar/storage/run-jvm-pulsar), not in your project, one per source version. Run JVM > Clear Build Cache empties it.
Only single file programs are supported for now. Gradle and Maven projects are planned.
Pulsar has no built in debugger, so Debug (the button, Ctrl+F5 or Run JVM > Debug File) runs the program with the JVM suspended and listening for a debugger. When it is ready, the JVM Run panel and a notification show the address and an attach command:
Waiting for a debugger on 127.0.0.1:41873. Attach with: jdb -attach 127.0.0.1:41873
Use Copy attach command in the notification, or connect any debugger that supports remote JVM debugging (jdb, IntelliJ IDEA's Remote JVM Debug, the VS Code Java debugger) to that port. Stop ends the wait. Kotlin scripts (.kts) cannot be debugged.
| Setting | Default | Description |
|---|---|---|
kotlinc path |
kotlinc |
Path to the Kotlin compiler. |
java path |
java |
Path to the java executable. |
Program arguments |
empty | Arguments passed to main, separated by commas. |
JVM arguments |
empty | Arguments passed to the JVM, e.g. -Xmx512m or --enable-preview, --source, 21. |
Environment variables |
empty | Variables added when the program runs, as NAME=value separated by commas, e.g. MODE=dev,LEVEL=3. |
Reuse builds |
on | Skip compiling Kotlin files that have not changed since the last run. |
Clear output |
on | Clear the JVM Run panel before each run. |
Show Run buttons |
on | Show the Run button above main. |
Workspace completion |
on | Offer declarations and members from other files of the project. |
Show compiler errors |
on | Mark compiler errors and warnings in the editor after a run. |
| Command | Key |
|---|---|
run-jvm-pulsar:run |
F5 in Kotlin and Java editors |
run-jvm-pulsar:run-with-arguments |
|
run-jvm-pulsar:debug |
Ctrl+F5 in Kotlin and Java editors |
run-jvm-pulsar:stop |
Shift+F5 in Kotlin and Java editors |
run-jvm-pulsar:toggle-output |
|
run-jvm-pulsar:clear-output |
|
run-jvm-pulsar:clear-build-cache |
|
run-jvm-pulsar:check-setup |
git clone https://github.com/romulofer/run-jvm-pulsar.git
cd run-jvm-pulsar
npm install
npm run build # bundle to dist/main.js (committed: ppm does not build)
npm test # unit and grammar tests
npm run test:integration # specs inside Pulsar (on headless Linux: xvfb-run -a npm run test:integration)
ppm link # use your working copy in Pulsar
Design notes live in docs/SPEC.md and docs/PLAN.md. Issues and pull requests are welcome.
Kotlin is a trademark of JetBrains s.r.o. Java is a trademark of Oracle and/or its affiliates. This is a community project, not affiliated with or endorsed by JetBrains, the Kotlin Foundation or Oracle.
Botão Run sobre a main: um botão ▶ Run aparece acima de toda main executável (Kotlin fun main, Java public static void main(String[] args) e Java 25 void main()), e ▶ Run Script em arquivos .kts. Também disponível com F5, pela barra de status, pelo menu de contexto do editor e por Packages > Run JVM.
Botão Debug: Debug ao lado de Run (ou Ctrl+F5) inicia o programa suspenso e mostra como conectar um depurador (veja Depuração).
Executar com argumentos: Run JVM > Run File With Arguments... pergunta os argumentos (com aspas no estilo do shell) e lembra deles por arquivo.
Reexecuções rápidas: arquivos Kotlin sem alteração não são compilados de novo (Using cached build).
Erros do compilador no editor: erros e avisos de Kotlin e Java são marcados na linha com a mensagem, sem precisar de outro pacote, e Arquivo.kt:12:5 no painel é um link que abre o código.
Saída limpa: os programas rodam em um painel JVM Run na parte de baixo, que mostra só o que importa:
Compiling PlusMinus.kt...
0.5
0.3333333333333333
0.16666666666666666
Process finished with exit code 0 (2.4s)
Os programas podem ler da entrada padrão: digite na linha de entrada abaixo da saída e pressione Enter (Ctrl+D encerra a entrada). Erros de compilação aparecem em vermelho, e Shift+F5, o botão Stop ou Ctrl+C na linha de entrada interrompe um programa em execução.
Realce de sintaxe Kotlin para .kt e .kts: comentários, KDoc (tags e [links]), strings brutas, templates de string ($nome, ${expr}, multi dólar $$"..."), todos os formatos numéricos, anotações, declarações (incluindo value class, fun interface, data object e parâmetros context(...)), generics e parâmetros de tipo, argumentos nomeados, parâmetros de lambda, it implícito, rótulos e operadores. Java usa a gramática que já vem com o Pulsar.
Autocompletar para Kotlin e Java:
"abc". sugere length, uppercase, substring; listOf(1). sugere map, filter, size; pessoa. sugere os membros de Pessoa. O tipo do receptor vem de literais, tipos declarados, chamadas de construtor e de funções de fábrica e chamadas encadeadas ("a b".split(" ").)main, maina, fun, dataclass, when, fori, printv ...; Java main, psvm, sout, souf, fori, foreach, record, tryr ...println, listOf, buildString ...; System, String, List, HashMap, Scanner ...)${...} do Kotlin)Para executar código você precisa ter, no PATH ou configurados nas opções:
java 8 ou mais recente para Kotlin, 11 ou mais recente para arquivos Javakotlinc (guia de instalação; SDKMAN: sdk install kotlin)Se não estiverem no PATH, são procurados em KOTLIN_HOME, JAVA_HOME, SDKMAN e nos locais usuais do Homebrew. Rode Run JVM > Check Setup para ver o que foi encontrado. O realce de sintaxe e o autocompletar funcionam sem eles.
Se você também tem o pacote language-kotlin instalado, desative-o para que a gramática dele não concorra com esta.
| Arquivo | O que acontece |
|---|---|
.kt com main |
kotlinc Arquivo.kt -include-runtime -d Arquivo.jar, depois java -cp Arquivo.jar <pacote>.ArquivoKt |
script .kts |
kotlinc -script Arquivo.kts |
.java com main |
java Arquivo.java (o source launcher do JDK compila em memória e executa a primeira classe) |
O arquivo é salvo antes de executar. Os jars compilados ficam na pasta de armazenamento do Pulsar (~/.pulsar/storage/run-jvm-pulsar), não no seu projeto, um por versão do código. Run JVM > Clear Build Cache esvazia essa pasta.
Por enquanto só programas de um único arquivo são suportados. Projetos Gradle e Maven estão planejados.
O Pulsar não tem depurador embutido, então Debug (o botão, Ctrl+F5 ou Run JVM > Debug File) executa o programa com a JVM suspensa, esperando um depurador. Quando estiver pronta, o painel JVM Run e uma notificação mostram o endereço e um comando para conectar:
Waiting for a debugger on 127.0.0.1:41873. Attach with: jdb -attach 127.0.0.1:41873
Use Copy attach command na notificação, ou conecte qualquer depurador que suporte depuração remota de JVM (jdb, o Remote JVM Debug do IntelliJ IDEA, o depurador Java do VS Code) a essa porta. Stop encerra a espera. Scripts Kotlin (.kts) não podem ser depurados.
| Configuração | Padrão | Descrição |
|---|---|---|
kotlinc path |
kotlinc |
Caminho do compilador Kotlin. |
java path |
java |
Caminho do executável java. |
Program arguments |
vazio | Argumentos passados para a main, separados por vírgula. |
JVM arguments |
vazio | Argumentos passados para a JVM, por exemplo -Xmx512m ou --enable-preview, --source, 21. |
Environment variables |
vazio | Variáveis adicionadas ao executar o programa, como NOME=valor separadas por vírgula, por exemplo MODE=dev,LEVEL=3. |
Reuse builds |
ligado | Não compila de novo arquivos Kotlin que não mudaram desde a última execução. |
Clear output |
ligado | Limpa o painel JVM Run antes de cada execução. |
Show Run buttons |
ligado | Mostra o botão Run acima da main. |
Workspace completion |
ligado | Sugere declarações e membros de outros arquivos do projeto. |
Show compiler errors |
ligado | Marca erros e avisos do compilador no editor depois de uma execução. |
| Comando | Tecla |
|---|---|
run-jvm-pulsar:run |
F5 em editores Kotlin e Java |
run-jvm-pulsar:run-with-arguments |
|
run-jvm-pulsar:debug |
Ctrl+F5 em editores Kotlin e Java |
run-jvm-pulsar:stop |
Shift+F5 em editores Kotlin e Java |
run-jvm-pulsar:toggle-output |
|
run-jvm-pulsar:clear-output |
|
run-jvm-pulsar:clear-build-cache |
|
run-jvm-pulsar:check-setup |
git clone https://github.com/romulofer/run-jvm-pulsar.git
cd run-jvm-pulsar
npm install
npm run build # gera dist/main.js (versionado: o ppm não faz build)
npm test # testes unitários e de gramática
npm run test:integration # specs dentro do Pulsar (em Linux sem tela: xvfb-run -a npm run test:integration)
ppm link # usa sua cópia de trabalho no Pulsar
As notas de design estão em docs/SPEC.md e docs/PLAN.md. Issues e pull requests são bem-vindos.
Kotlin é marca registrada da JetBrains s.r.o. Java é marca registrada da Oracle e/ou suas afiliadas. Este é um projeto da comunidade, sem afiliação ou endosso da JetBrains, da Kotlin Foundation ou da Oracle.