lazyvim: change default settings

47 Views Asked by At

I'm using lazyvim and I'm trying to change some default settings:

According to documentation here seems that I'm able to change default root_dir detection.

It's not clear to how to chage that. I mean, By default, it's picking default root_dir detection from lspconfig.

Default lspconfig jdtls configuration is here and you can find jdtls.lua lspconfig file here. You can also to see how to lsp_config populate it on default_config.root_dir here.

I need to change to:

{'.git', 'mvnw', 'gradlew'}

Also, I've tried to change nvim-jdtls plugin settings using this code snipped on _/lua/plugins/jdtls-change-root.lua:

return {
  {
    "mfussenegger/nvim-jdtls",
    ---@type lspconfig.options.jdtls
    ---@diagnostic disable-next-line: missing-fields
    opts = {
      jdtls = function(opts)
        local root_dir = {{'.git', 'mvnw', 'gradlew'}}
        table.insert(opts.root_dir, root_dir)

        return opts
      end,
    },
  },
}

But something is wrong in that code. Any ideas?

0

There are 0 best solutions below