vim.diagnostic.config({ -- only show virtual text for WARN and higher virtual_text = { severity = { min = vim.diagnostic.severity.WARN } }, }) vim.lsp.enable("bashls"); vim.lsp.enable("eslint"); if vim.fn.executable("dprint") == 1 then local version = vim.version.parse(vim.fn.system("dprint --version")) if vim.version.cmp(version, {0,45,0}) >= 0 then vim.lsp.enable("dprint") end end if vim.fn.executable("deno") == 1 then vim.lsp.enable("deno"); else require('typescript').setup({ server = { init_options = { completionDisableFilterText = true, preferences = { importModuleSpecifierPreference = 'non-relative', -- this prevents renames from aliasing when destructuring providePrefixAndSuffixTextForRename = false, }, }, handlers = { ['$/typescriptVersion'] = function(err, result, ctx, config) vim.notify(string.format('Typescript %s', result.version)) end }, flags = { debounce_text_changes = 150, }, on_init = function(client) -- mark tsserver as not having formatting available as we rely on -- eslint and dprint for that client.server_capabilities.documentFormattingProvider = false client.server_capabilities.documentRangeFormattingProvider = false end, } }) end if vim.fn.executable("gopls") == 1 then vim.lsp.enable("gopls") end if vim.fn.executable("ruby-lsp") == 1 then vim.lsp.config("ruby_lsp", { init_options = { enabledFeatures = { formatting = false, }, } }) vim.lsp.enable("ruby_lsp") end if vim.fn.executable("nil") == 1 then vim.lsp.enable("nil_ls") end if vim.fn.executable("jdtls") == 1 then vim.lsp.config("jdtls", { handlers = { ["$/progress"] = function() -- this is quite noisy so just disable it end }, }) vim.lsp.enable("jdtls") end -- custom LSP servers vim.lsp.config("elvish", { cmd = {'elvish', '--lsp'}, filetypes = {'elvish'}, settings = {}, }) vim.lsp.enable("elvish")