nixos/pkgsets/nvim/lsp/python.nix

45 lines
1 KiB
Nix
Raw Permalink Normal View History

{
lib,
config,
pkgs,
...
}:
lib.optionalString (lib.elem "nvim::lsp::python" config.machine.pkgs) # lua
''
lspconfig.pyright.setup({
cmd = {"${pkgs.pyright}/bin/pyright-langserver", "--stdio"},
settings = {
pyright = {
disableOrganizeImports = true,
},
python = {
-- analysis = {
-- ignore = { '*' },
-- },
},
},
})
lspconfig.ruff.setup({
cmd = {"${pkgs.ruff}/bin/ruff", "server", "--preview"},
init_options = {
settings = {
-- Modification to any of these settings has no effect.
enable = true,
ignoreStandardLibrary = true,
organizeImports = true,
fixAll = true,
lint = {
enable = true,
run = 'onType',
},
},
},
on_attach = function(client, bufnr)
if client.name == 'ruff' then
client.server_capabilities.hoverProvider = false;
end
end,
})
''