Support for `.jar` files in tasks and debugger

Aberta
#220 1 comentário 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
15/100
Tipo de issue
Funcionalidade
Clareza
Precisa de esclarecimento
Status de atividade
Estagnada
Stack de tecnologia
java
Domínio
tooling

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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"],
            },
        },
    },
]
Linguagem predominante
Rust
Estrelas
225
Forks
47
Merge médio
3h
PRs com merge (30d)
5

Preparar o ambiente

Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de zed-extensions/java

Todas as issues de zed-extensions/java

Issues semelhantes

Mais issues de Rust

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.