Skip to content

Commit 990e856

Browse files
committed
Adding LSP fix from nvim-lua/kickstart.nvim PR nvim-lua#1663 to correctly pass overrides to LSP server initialization
1 parent 3338d39 commit 990e856

File tree

1 file changed

+48
-24
lines changed

1 file changed

+48
-24
lines changed

init.lua

Lines changed: 48 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ vim.g.mapleader = ' '
9191
vim.g.maplocalleader = ' '
9292

9393
-- Set to true if you have a Nerd Font installed and selected in the terminal
94-
vim.g.have_nerd_font = false
94+
vim.g.have_nerd_font = true
9595

9696
-- [[ Setting options ]]
9797
-- See `:help vim.o`
@@ -483,7 +483,8 @@ require('lazy').setup({
483483
-- Mason must be loaded before its dependents so we need to set it up here.
484484
-- NOTE: `opts = {}` is the same as calling `require('mason').setup({})`
485485
{ 'mason-org/mason.nvim', opts = {} },
486-
'mason-org/mason-lspconfig.nvim',
486+
-- 'mason-org/mason-lspconfig.nvim',
487+
{ 'mason-org/mason-lspconfig.nvim' },
487488
'WhoIsSethDaniel/mason-tool-installer.nvim',
488489

489490
-- Useful status updates for LSP.
@@ -674,14 +675,33 @@ require('lazy').setup({
674675
-- clangd = {},
675676
-- gopls = {},
676677
-- pyright = {},
678+
pylsp = {
679+
settings = {
680+
pylsp = {
681+
plugins = {
682+
pyflakes = { enabled = false },
683+
pycodestyle = { enabled = false },
684+
autopep8 = { enabled = false },
685+
yapf = { enabled = false },
686+
mccabe = { enabled = false },
687+
pylsp_mypy = { enabled = false },
688+
pylsp_black = { enabled = false },
689+
pylsp_isort = { enabled = false },
690+
},
691+
},
692+
},
693+
},
694+
695+
ruff = {},
696+
677697
-- rust_analyzer = {},
678698
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
679699
--
680700
-- Some languages (like typescript) have entire language plugins that can be useful:
681701
-- https://github.com/pmizio/typescript-tools.nvim
682702
--
683703
-- But for many setups, the LSP (`ts_ls`) will work just fine
684-
-- ts_ls = {},
704+
ts_ls = {},
685705
--
686706

687707
lua_ls = {
@@ -693,13 +713,31 @@ require('lazy').setup({
693713
completion = {
694714
callSnippet = 'Replace',
695715
},
696-
-- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
697-
-- diagnostics = { disable = { 'missing-fields' } },
716+
runtime = { version = 'LuaJIT' },
717+
workspace = {
718+
checkThirdParty = false,
719+
library = vim.api.nvim_get_runtime_file('', true),
720+
},
721+
diagnostics = {
722+
globals = { 'vim' },
723+
disable = { 'missing-fields' },
724+
},
725+
-- format = {
726+
-- enable = false,
727+
-- },
698728
},
699729
},
700730
},
701731
}
702732

733+
-- The following loop will configure each server with the capabilities we defined above.
734+
-- This will ensure that all servers have the same base configuration, but also
735+
-- allow for server-specific overrides.
736+
for server_name, server_config in pairs(servers) do
737+
server_config.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server_config.capabilities or {})
738+
require('lspconfig')[server_name].setup(server_config)
739+
end
740+
703741
-- Ensure the servers and tools above are installed
704742
--
705743
-- To check the current status of installed tools and/or manually install
@@ -718,21 +756,6 @@ require('lazy').setup({
718756
'stylua', -- Used to format Lua code
719757
})
720758
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
721-
722-
require('mason-lspconfig').setup {
723-
ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
724-
automatic_installation = false,
725-
handlers = {
726-
function(server_name)
727-
local server = servers[server_name] or {}
728-
-- This handles overriding only values explicitly passed
729-
-- by the server configuration above. Useful when disabling
730-
-- certain features of an LSP (for example, turning off formatting for ts_ls)
731-
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
732-
require('lspconfig')[server_name].setup(server)
733-
end,
734-
},
735-
}
736759
end,
737760
},
738761

@@ -881,20 +904,21 @@ require('lazy').setup({
881904
-- change the command in the config to whatever the name of that colorscheme is.
882905
--
883906
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
884-
'folke/tokyonight.nvim',
907+
'Mofiqul/dracula.nvim',
885908
priority = 1000, -- Make sure to load this before all the other start plugins.
886909
config = function()
887910
---@diagnostic disable-next-line: missing-fields
888-
require('tokyonight').setup {
911+
require('dracula').setup {
912+
transparent_bg = true,
889913
styles = {
890-
comments = { italic = false }, -- Disable italics in comments
914+
comments = { italic = true }, -- Disable italics in comments
891915
},
892916
}
893917

894918
-- Load the colorscheme here.
895919
-- Like many other themes, this one has different styles, and you could load
896920
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
897-
vim.cmd.colorscheme 'tokyonight-night'
921+
vim.cmd.colorscheme 'dracula'
898922
end,
899923
},
900924

0 commit comments

Comments
 (0)