Support for `.jar` files in tasks and debugger

Aperta
#220 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
15/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
java
Ambito
tooling

Direzione di ricerca

The payload shows a user's workaround using .zed/debug.json (javac build step and Java debug launch), .zed/tasks.json (a run task), and .zed/settings.json (jdtls referencedLibraries pointing at MyJar.jar). The open question is whether the extension should detect .jar files on its own, which the issue leaves to the maintainers. Starting work means deciding that design first, then checking how the extension's debugger and jdtls setup handle classpath entries. Done would mean an agreed approach plus tests or docs.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

I’m not sure how the maintainers would like to implement this, but it would be great to have support for .jar files without any configuration or at least some mention of it in the documentation for this extension. Below is an example of the Zed settings files I’ve created to make jar files work in my project. I haven’t done much research on this, but I just wanted to get the conversation started. I’m also not sure if using a lib/ folder is better, but here’s the current project structure:

./
├── .zed/
│   ├── debug.json
│   ├── settings.json
│   └── tasks.json
├── MyJar.jar
├── bin/
└── src/
    ├── Main.java
    └── ExampleFile.java
// .zed/debug.json
[
    {
        "label": "Debug $ZED_STEM",
        "adapter": "Java",
        "request": "launch",
        "mainClass": "$ZED_STEM",
        "build": {
            "command": "javac -cp $ZED_WORKTREE_ROOT/MyJar.jar -d $ZED_WORKTREE_ROOT/bin $ZED_WORKTREE_ROOT/src/*.java",
            "shell": {
                "with_arguments": {
                    "program": "/bin/sh",
                    "args": ["-c"],
                },
            },
        },
    },
]
// .zed/settings.json
{
    "lsp": {
        "jdtls": {
            "initialization_options": {
                "project": {
                    "sourcePaths": ["src"],
                },
                "settings": {
                    "java": {
                        "project": {
                            "referencedLibraries": ["MyJar.jar"],
                        },
                    },
                },
            },
        },
    },
}
// .zed/tasks.json
[
    {
        "label": "Run Main with jar",
        "command": "find . -name '*.java' -not -path './bin/*' -print0 | xargs -0 javac -cp MyJar.jar -d bin && java -cp 'bin:MyJar.jar' Main",
        "use_new_terminal": false,
        "reveal": "always",
        "shell": {
            "with_arguments": {
                "program": "/bin/sh",
                "args": ["-c"],
            },
        },
    },
]
Lingua principale
Rust
Stelle
225
Fork
47
Merge medio
3h 51m
PR unite (30g)
7

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di zed-extensions/java

Tutte le issue di zed-extensions/java

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.