68 lines
1.7 KiB
Lua
68 lines
1.7 KiB
Lua
-- here you can setup the language servers
|
|
|
|
local lsp_zero = require('lsp-zero')
|
|
|
|
lsp_zero.on_attach(function(client, bufnr)
|
|
-- see :help lsp-zero-keybindings
|
|
-- to learn the available actions
|
|
lsp_zero.default_keymaps({buffer = bufnr})
|
|
end)
|
|
|
|
-- to learn how to use mason.nvim
|
|
-- read this: https://github.com/VonHeikemen/lsp-zero.nvim/blob/v3.x/doc/md/guide/integrate-with-mason-nvim.md
|
|
require('mason').setup({})
|
|
require('mason-lspconfig').setup({
|
|
|
|
-- https://github.com/williamboman/mason-lspconfig.nvim?tab=readme-ov-file
|
|
ensure_installed = {
|
|
"pylsp",
|
|
"pyright",
|
|
},
|
|
handlers = {
|
|
function(server_name)
|
|
require('lspconfig')[server_name].setup({})
|
|
end,
|
|
},
|
|
})
|
|
|
|
require "lspconfig".pylsp.setup {
|
|
on_attach = on_attach,
|
|
settings = {
|
|
pylsp = {
|
|
plugins = {
|
|
flake8 = {
|
|
enabled = false,
|
|
maxLineLength = 119,
|
|
},
|
|
mypy = {
|
|
enabled = true,
|
|
},
|
|
pycodestyle = {
|
|
enabled = false,
|
|
},
|
|
pyflakes = {
|
|
enabled = false,
|
|
},
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
require "lspconfig".pyright.setup {
|
|
-- on_attach = on_attach,
|
|
settings = {
|
|
-- pyright = {autoImportCompletion = true,},
|
|
python = {
|
|
analysis = {
|
|
-- autoSearchPaths = true,
|
|
-- diagnosticMode = 'openFilesOnly',
|
|
-- useLibraryCodeForTypes = true,
|
|
-- typeCheckingMode = 'off',
|
|
diagnosticSeverityOverrides = {
|
|
-- I edit code that lives in docker containers and pyright complains when I import modules that aren't on my PC:
|
|
reportMissingImports = false
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|