feat nvim: 建立lspconfig整體架構
已參考mason, lspconfig, cmp官方範例,並反覆問GPT並手動對照後,已手動融合設定
This commit is contained in:
35
dot_config/nvim/exact_lua/lsp/exact_config/mason.lua
Normal file
35
dot_config/nvim/exact_lua/lsp/exact_config/mason.lua
Normal file
@@ -0,0 +1,35 @@
|
||||
require("mason").setup()
|
||||
require("mason-lspconfig").setup {
|
||||
-- A list of servers to automatically install if they're not already installed. Example: { "rust_analyzer@nightly", "lua_ls" }
|
||||
-- This setting has no relation with the `automatic_installation` setting.
|
||||
---@type string[]
|
||||
ensure_installed = {
|
||||
-- "lua_ls", "rust_analyzer" -- 官方範例
|
||||
"phpactor",
|
||||
"pyright",
|
||||
"gopls",
|
||||
"html",
|
||||
"cssls",
|
||||
"tsserver",
|
||||
},
|
||||
|
||||
-- Whether servers that are set up (via lspconfig) should be automatically installed if they're not already installed.
|
||||
-- This setting has no relation with the `ensure_installed` setting.
|
||||
-- Can either be:
|
||||
-- - false: Servers are not automatically installed.
|
||||
-- - true: All servers set up via lspconfig are automatically installed.
|
||||
-- - { exclude: string[] }: All servers set up via lspconfig, except the ones provided in the list, are automatically installed.
|
||||
-- Example: automatic_installation = { exclude = { "rust_analyzer", "solargraph" } }
|
||||
---@type boolean
|
||||
automatic_installation = false,
|
||||
|
||||
-- See `:h mason-lspconfig.setup_handlers()`
|
||||
---@type table<string, fun(server_name: string)>?
|
||||
handlers = nil,
|
||||
}
|
||||
|
||||
-- 下面這段先註解掉,由lspconfig.lua來處理
|
||||
-- -- After setting up mason-lspconfig you may set up servers via lspconfig
|
||||
-- require("lspconfig").lua_ls.setup {}
|
||||
-- require("lspconfig").rust_analyzer.setup {}
|
||||
-- -- ...
|
||||
Reference in New Issue
Block a user