fix lsp enable issues with mason-lspconfig.nvim

This commit is contained in:
Reathe 2026-02-26 18:35:22 +01:00
parent a961df11aa
commit 7367784222
1 changed files with 12 additions and 4 deletions

View File

@ -528,6 +528,7 @@ require('lazy').setup({
-- Mason must be loaded before its dependents so we need to set it up here. -- Mason must be loaded before its dependents so we need to set it up here.
-- NOTE: `opts = {}` is the same as calling `require('mason').setup({})` -- NOTE: `opts = {}` is the same as calling `require('mason').setup({})`
{ 'mason-org/mason.nvim', opts = {} }, { 'mason-org/mason.nvim', opts = {} },
{ 'mason-org/mason-lspconfig.nvim', opts = {} },
'WhoIsSethDaniel/mason-tool-installer.nvim', 'WhoIsSethDaniel/mason-tool-installer.nvim',
-- Useful status updates for LSP. -- Useful status updates for LSP.
@ -643,6 +644,13 @@ require('lazy').setup({
-- clangd = {}, -- clangd = {},
-- gopls = {}, -- gopls = {},
basedpyright = {}, basedpyright = {},
powershell_es = {
settings = {
powershell = {
codeFormatting = { Preset = 'OTBS' }, -- One True Brace Style
},
},
},
-- rust_analyzer = {}, -- rust_analyzer = {},
-- --
-- Some languages (like typescript) have entire language plugins that can be useful: -- Some languages (like typescript) have entire language plugins that can be useful:
@ -661,9 +669,9 @@ require('lazy').setup({
-- You can press `g?` for help in this menu. -- You can press `g?` for help in this menu.
local ensure_installed = vim.tbl_keys(servers or {}) local ensure_installed = vim.tbl_keys(servers or {})
vim.list_extend(ensure_installed, { vim.list_extend(ensure_installed, {
'lua-language-server', -- Lua Language server 'lua_ls', -- Lua Language server
'stylua', -- Used to format Lua code 'stylua', -- Used to format Lua code
'ruff', 'ruff', -- python formatter
-- You can add other tools here that you want Mason to install -- You can add other tools here that you want Mason to install
}) })
@ -672,7 +680,7 @@ require('lazy').setup({
for name, server in pairs(servers) do for name, server in pairs(servers) do
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
vim.lsp.config(name, server) vim.lsp.config(name, server)
vim.lsp.enable(name) -- vim.lsp.enable(name) -- not needed if mason-org/mason-lspconfig.nvim is installed (in dependencies of nvim-lspconfig)
end end
-- Special Lua Config, as recommended by neovim help docs -- Special Lua Config, as recommended by neovim help docs
@ -901,7 +909,7 @@ require('lazy').setup({
{ -- Highlight, edit, and navigate code { -- Highlight, edit, and navigate code
'nvim-treesitter/nvim-treesitter', 'nvim-treesitter/nvim-treesitter',
config = function() config = function()
local filetypes = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc', 'nu', 'python' } local filetypes = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc', 'nu', 'python', 'powershell' }
require('nvim-treesitter').install(filetypes) require('nvim-treesitter').install(filetypes)
vim.api.nvim_create_autocmd('FileType', { vim.api.nvim_create_autocmd('FileType', {
pattern = filetypes, pattern = filetypes,