Skip to content

Commit 3907deb

Browse files
committed
Pull in LSP config fix from nvim-lua/kickstart.nvim#1475
1 parent 9c6d6b0 commit 3907deb

File tree

2 files changed

+38
-91
lines changed

2 files changed

+38
-91
lines changed

.config/nvim/init.lua

Lines changed: 38 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,7 @@ require("lazy").setup({
260260
severity_sort = true,
261261
float = {
262262
border = "rounded",
263-
source = function(diag)
264-
return diag.source and ("[" .. diag.source .. "]") or nil
265-
end,
263+
source = "if_many",
266264
},
267265
underline = { severity = vim.diagnostic.severity.ERROR },
268266
signs = vim.g.have_nerd_font and {
@@ -288,78 +286,63 @@ require("lazy").setup({
288286
-- So, we create new capabilities with blink.cmp, and then broadcast that to the servers.
289287
local capabilities = require("blink.cmp").get_lsp_capabilities()
290288

291-
-- Enable the following language servers
292-
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
293-
--
294289
-- Add any additional override configuration in the following tables. Available keys are:
295290
-- - cmd (table): Override the default command used to start the server
296291
-- - filetypes (table): Override the default list of associated filetypes for the server
297292
-- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features.
298293
-- - settings (table): Override the default settings passed when initializing the server.
299294
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
300295
local servers = {
301-
-- clangd = {},
302-
-- gopls = {},
303-
-- pyright = {},
304-
-- rust_analyzer = {},
305-
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
306-
--
307-
-- Some languages (like typescript) have entire language plugins that can be useful:
308-
-- https://github.com/pmizio/typescript-tools.nvim
309-
--
310-
-- But for many setups, the LSP (`ts_ls`) will work just fine
311-
-- ts_ls = {},
312-
--
313-
296+
stylua = {},
314297
lua_ls = {
315-
-- cmd = { ... },
316-
-- filetypes = { ... },
317-
-- capabilities = {},
318298
settings = {
319299
Lua = {
320300
completion = {
321301
callSnippet = "Replace",
322302
},
323-
-- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
324-
-- diagnostics = { disable = { 'missing-fields' } },
325303
},
326304
},
327305
},
306+
basedpyright = {
307+
handlers = {
308+
["textDocument/publishDiagnostics"] = function() end,
309+
},
310+
settings = {
311+
basedpyright = {
312+
analysis = {
313+
exclude = {
314+
"**/frontend",
315+
"**/node_modules",
316+
"**/.ruff_cache",
317+
"**/.mypy_cache",
318+
"**/.pytest_cache",
319+
"**/dist",
320+
"**/build",
321+
"**/__pycache__",
322+
},
323+
},
324+
},
325+
},
326+
},
327+
vtsls = {},
328+
prettier = {},
329+
terraformls = {},
330+
sqlfmt = {},
328331
}
329332

330-
-- Ensure the servers and tools above are installed
331-
--
332-
-- To check the current status of installed tools and/or manually install
333-
-- other tools, you can run
334-
-- :Mason
335-
--
336-
-- You can press `g?` for help in this menu.
337-
--
338-
-- `mason` had to be setup earlier: to configure its options see the
339-
-- `dependencies` table for `nvim-lspconfig` above.
340-
--
341-
-- You can add other tools here that you want Mason to install
342-
-- for you, so that they are available from within Neovim.
343-
local ensure_installed = vim.tbl_keys(servers or {})
344-
vim.list_extend(ensure_installed, {
345-
"stylua", -- Used to format Lua code
346-
})
347-
require("mason-tool-installer").setup({ ensure_installed = ensure_installed })
348-
333+
---@type MasonLspconfigSettings
334+
---@diagnostic disable-next-line: missing-fields
349335
require("mason-lspconfig").setup({
350-
ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
351-
automatic_installation = false,
352-
handlers = {
353-
function(server_name)
354-
local server = servers[server_name] or {}
355-
-- This handles overriding only values explicitly passed
356-
-- by the server configuration above. Useful when disabling
357-
-- certain features of an LSP (for example, turning off formatting for ts_ls)
358-
server.capabilities = vim.tbl_deep_extend("force", {}, capabilities, server.capabilities or {})
359-
require("lspconfig")[server_name].setup(server)
360-
end,
361-
},
336+
automatic_enable = vim.tbl_keys(servers or {}),
362337
})
338+
339+
require("mason-tool-installer").setup({ ensure_installed = vim.tbl_keys(servers) })
340+
341+
-- Installed LSPs are configured and enabled automatically with mason-lspconfig
342+
-- The loop below is for overriding the default configuration of LSPs with the ones in the servers table
343+
for server_name, config in pairs(servers) do
344+
vim.lsp.config(server_name, config)
345+
end
363346
end,
364347
},
365348

.config/nvim/lua/plugins/python.lua

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -90,42 +90,6 @@ local debug_configs = {
9090
}
9191

9292
return {
93-
-- LSP
94-
{
95-
"neovim/nvim-lspconfig",
96-
opts = {
97-
servers = {
98-
basedpyright = {
99-
settings = {
100-
basedpyright = {
101-
analysis = {
102-
typeCheckingMode = "off",
103-
diagnosticMode = "openFilesOnly",
104-
useLibraryCodeForTypes = true,
105-
autoSearchPaths = true,
106-
autoImportCompletions = true,
107-
exclude = {
108-
"**/frontend",
109-
"**/node_modules",
110-
"**/.ruff_cache",
111-
"**/.mypy_cache",
112-
"**/.pytest_cache",
113-
"**/dist",
114-
"**/build",
115-
"**/__pycache__",
116-
},
117-
},
118-
},
119-
},
120-
on_attach = function(client, bufnr)
121-
-- Disable basedpyright diagnostics completely
122-
-- We use mypy via nvim-lint instead for type checking
123-
client.server_capabilities.diagnosticProvider = nil
124-
end,
125-
},
126-
},
127-
},
128-
},
12993
-- Linting
13094
{
13195
"mfussenegger/nvim-lint",

0 commit comments

Comments
 (0)