nvim lsp: 設定好常用的程式語言

This commit is contained in:
Yuan Chiu 2025-05-05 20:11:33 +08:00
parent bf7f000533
commit 5f615e405a
6 changed files with 42 additions and 1 deletions

View File

@ -13,11 +13,15 @@ end
-- <https://wiki.archlinux.org/title/Language_Server_Protocol> -- <https://wiki.archlinux.org/title/Language_Server_Protocol>
local servers = { local servers = {
"phpactor", -- PHP "phpactor", -- PHP
"sqls", -- SQL
"pyright", -- Python "pyright", -- Python
"gopls", -- Go "gopls", -- Go
"html", -- HTML "html", -- HTML
"cssls", -- CSS "cssls", -- CSS
"volar", -- Vue3
-- "ts_ls", -- TypeScript目前暫時不需要先註解掉 -- "ts_ls", -- TypeScript目前暫時不需要先註解掉
"marksman", -- Markdown
"yamlls", -- YAML
} }
-- 載入所有的對應的 LSP server 設定 -- 載入所有的對應的 LSP server 設定

View File

@ -6,11 +6,15 @@ require("mason-lspconfig").setup {
ensure_installed = { ensure_installed = {
-- "lua_ls", "rust_analyzer" -- 官方範例 -- "lua_ls", "rust_analyzer" -- 官方範例
"phpactor", "phpactor",
"sqls",
"pyright", "pyright",
"gopls", "gopls",
"html", "html",
"cssls", "cssls",
"tsserver", "volar",
-- "ts_ls",
"marksman",
"yamlls",
}, },
-- Whether servers that are set up (via lspconfig) should be automatically installed if they're not already installed. -- Whether servers that are set up (via lspconfig) should be automatically installed if they're not already installed.

View File

@ -0,0 +1,5 @@
return {
cmd = { "marksman", "server" },
filetypes = { "markdown", "markdown.mdx" },
root_markers = { ".marksman.toml", ".git" },
}

View File

@ -0,0 +1,6 @@
return {
cmd = { "sqls" },
filetypes = { "sql", "mysql" },
root_markers = { "config.yml" },
settings = {},
}

View File

@ -0,0 +1,10 @@
return {
cmd = { "vue-language-server", "--stdio" },
filetypes = { "vue" },
init_options = {
typescript = {
tsdk = ""
}
},
root_markers = { "package.json" },
}

View File

@ -0,0 +1,12 @@
return {
cmd = { "yaml-language-server", "--stdio" },
filetypes = { "yaml", "yaml.docker-compose", "yaml.gitlab" },
root_markers = { ".git" },
settings = {
redhat = {
telemetry = {
enabled = false
}
}
},
}