fix lsp config fot Python

This commit is contained in:
2026-03-26 23:10:45 +01:00
parent 1a0d466105
commit e9fc037519
+69 -68
View File
@@ -1,70 +1,71 @@
return { return {
-- Mason (LSP server installer) -- Mason (LSP server installer)
{ {
"mason-org/mason.nvim", "mason-org/mason.nvim",
config = function() config = function()
require("mason").setup() require("mason").setup()
end, end,
}, },
-- Mason-LSPconfig (bridge Mason and nvim-lspconfig) -- Mason-LSPconfig (bridge Mason and nvim-lspconfig)
{ {
"mason-org/mason-lspconfig.nvim", "mason-org/mason-lspconfig.nvim",
config = function() config = function()
require("mason-lspconfig").setup({ require("mason-lspconfig").setup({
ensure_installed = { ensure_installed = {
"pyright", -- Python "pyright", -- Python
"jsonls", -- JSON "jsonls", -- JSON
"yamlls", -- YAML "yamlls", -- YAML
"html", -- HTML "html", -- HTML
"cssls", -- CSS "cssls", -- CSS
"bashls", -- Bash "bashls", -- Bash
"lua_ls", -- Lua "lua_ls", -- Lua
}, "stylua",
automatic_enable = true, },
}) automatic_enable = true,
end, })
}, end,
},
-- nvim-lspconfig
{ -- nvim-lspconfig
"neovim/nvim-lspconfig", {
config = function() "neovim/nvim-lspconfig",
-- Lua config = function()
vim.lsp.config('lua_ls', { -- Lua
settings = { vim.lsp.config("lua_ls", {
Lua = { settings = {
runtime = { version = "LuaJIT" }, Lua = {
workspace = { library = vim.api.nvim_get_runtime_file("", true) }, runtime = { version = "LuaJIT" },
}, workspace = { library = vim.api.nvim_get_runtime_file("", true) },
}, },
}) },
})
-- Other languages
vim.lsp.config('pyright', { -- Other languages
settings = { vim.lsp.config("pyright", {
python = { settings = {
analysis = { python = {
typeCheckingMode = "basic", analysis = {
extraPaths = {}, -- Add extra import paths if needed typeCheckingMode = "basic",
}, extraPaths = {}, -- Add extra import paths if needed
}, },
}, },
}) },
vim.lsp.config('jsonls', {}) })
vim.lsp.config('yamlls', {}) vim.lsp.config("jsonls", {})
vim.lsp.config('html', {}) vim.lsp.config("yamlls", {})
vim.lsp.config('cssls', {}) vim.lsp.config("html", {})
vim.lsp.config('bashls', {}) vim.lsp.config("cssls", {})
vim.lsp.config("bashls", {})
-- Enable servers
vim.lsp.enable('lua_ls') -- Enable servers
vim.lsp.enable('pyright') vim.lsp.enable("lua_ls")
vim.lsp.enable('jsonls') vim.lsp.enable("pyright")
vim.lsp.enable('yamlls') vim.lsp.enable("jsonls")
vim.lsp.enable('html') vim.lsp.enable("yamlls")
vim.lsp.enable('cssls') vim.lsp.enable("html")
vim.lsp.enable('bashls') vim.lsp.enable("cssls")
end, vim.lsp.enable("bashls")
}, end,
},
} }