Skip to content

Commit 2a96d34

Browse files
committed
refactor: language servers list to become a global var, credits: @MingJ7
1 parent de83d48 commit 2a96d34

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

init.vim

+1-2
Original file line numberDiff line numberDiff line change
@@ -161,14 +161,13 @@ let g:pydocstring_doq_path = '~/.config/nvim/env/bin/doq'
161161

162162
""" Core plugin configuration (lua)
163163
lua << EOF
164-
local servers = {
164+
servers = {
165165
'pyright',
166166
--'tsserver', -- uncomment for typescript. See https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md for other language servers
167167
}
168168
require('treesitter-config')
169169
require('nvim-cmp-config')
170170
require('lspconfig-config')
171-
add_capabilities(servers)
172171
require('telescope-config')
173172
require('lualine-config')
174173
require('nvim-tree-config')

lua/lspconfig-config.lua

+3-2
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,13 @@ end
3131
-- Update nvim-cmp capabilities and add them to each language server
3232
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
3333

34-
function add_capabilities(servers)
35-
for _, lsp in pairs(servers) do
34+
function add_capabilities()
35+
for _, lsp in ipairs(servers) do
3636
require('lspconfig')[lsp].setup {
3737
capabilities = capabilities,
3838
on_attach = on_attach,
3939
}
4040
end
4141
end
4242

43+
add_capabilities()

0 commit comments

Comments
 (0)