File tree Expand file tree Collapse file tree 3 files changed +33
-26
lines changed
Expand file tree Collapse file tree 3 files changed +33
-26
lines changed Original file line number Diff line number Diff line change @@ -89,10 +89,20 @@ local opts = {
8989 desc = " Format file with LSP" ,
9090 },
9191 },
92- -- Configure default capabilities for all language servers (`:h vim.lsp.protocol.make_client.capabilities()`)
93- capabilities = {
94- textDocument = {
95- foldingRange = { dynamicRegistration = false },
92+ -- Configure language servers with `vim.lsp.config` (`:h vim.lsp.config`)
93+ config = {
94+ -- Configure LSP defaults
95+ [" *" ] = {
96+ -- Configure default capabilities
97+ capabilities = {
98+ textDocument = {
99+ foldingRange = { dynamicRegistration = false },
100+ },
101+ },
102+ -- Custom flags table to be passed to all language servers
103+ flags = {
104+ exit_timeout = 5000 ,
105+ },
96106 },
97107 },
98108 defaults = {
@@ -113,10 +123,6 @@ local opts = {
113123 didDelete = true ,
114124 },
115125 },
116- -- A custom flags table to be passed to all language servers (`:h lspconfig-setup`)
117- flags = {
118- exit_timeout = 5000 ,
119- },
120126 -- Configuration options for controlling formatting with language servers
121127 formatting = {
122128 -- control auto formatting on save
Original file line number Diff line number Diff line change 121121--- }
122122--- ```
123123--- @field features AstroLSPFeatureOpts ?
124- --- Configure default capabilities for language servers (` :h vim.lsp.protocol.make_client.capabilities() `)
124+ --- Configure options for language servers passed to `vim.lsp.config(key, config)` (` :h vim.lsp.config `)
125125--- Example
126126--
127127--- ```lua
128- --- capabilities = {
129- --- textDocument = {
130- --- foldingRange = { dynamicRegistration = false }
131- --- }
128+ --- config = {
129+ --- ["*"] = {
130+ --- capabilities = {
131+ --- textDocument = {
132+ --- foldingRange = { dynamicRegistration = false }
133+ --- }
134+ --- },
135+ --- flags = { exit_timeout = 5000 },
136+ --- },
132137--- }
133138--- ```
134- --- @field capabilities lsp.ClientCapabilities ?
139+ --- @field config table<string,vim. lsp.Config> ?
135140--- Configure default options passed to `vim.lsp.buf` functions
136141--- Example:
137142---
168173--- }
169174--- ```
170175--- @field file_operations AstroLSPFileOperationsOpts | false ?
171- --- A custom flags table to be passed to all language servers (`:h lspconfig-setup`)
172- --- Example:
173- --
174- --- ```lua
175- --- flags = { exit_timeout = 5000 }
176- --- ```
177- --- @field flags table ?
178176--- Configuration options for controlling formatting with language servers
179177--- Example:
180178--
@@ -294,10 +292,9 @@ local M = {
294292 semantic_tokens = true ,
295293 signature_help = false ,
296294 },
297- capabilities = {},
295+ config = {},
298296 defaults = {},
299297 file_operations = { timeout = 10000 , operations = {} },
300- flags = {},
301298 formatting = { format_on_save = { enabled = true }, disabled = {} },
302299 handlers = {},
303300 lsp_handlers = {},
Original file line number Diff line number Diff line change @@ -229,12 +229,16 @@ function M.setup(opts)
229229 -- enable necessary capabilities for enabled LSP file operations
230230 local fileOperations = vim .tbl_get (M .config , " file_operations" , " operations" )
231231 if fileOperations and not vim .tbl_isempty (fileOperations ) then
232- M .config .capabilities = vim .tbl_deep_extend (" force" , M .config .capabilities or {}, {
233- workspace = { fileOperations = fileOperations },
232+ M .config .config = vim .tbl_deep_extend (" force" , M .config .config or {}, {
233+ [" *" ] = {
234+ capabilities = { workspace = { fileOperations = fileOperations } },
235+ },
234236 })
235237 end
236238
237- vim .lsp .config (" *" , { capabilities = M .config .capabilities , flags = M .config .flags })
239+ for server , config in pairs (M .config .config ) do
240+ vim .lsp .config (server , config )
241+ end
238242
239243 -- Set up tracking of signature help trigger characters
240244 M .add_on_attach (M .on_attach , {
You can’t perform that action at this time.
0 commit comments