mfussenegger / nvim-jdtls

Extensions for the built-in LSP support in Neovim for eclipse.jdt.ls
GNU General Public License v3.0
979 stars 62 forks source link

Allow partial overrides of the default config #647

Closed SOberhoff closed 3 months ago

SOberhoff commented 3 months ago

Problem Statement

I'm trying to setup nvim-jdtls with the following config:

local jdtls_config = {
  settings = {
    java = {
      configuration = {
        runtimes = {
          {
            name = "JavaSE-21",
            path = "/path/to/java21",
          }
        }
      }
    }
  }
}
require("jdtls").start_or_attach(jdtls_config)

However, when I do this I get: Failed to run "config" for nvim-jdtls ~/.local/share/nvim/lazy/nvim-jdtls/lua/jdtls/setup.lua:275: bad argument #1 to 'concat' (table expected, got nil).

I'm happy with the default config for cmd. I don't want to type it out again. Moreover, the error message is more than a little obtuse. It doesn't properly handle the case where cmd is nil.

Ideas or possible solutions

If cmd is nil, set it to the default.

mfussenegger commented 3 months ago

Sounds like something specific to lazy? There is no default cmd, and I'm not going to add one

SOberhoff commented 3 months ago

Okay, how about at least not passing a nil cmd to table.concat so the user gets a better error message?