1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- local status, mason = pcall(require, "mason")
- if not status then
- vim.notify("没有找到 mason")
- return
- end
- local status, mason_config = pcall(require, "mason-lspconfig")
- if not status then
- vim.notify("没有找到 mason-lspconfig")
- return
- end
- local status, lspconfig = pcall(require, "lspconfig")
- if not status then
- vim.notify("没有找到 lspconfig")
- return
- end
- mason.setup({
- ui = {
- icons = {
- package_installed = "✓",
- package_pending = "➜",
- package_uninstalled = "✗",
- },
- },
- })
- mason_config.setup({
- ensure_installed = {
- "lua_ls",
- "tsserver",
- "tailwindcss",
- "bashls",
- "cssls",
- "dockerls",
- "emmet_ls",
- "html",
- "jsonls",
- "pyright",
- "rust_analyzer",
- "taplo",
- "yamlls",
- "gopls",
- "clangd",
- "cmake",
- },
- })
- local servers = {
- lua_ls = require("lsp.config.lua"),
- bashls = require("lsp.config.bash"),
- pyright = require("lsp.config.pyright"),
- html = require("lsp.config.html"),
- cssls = require("lsp.config.css"),
- emmet_ls = require("lsp.config.emmet"),
- jsonls = require("lsp.config.json"),
- tsserver = require("lsp.config.typescript"),
- yamlls = require("lsp.config.yamlls"),
- dockerls = require("lsp.config.docker"),
- tailwindcss = require("lsp.config.tailwindcss"),
-
- taplo = require("lsp.config.taplo"),
- gopls = require("lsp.config.gopls"),
- remark_ls = require("lsp.config.markdown"),
- clangd = require("lsp.config.clangd"),
- cmake = require("lsp.config.cmake"),
- }
- for name, config in pairs(servers) do
- if config ~= nil and type(config) == "table" then
-
- config.on_setup(lspconfig[name])
- else
-
- lspconfig[name].setup({})
- end
- end
|