1+ local neodev = vim .F .npcall (require , " neodev" )
2+ if neodev then
3+ neodev .setup {
4+ override = function (root_dir , library )
5+ library .enabled = true
6+ library .plugins = true
7+ end ,
8+ }
9+ end
10+
111local lspconfig = vim .F .npcall (require , " lspconfig" )
212if not lspconfig then
313 return
@@ -120,6 +130,7 @@ local custom_attach = function(client, bufnr)
120130 buf_nnoremap { " gd" , vim .lsp .buf .definition }
121131 buf_nnoremap { " gD" , vim .lsp .buf .declaration }
122132 buf_nnoremap { " gT" , vim .lsp .buf .type_definition }
133+ buf_nnoremap { " K" , vim .lsp .buf .hover , { desc = " lsp:hover" } }
123134
124135 buf_nnoremap { " <space>gI" , handlers .implementation }
125136 buf_nnoremap { " <space>lr" , " <cmd>lua R('tj.lsp.codelens').run()<CR>" }
@@ -130,10 +141,6 @@ local custom_attach = function(client, bufnr)
130141 telescope_mapper (" <space>wd" , " lsp_document_symbols" , { ignore_filename = true }, true )
131142 telescope_mapper (" <space>ww" , " lsp_dynamic_workspace_symbols" , { ignore_filename = true }, true )
132143
133- if filetype ~= " lua" then
134- buf_nnoremap { " K" , vim .lsp .buf .hover , { desc = " lsp:hover" } }
135- end
136-
137144 vim .bo .omnifunc = " v:lua.vim.lsp.omnifunc"
138145
139146 -- Set autocommands conditional on server_capabilities
@@ -301,6 +308,11 @@ local servers = {
301308 },
302309}
303310
311+ require (" mason" ).setup ()
312+ require (" mason-lspconfig" ).setup {
313+ ensure_installed = { " sumneko_lua" },
314+ }
315+
304316local setup_server = function (server , config )
305317 if not config then
306318 return
324336
325337if is_mac then
326338 local sumneko_cmd , sumneko_env = nil , nil
327- require (" nvim-lsp-installer" ).setup {
328- automatic_installation = false ,
329- ensure_installed = { " sumneko_lua" , " gopls" },
330- }
331339
332340 sumneko_cmd = {
333341 vim .fn .stdpath " data" .. " /lsp_servers/sumneko_lua/extension/server/bin/lua-language-server" ,
@@ -382,32 +390,14 @@ if is_mac then
382390 })
383391else
384392 -- Load lua configuration from nlua.
385- _ = require (" nlua.lsp.nvim " ).setup ( lspconfig , {
393+ require (" lspconfig " ).sumneko_lua . setup {
386394 on_init = custom_init ,
387395 on_attach = custom_attach ,
388396 capabilities = updated_capabilities ,
389-
390- root_dir = function (fname )
391- if string.find (vim .fn .fnamemodify (fname , " :p" ), " xdg_config/nvim/" ) then
392- return vim .fn .expand " ~/git/config_manager/xdg_config/nvim/"
393- end
394-
395- -- ~/git/config_manager/xdg_config/nvim/...
396- return lspconfig_util .find_git_ancestor (fname ) or lspconfig_util .path .dirname (fname )
397- end ,
398-
399- globals = {
400- -- Colorbuddy
401- " Color" ,
402- " c" ,
403- " Group" ,
404- " g" ,
405- " s" ,
406-
407- -- Custom
408- " RELOAD" ,
397+ settings = {
398+ Lua = { workspace = { checkThirdParty = false } },
409399 },
410- })
400+ }
411401end
412402
413403for server , config in pairs (servers ) do
0 commit comments