Disable *args and **kwargs complaints. Change netrw to \e

This commit is contained in:
Erik Stambaugh 2024-06-14 08:15:04 -07:00
parent 956c700c71
commit 3351bb9d59
3 changed files with 46 additions and 2 deletions

View file

@ -8,7 +8,7 @@ I'll put commands and things here so I don't forget
## netrw ## netrw
This is the vim file explorer. `\ee` enters it. I didn't use this at all before. It's just the vim file explorer. `\e` enters it.
From within, `%` creates a new file, or `d` creates a new directory From within, `%` creates a new file, or `d` creates a new directory

View file

@ -66,3 +66,46 @@ require "lspconfig".pyright.setup {
} }
} }
} }
-- disable pyright complaints about '*args" and '**kwargs' not being accessed in a function
-- https://github.com/MaskRay/ccls/issues/869#issuecomment-1793044831
function filter_diagnostics_pyright(diagnostic)
-- Allow kwargs to be unused, sometimes you want many functions to take the
-- same arguments but you don't use all the arguments in all the functions,
-- so kwargs is used to suck up all the extras
if diagnostic.message == '"args" is not accessed' or
diagnostic.message == '"kwargs" is not accessed' then
return false
end
-- -- Allow variables starting with an underscore
-- if string.match(diagnostic.message, '"_.+" is not accessed') then
-- return false
-- end
return true
end
function filter_diagnostics(diagnostic)
if diagnostic.source == "Pyright" then
return filter_diagnostics_pyright(diagnostic)
end
return true
end
function custom_on_publish_diagnostics(a, params, client_id, c, config)
params.diagnostics = vim.tbl_filter(filter_diagnostics, params.diagnostics)
vim.lsp.diagnostic.on_publish_diagnostics(a, params, client_id, c, config)
end
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
custom_on_publish_diagnostics, {})

View file

@ -1,5 +1,6 @@
vim.g.mapleader = "\\" vim.g.mapleader = "\\"
vim.keymap.set("n", "<leader>ee", vim.cmd.Ex) --vim.keymap.set("n", "<leader>ee", vim.cmd.Ex)
vim.keymap.set("n", "<leader>e", vim.cmd.Ex)
-- other stuff from https://github.com/ThePrimeagen/init.lua/blob/master/lua/theprimeagen/remap.lua -- other stuff from https://github.com/ThePrimeagen/init.lua/blob/master/lua/theprimeagen/remap.lua
vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true }) -- x to make executable vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true }) -- x to make executable