Updgraded python linters and formatters. Changed zoo of them to one ruff
This commit is contained in:
parent
22e0121ba7
commit
b05e831bd2
3 changed files with 116 additions and 99 deletions
|
@ -18,6 +18,32 @@ return {
|
||||||
-- import cmp-nvim-lsp plugin
|
-- import cmp-nvim-lsp plugin
|
||||||
local cmp_nvim_lsp = require("cmp_nvim_lsp")
|
local cmp_nvim_lsp = require("cmp_nvim_lsp")
|
||||||
|
|
||||||
|
-- Ruff setup
|
||||||
|
lspconfig.ruff.setup({
|
||||||
|
init_options = {
|
||||||
|
settings = {
|
||||||
|
-- Ruff language server settings go here
|
||||||
|
logLevel = "debug",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Pyright setup
|
||||||
|
lspconfig.pyright.setup({
|
||||||
|
settings = {
|
||||||
|
pyright = {
|
||||||
|
-- Using Ruff's import organizer
|
||||||
|
disableOrganizeImports = true,
|
||||||
|
},
|
||||||
|
python = {
|
||||||
|
analysis = {
|
||||||
|
-- Ignore all files for analysis to exclusively use Ruff for linting
|
||||||
|
ignore = { "*" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
local keymap = vim.keymap -- for conciseness
|
local keymap = vim.keymap -- for conciseness
|
||||||
|
|
||||||
-- nvim_create_autocmd - used to execute some logic automaticaly on a specific event
|
-- nvim_create_autocmd - used to execute some logic automaticaly on a specific event
|
||||||
|
@ -72,7 +98,9 @@ return {
|
||||||
keymap.set("n", "<leader>rs", ":LspRestart<CR>", opts) -- mapping to restart lsp if necessary
|
keymap.set("n", "<leader>rs", ":LspRestart<CR>", opts) -- mapping to restart lsp if necessary
|
||||||
|
|
||||||
opts.desc = "Run formatting on current buffer"
|
opts.desc = "Run formatting on current buffer"
|
||||||
keymap.set('n', '<space>f', function() vim.lsp.buf.format { async = true } end, opts)
|
keymap.set("n", "<space>f", function()
|
||||||
|
vim.lsp.buf.format({ async = true })
|
||||||
|
end, opts)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -106,4 +134,3 @@ return {
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,17 +40,10 @@ return {
|
||||||
"goimports-reviser",
|
"goimports-reviser",
|
||||||
"prettier", -- prettier formatter
|
"prettier", -- prettier formatter
|
||||||
"stylua", -- lua formatter
|
"stylua", -- lua formatter
|
||||||
"isort", -- python formatter
|
"ruff", -- Python formatter and linter
|
||||||
"black", -- python formatter
|
|
||||||
"gofumpt",
|
"gofumpt",
|
||||||
"pylint",
|
|
||||||
"flake8",
|
|
||||||
-- Astra settings for 3.7 Python
|
-- Astra settings for 3.7 Python
|
||||||
-- { "isort", version = "5.11.5" }, -- python formatter
|
-- NOTE: On Astra you need to install Ruff as standalone package
|
||||||
-- { "black", version = "23.3.0" }, -- python formatter
|
|
||||||
-- { "pylint", version = "2.9.0" },
|
|
||||||
-- { "pylint", version = "2.9.0" },
|
|
||||||
-- { "flake8", version = "4.0.1" },
|
|
||||||
"eslint_d",
|
"eslint_d",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
@ -8,13 +8,10 @@ return {
|
||||||
|
|
||||||
null_ls.setup({
|
null_ls.setup({
|
||||||
sources = {
|
sources = {
|
||||||
null_ls.builtins.formatting.black,
|
|
||||||
null_ls.builtins.formatting.isort,
|
|
||||||
null_ls.builtins.formatting.gofumpt,
|
null_ls.builtins.formatting.gofumpt,
|
||||||
null_ls.builtins.formatting.goimports_reviser,
|
null_ls.builtins.formatting.goimports_reviser,
|
||||||
null_ls.builtins.formatting.stylua,
|
null_ls.builtins.formatting.stylua,
|
||||||
null_ls.builtins.formatting.golines,
|
null_ls.builtins.formatting.golines,
|
||||||
require("none-ls.diagnostics.flake8"),
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
|
|
Loading…
Reference in a new issue