@@ -463,18 +463,6 @@ require('lazy').setup({
463463 },
464464
465465 -- LSP Plugins
466- {
467- -- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
468- -- used for completion, annotations and signatures of Neovim apis
469- ' folke/lazydev.nvim' ,
470- ft = ' lua' ,
471- opts = {
472- library = {
473- -- Load luvit types when the `vim.uv` word is found
474- { path = ' ${3rd}/luv/library' , words = { ' vim%.uv' } },
475- },
476- },
477- },
478466 {
479467 -- Main LSP Configuration
480468 ' neovim/nvim-lspconfig' ,
@@ -669,22 +657,6 @@ require('lazy').setup({
669657 --
670658 -- But for many setups, the LSP (`ts_ls`) will work just fine
671659 -- ts_ls = {},
672- --
673-
674- lua_ls = {
675- -- cmd = { ... },
676- -- filetypes = { ... },
677- -- capabilities = {},
678- settings = {
679- Lua = {
680- completion = {
681- callSnippet = ' Replace' ,
682- },
683- -- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
684- -- diagnostics = { disable = { 'missing-fields' } },
685- },
686- },
687- },
688660 }
689661
690662 -- Ensure the servers and tools above are installed
@@ -704,22 +676,58 @@ require('lazy').setup({
704676 vim .list_extend (ensure_installed , {
705677 ' stylua' , -- Used to format Lua code
706678 })
679+
707680 require (' mason-tool-installer' ).setup { ensure_installed = ensure_installed }
708681
709682 require (' mason-lspconfig' ).setup {
710- ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
711- automatic_installation = false ,
712- handlers = {
713- function (server_name )
714- local server = servers [server_name ] or {}
715- -- This handles overriding only values explicitly passed
716- -- by the server configuration above. Useful when disabling
717- -- certain features of an LSP (for example, turning off formatting for ts_ls)
718- server .capabilities = vim .tbl_deep_extend (' force' , {}, capabilities , server .capabilities or {})
719- require (' lspconfig' )[server_name ].setup (server )
720- end ,
721- },
683+ ensure_installed = { ' lua_ls' },
722684 }
685+
686+ for name , server in pairs (servers ) do
687+ server .capabilities = vim .tbl_deep_extend (' force' , {}, capabilities , server .capabilities or {})
688+ vim .lsp .config (name , server )
689+ vim .lsp .enable (name )
690+ end
691+
692+ vim .lsp .config (' lua_ls' , {
693+ on_init = function (client )
694+ if client .workspace_folders then
695+ local path = client .workspace_folders [1 ].name
696+ if path ~= vim .fn .stdpath ' config' and (vim .uv .fs_stat (path .. ' /.luarc.json' ) or vim .uv .fs_stat (path .. ' /.luarc.jsonc' )) then
697+ return
698+ end
699+ end
700+
701+ client .config .settings .Lua = vim .tbl_deep_extend (' force' , client .config .settings .Lua , {
702+ runtime = {
703+ version = ' LuaJIT' ,
704+ path = {
705+ ' lua/?.lua' ,
706+ ' lua/?/init.lua' ,
707+ },
708+ },
709+ -- Make the server aware of Neovim runtime files
710+ workspace = {
711+ checkThirdParty = false ,
712+ -- NOTE: this is a lot slower and will cause issues when working on your own configuration.
713+ -- See https://github.com/neovim/nvim-lspconfig/issues/3189
714+ library = vim .api .nvim_get_runtime_file (' ' , true ),
715+ --
716+ -- Alternatively:
717+ -- library = {
718+ -- vim.env.VIMRUNTIME,
719+ -- -- Depending on the usage, you might want to add additional paths
720+ -- -- here.
721+ -- -- '${3rd}/luv/library',
722+ -- -- '${3rd}/busted/library',
723+ -- },
724+ },
725+ })
726+ end ,
727+ settings = {
728+ Lua = {},
729+ },
730+ })
723731 end ,
724732 },
725733
@@ -795,7 +803,6 @@ require('lazy').setup({
795803 },
796804 opts = {},
797805 },
798- ' folke/lazydev.nvim' ,
799806 },
800807 --- @module ' blink.cmp'
801808 --- @type blink.cmp.Config
@@ -841,10 +848,7 @@ require('lazy').setup({
841848 },
842849
843850 sources = {
844- default = { ' lsp' , ' path' , ' snippets' , ' lazydev' },
845- providers = {
846- lazydev = { module = ' lazydev.integrations.blink' , score_offset = 100 },
847- },
851+ default = { ' lsp' , ' path' , ' snippets' },
848852 },
849853
850854 snippets = { preset = ' luasnip' },
0 commit comments