diff --git a/init.lua b/init.lua index ef85a944..f19b921a 100644 --- a/init.lua +++ b/init.lua @@ -587,7 +587,31 @@ require('lazy').setup({ local servers = { clangd = {}, 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 = {}, ts_ls = {}, -- See `:help lspconfig-all` for a list of all the pre-configured LSPs @@ -677,7 +701,14 @@ require('lazy').setup({ formatters_by_ft = { lua = { 'stylua' }, -- 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 -- javascript = { "prettierd", "prettier", stop_after_first = true }, diff --git a/lua/custom/plugins/lsp_overrides.lua b/lua/custom/plugins/lsp_overrides.lua new file mode 100644 index 00000000..b1458a1d --- /dev/null +++ b/lua/custom/plugins/lsp_overrides.lua @@ -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, + }, +} diff --git a/lua/custom/plugins/refactoring.lua b/lua/custom/plugins/refactoring.lua new file mode 100644 index 00000000..8b200fea --- /dev/null +++ b/lua/custom/plugins/refactoring.lua @@ -0,0 +1,10 @@ +return { + 'ThePrimeagen/refactoring.nvim', + dependencies = { + 'nvim-lua/plenary.nvim', + 'nvim-treesitter/nvim-treesitter', + }, + config = function() + require('refactoring').setup {} + end, +}