servers.lua (1276B)
1 -- Custom configuration for servers 2 local M = {} 3 4 function M.lua_ls(opts) 5 opts.settings = { 6 Lua = { 7 telemetry = { 8 enable = false, 9 }, 10 }, 11 } 12 return opts 13 end 14 15 function M.yamlls(opts) 16 opts.settings = { 17 yaml = { 18 -- 19 schemas = require('schemastore').json.schemas(), 20 validate = { enable = true }, 21 }, 22 } 23 return opts 24 end 25 26 function M.cssls(opts) 27 opts.capabilities.textDocument.completion.completionItem.snippetSupport = true 28 return opts 29 end 30 31 function M.emmet_ls(opts) 32 opts.root_dir = function(path) 33 vim.fs.dirname(vim.fs.find({ '.git', vim.fn.getcwd() }, { path = path, upward = true })[1]) 34 end 35 return opts 36 end 37 38 function M.gopls(opts) 39 opts.cmd = { 'gopls' } 40 opts.filetypes = { 'go', 'gomod', 'gowork', 'gotmpl' } 41 opts.root_dir = vim.fs.dirname(vim.fs.find({ 'go.work', 'go.mod', '.git', vim.fn.getcwd() }, { upward = true })[1]) 42 return opts 43 end 44 45 function M.html(opts) 46 opts.init_options = { provideFormatter = false } 47 return opts 48 end 49 50 function M.intelephense(opts) 51 opts.init_options = { 52 clearCache = true, 53 licenceKey = os.getenv('XDG_CONFIG_HOME') .. '/intelephense/licenceKey.txt', 54 globalStoragePath = os.getenv('XDG_CONFIG_HOME') .. '/intelephense', 55 } 56 return opts 57 end 58 59 return M