aboutsummaryrefslogtreecommitdiffstats
path: root/lua/pi/lsp/servers/lua_ls.lua
blob: c6419119894d9b31342f65d811b5d0e06fff01f7 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
local lsp_attach = require "pi.lsp.attach"
local lsp_flags = require "pi.lsp.flags"

return function(ops)
  if ops.neodev == true then
    -- Setup neodev with explicit configuration for native LSP
    require("neodev").setup {
      library = {
        enabled = true,
        runtime = true,
        types = true,
        plugins = true,
      },
      setup_jsonls = true,
      lspconfig = false, -- Don't let neodev override lspconfig setup
    }
  end
  
  local capabilities = require("blink.cmp").get_lsp_capabilities(vim.lsp.protocol.make_client_capabilities())
  
  return vim.tbl_extend("force", {
    cmd = { "lua-language-server" },
    filetypes = { "lua" },
    capabilities = capabilities,
    on_attach = lsp_attach,
    flags = lsp_flags,
    settings = {
      Lua = {
        runtime = {
          version = "LuaJIT",
        },
        diagnostics = {
          globals = { "vim" },
        },
        workspace = {
          library = vim.api.nvim_get_runtime_file("", true),
          checkThirdParty = false,
        },
        telemetry = {
          enable = false,
        },
        hint = {
          enable = true,
          -- Disable some problematic hints that might cause position issues
          setType = false,
          paramType = true,
          paramName = "Disable", -- Can be "All", "Literal", "Disable"
          semicolon = "Disable", -- Can be "All", "SameLine", "Disable"
          arrayIndex = "Disable", -- Can be "All", "Auto", "Disable"
        },
        completion = {
          callSnippet = "Replace",
        },
      },
    },
  }, ops)
end