nopasteonlybin

lsp config

Apr 13th, 2023
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.33 KB | None | 0 0
  1. -- Automatically invoke lspconfig setup for every installed LSP server
  2. mason_lspconfig.setup_handlers {
  3.     function(server_name)
  4.         lspconfig[server_name].setup {
  5.             capabilities = capabilities,
  6.             on_attach = on_attach,
  7.             root_dir = lspconfig.util.root_pattern("package.json", "tsconfig.json",
  8.                 "jsconfig.json", ".git", ".gitignore")
  9.         }
  10.     end,
  11.  
  12.     lua_ls = function()
  13.         lspconfig.lua_ls.setup({
  14.             on_attach = on_attach,
  15.             capabilities = capabilities,
  16.             Lua = {
  17.                 runtime = {
  18.                     version = 'LuaJIT',
  19.                 },
  20.                 diagnostics = {
  21.                     globals = { "vim" },
  22.                     disable = { 'unused-local' }, -- Disable the "unused variable" error
  23.                 },
  24.                 workspace = {
  25.                     checkThirdParty = false,
  26.                     library = {
  27.                             [vim.fn.expand "$VIMRUNTIME/lua"] = true,
  28.                             [vim.fn.stdpath "config" .. "/lua"] = true,
  29.                     },
  30.                 },
  31.                 telemetry = { enable = false },
  32.             },
  33.         })
  34.     end,
  35.     pylsp = function()
  36.         lspconfig.pylsp.setup {
  37.  
  38.             on_attach = on_attach,
  39.             capabilities = capabilities,
  40.             settings = {
  41.                 plugins = { rope_autoimport = { true } }
  42.             }
  43.         }
  44.     end,
  45.  
  46.     tsserver = function()
  47.         lspconfig.tsserver.setup {
  48.  
  49.             on_attach = on_attach,
  50.             capabilities = capabilities,
  51.             cmd = { 'typescript-language-server', '--stdio' },
  52.             settings = {
  53.                 diagnostics = { ignoredCodes = { 6133 } }
  54.             }
  55.         }
  56.     end,
  57. }
  58.  
Advertisement
Add Comment
Please, Sign In to add comment