fix lsp config fot Python

This commit is contained in:
2026-03-26 23:10:45 +01:00
parent 1a0d466105
commit e9fc037519
+65 -64
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", "neovim/nvim-lspconfig",
config = function() config = function()
-- Lua -- Lua
vim.lsp.config('lua_ls', { vim.lsp.config("lua_ls", {
settings = { settings = {
Lua = { Lua = {
runtime = { version = "LuaJIT" }, runtime = { version = "LuaJIT" },
workspace = { library = vim.api.nvim_get_runtime_file("", true) }, workspace = { library = vim.api.nvim_get_runtime_file("", true) },
}, },
}, },
}) })
-- Other languages -- Other languages
vim.lsp.config('pyright', { vim.lsp.config("pyright", {
settings = { settings = {
python = { python = {
analysis = { analysis = {
typeCheckingMode = "basic", typeCheckingMode = "basic",
extraPaths = {}, -- Add extra import paths if needed extraPaths = {}, -- Add extra import paths if needed
}, },
}, },
}, },
}) })
vim.lsp.config('jsonls', {}) vim.lsp.config("jsonls", {})
vim.lsp.config('yamlls', {}) vim.lsp.config("yamlls", {})
vim.lsp.config('html', {}) vim.lsp.config("html", {})
vim.lsp.config('cssls', {}) vim.lsp.config("cssls", {})
vim.lsp.config('bashls', {}) vim.lsp.config("bashls", {})
-- Enable servers -- Enable servers
vim.lsp.enable('lua_ls') vim.lsp.enable("lua_ls")
vim.lsp.enable('pyright') vim.lsp.enable("pyright")
vim.lsp.enable('jsonls') vim.lsp.enable("jsonls")
vim.lsp.enable('yamlls') vim.lsp.enable("yamlls")
vim.lsp.enable('html') vim.lsp.enable("html")
vim.lsp.enable('cssls') vim.lsp.enable("cssls")
vim.lsp.enable('bashls') vim.lsp.enable("bashls")
end, end,
}, },
} }