ruff setup
This commit is contained in:
parent
54ed2f66bc
commit
8295147a83
35
init.lua
35
init.lua
|
|
@ -587,7 +587,31 @@ require('lazy').setup({
|
||||||
local servers = {
|
local servers = {
|
||||||
clangd = {},
|
clangd = {},
|
||||||
gopls = {},
|
gopls = {},
|
||||||
pyright = {},
|
basedpyright = {
|
||||||
|
settings = {
|
||||||
|
basedpyright = {
|
||||||
|
analysis = {
|
||||||
|
autoImportCompletions = true,
|
||||||
|
autoSearchPaths = true, -- auto serach command paths like 'src'
|
||||||
|
diagnosticMode = 'openFilesOnly',
|
||||||
|
useLibraryCodeForTypes = true,
|
||||||
|
diagnosticSeverityOverrides = {
|
||||||
|
reportUnknownMemberType = 'none', -- ignore warning : cannot infer member type of object like matplot
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
ruff = {
|
||||||
|
init_options = {
|
||||||
|
settings = {
|
||||||
|
lint = {
|
||||||
|
enable = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
rust_analyzer = {},
|
rust_analyzer = {},
|
||||||
ts_ls = {},
|
ts_ls = {},
|
||||||
-- See `:help lspconfig-all` for a list of all the pre-configured LSPs
|
-- See `:help lspconfig-all` for a list of all the pre-configured LSPs
|
||||||
|
|
@ -677,7 +701,14 @@ require('lazy').setup({
|
||||||
formatters_by_ft = {
|
formatters_by_ft = {
|
||||||
lua = { 'stylua' },
|
lua = { 'stylua' },
|
||||||
-- Conform can also run multiple formatters sequentially
|
-- Conform can also run multiple formatters sequentially
|
||||||
-- python = { "isort", "black" },
|
python = {
|
||||||
|
-- To fix auto-fixable lint errors.
|
||||||
|
'ruff_fix',
|
||||||
|
-- To run the Ruff formatter.
|
||||||
|
'ruff_format',
|
||||||
|
-- To organize the imports.
|
||||||
|
'ruff_organize_imports',
|
||||||
|
},
|
||||||
--
|
--
|
||||||
-- You can use 'stop_after_first' to run the first available formatter from the list
|
-- You can use 'stop_after_first' to run the first available formatter from the list
|
||||||
-- javascript = { "prettierd", "prettier", stop_after_first = true },
|
-- javascript = { "prettierd", "prettier", stop_after_first = true },
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
'neovim/nvim-lspconfig',
|
||||||
|
opts = {
|
||||||
|
setup = {
|
||||||
|
ruff = function(_, _)
|
||||||
|
-- This runs when ruff is being set up
|
||||||
|
-- We can return true to skip default setup, but we don't want that
|
||||||
|
-- Instead we hook later
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
-- Hook into existing LspAttach (kickstart already created the group)
|
||||||
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
|
callback = function(args)
|
||||||
|
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||||
|
if client and client.name == 'ruff' then
|
||||||
|
client.server_capabilities.diagnosticProvider = false
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = false }),
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
return {
|
||||||
|
'ThePrimeagen/refactoring.nvim',
|
||||||
|
dependencies = {
|
||||||
|
'nvim-lua/plenary.nvim',
|
||||||
|
'nvim-treesitter/nvim-treesitter',
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require('refactoring').setup {}
|
||||||
|
end,
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue