/ nvim / lua / lsp / servers / lua.lua
lua.lua
 1  return {
 2    {
 3      'neovim/nvim-lspconfig',
 4      opts = {
 5        codelens = {
 6          enabled = true,
 7        },
 8        servers = {
 9          lua_ls = {
10            settings = {
11              Lua = {
12                completion = {
13                  callSnippet = 'Both',
14                },
15                runtime = {
16                  -- Portable paths for macOS and Linux (same config everywhere)
17                  path = {
18                    '?.lua',
19                    '?/init.lua',
20                    '?/?.lua',
21                    vim.fn.expand('$HOME/.dotfiles/lua_modules/share/lua/5.4/?.lua'),
22                    vim.fn.expand('$HOME/.dotfiles/lua_modules/share/lua/5.4/?/init.lua'),
23                  },
24                  version = 'Lua 5.4',
25                },
26  
27                diagnostics = {
28                  globals = {
29                    'after_each',
30                    'before_each',
31                    'describe',
32                    'it',
33                    'require',
34                    'vim',
35                    'hs',
36                  },
37                  workspace = {
38                    library = {
39                      [vim.fn.expand('$VIMRUNTIME/lua')] = true,
40                      [vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true,
41                      maxPreload = 1000,
42                      preloadFileSize = 1000,
43                    },
44                  },
45                },
46              },
47            },
48          },
49        },
50      },
51    },
52  }