summaryrefslogtreecommitdiff
path: root/lua/plugins/jdtls.lua
blob: 980234ad4013554da3f0c9e2efd846224fd174f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
return {
  "mfussenegger/nvim-jdtls",
  optional = true,
  opts = {
    jdtls = function(config)
      if not vim.g.user_is_termux then
        config.cmd = vim.list_extend(vim.deepcopy(config.cmd), {
          "--jvm-arg=-Xms8g",
          "--jvm-arg=-Xmx16g",
        })
      end
      if LazyVim.has("spring-boot.nvim") then
        config.init_options = config.init_options or {}
        config.init_options.bundles =
          vim.list_extend(vim.deepcopy(config.init_options.bundles or {}), require("spring_boot").java_extensions())
      end

      config.settings = {
        java = {
          format = {
            enabled = true,
            settings = {
              url = vim.fn.expand("~/.config/nvim/files/JavaStyle.xml"),
              profile = "JavaStyle",
            },
          },
          inlayHints = {
            parameterNames = {
              enabled = "all",
            },
          },
        },
      }

      return config
    end,

    -- Disable java-test-engine in favor of neotest
    test = false,
  },
}