Skip to content

bug: dap config not found #152

@littleghost2016

Description

@littleghost2016

Did you check docs and existing issues?

  • I have read all the plugin docs
  • I have searched the existing issues
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

NVIM v0.10.0-dev-2819+gf4df49a95

Operating system/version

Linux dev 6.6.15-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.6.15-2 (2024-02-04) x86_64 GNU/Linux

Describe the bug

I want to use lazyVim, graalvm and mvn to write springboot3 project. I have enable dap.core in lazyvim extras. When I run :JavaRunnerRunMain, the noise shows dap config not found. I run :JavaDapConfig to refresh the dap config forcely, the noise shows DAP configured. But I run :JavaRunnerRunMain, dap config not found occurs once again.

Steps To Reproduce

  1. install lazyvim
  2. follow the nvim-java installation steps with lazyvim. my config
return {
  "nvim-java/nvim-java",
  dependencies = {
    "nvim-java/lua-async-await",
    "nvim-java/nvim-java-core",
    "nvim-java/nvim-java-test",
    "nvim-java/nvim-java-dap",
    "MunifTanjim/nui.nvim",
    "neovim/nvim-lspconfig",
    "mfussenegger/nvim-dap",
    {
      "williamboman/mason.nvim",
      opts = {
        registries = {
          "github:nvim-java/mason-registry",
          "github:mason-org/mason-registry",
        },
      },
    },
    {
      "williamboman/mason-lspconfig.nvim",
      opts = {
        handlers = {
          ["jdtls"] = function()
            require("java").setup()
          end,
        },
      },
    },
  }
}
  1. update all plugins
  2. enable lazyvim extras dap.core
  3. create a new folder, create a empty file named helloworld.java
  4. use neovim open the folder. the noice shows ServiceReady, Configuring DAP and DAP configured. I write the code
public class HelloWorld {

    public static void main(String[] args) {

        // Prints "Hello, World" in the terminal window.
        System.out.println("Hello, World");
    }

}
  1. I run :JavaRunnerRunMain and the noice shows dap config not found. I run :JavaDapConfig and :JavaRunnerRunMain but it's no use.
  2. the nvim-java.log shows
[INFO  Sat 06 Apr 2024 11:55:13 PM CST] .../share/nvim/lazy/nvim-java/lua/java/startup/nvim-dep.lua:24: check neovim plugin dependencies
[INFO  Sat 06 Apr 2024 11:55:13 PM CST] ...lazy/nvim-java/lua/java/startup/lspconfig-setup-wrap.lua:11: wrap lspconfig.java.setup function to inject a custom java config
[INFO  Sat 06 Apr 2024 11:55:13 PM CST] ...ev/.local/share/nvim/lazy/nvim-java/lua/java/api/dap.lua:13: add LspAttach event handlers to setup dap adapter & config
[INFO  Sat 06 Apr 2024 11:55:19 PM CST] ...ev/.local/share/nvim/lazy/nvim-java/lua/java/api/dap.lua:48: setup java dap config & adapter
[INFO  Sat 06 Apr 2024 11:55:19 PM CST] ...ev/.local/share/nvim/lazy/nvim-java/lua/java/api/dap.lua:22: configuring dap
[DEBUG Sat 06 Apr 2024 11:55:19 PM CST] ...v/.local/share/nvim/lazy/nvim-java/lua/java/dap/init.lua:82: set dap adapter callback function
[DEBUG Sat 06 Apr 2024 11:55:21 PM CST] ...v/.local/share/nvim/lazy/nvim-java/lua/java/dap/init.lua:93: set dap config:  { {
    mainClass = "HelloWorld",
    name = "nil -> HelloWorld",
    request = "launch",
    type = "java"
  } }
[DEBUG Sat 06 Apr 2024 11:57:37 PM CST] ....local/share/nvim/lazy/nvim-java/lua/java/api/runner.lua:156: dap configs:  { {
    mainClass = "HelloWorld",
    name = "nil -> HelloWorld",
    request = "launch",
    type = "java"
  } }

the nvim-java-core.log shows

[INFO  Sat 06 Apr 2024 11:57:37 PM CST] ...share/nvim/lazy/nvim-java-dap/lua/java-dap/api/setup.lua:84: creating dap configuration for java
[DEBUG Sat 06 Apr 2024 11:57:37 PM CST] ...nvim-java-core/lua/java-core/ls/clients/jdtls-client.lua:32: executing: workspace/executeCommand - vscode.java.resolveMainClass
[DEBUG Sat 06 Apr 2024 11:57:37 PM CST] ...nvim-java-core/lua/java-core/ls/clients/jdtls-client.lua:44: vscode.java.resolveMainClass success! response:  { {
    filePath = "/home/dev/gitRepository/testNvim/helloworld.java",
    mainClass = "HelloWorld"
  } }
  1. when I use lazyvim keymap to run with args, the noice shows
   Warn  12:10:53 AM notify.warn Java Configuring DAP
   Info  12:10:54 AM notify.info Java DAP configured
   Warn  12:11:01 AM notify.warn Java Dap config not found
   Error  12:11:14 AM msg_show.lua_error Run with args:  Error executing vim.schedule lua callback: ...e/nvim/lazy/nvim-java-core/lua/java-core/utils/async.lua:41: unhandled error ...share/nvim/lazy/nvim-java-dap/lua/java-dap/api/setup.lua:55: To enrich the config, projectName should already be present
stack traceback:
	[C]: in function 'error'
	...e/nvim/lazy/nvim-java-core/lua/java-core/utils/async.lua:41: in function 'callback'
	...nvim-java-core/lua/java-core/ls/clients/jdtls-client.lua:47: in function 'handler'
	...m/nvim-linux64/share/nvim/runtime/lua/vim/lsp/client.lua:693: in function ''
	vim/_editor.lua: in function <vim/_editor.lua:0>

so I think that if the problem is the projectName. Thanks for your help!

Expected Behavior

I could run and debug java file or project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions