mirror of
https://github.com/ksyasuda/dotfiles.git
synced 2025-12-05 02:53:38 -08:00
fix ruff config and linting
This commit is contained in:
@@ -396,8 +396,8 @@ local telescope_mappings = {
|
||||
-- {{{ File Explorer Mappings (i guess)
|
||||
local file_explorer_mappings = {
|
||||
{ mode = "n", key = "<leader>nt", cmd = ":NvimTreeToggle<CR>" },
|
||||
{ mode = "n", key = "<leader>nc", cmd = ":lua require('notify').dismiss()<CR>" },
|
||||
{ mode = "n", key = "<leader>D", cmd = ":Dotenv .env<CR>", group = "Dotenv" },
|
||||
{ mode = "n", key = "<leader>nc", cmd = ":lua Snacks.notifier.hide()<CR>" },
|
||||
{ mode = "n", key = "<leader>nh", cmd = ":lua Snacks.notifier.show_history()<CR>" },
|
||||
}
|
||||
-- }}}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
return {
|
||||
"sontungexpt/better-diagnostic-virtual-text",
|
||||
event = "LspAttach",
|
||||
-- event = "LspAttach",
|
||||
enabled = true,
|
||||
config = function()
|
||||
local diagnostic = require("better-diagnostic-virtual-text")
|
||||
@@ -130,7 +130,7 @@ return {
|
||||
down_arrow = " ",
|
||||
above = false, -- the virtual text will be displayed above the line
|
||||
},
|
||||
priority = 2003, -- the priority of virtual text
|
||||
priority = 10000, -- the priority of virtual text
|
||||
inline = true,
|
||||
})
|
||||
end,
|
||||
|
||||
@@ -69,7 +69,6 @@ return {
|
||||
end
|
||||
end,
|
||||
})
|
||||
vim.lsp.enable(lsp)
|
||||
elseif lsp == "basedpyright" then
|
||||
vim.lsp.config(lsp, {
|
||||
capabilities = capabilities,
|
||||
@@ -97,7 +96,6 @@ return {
|
||||
},
|
||||
},
|
||||
})
|
||||
vim.lsp.enable(lsp)
|
||||
elseif lsp == "ruff" then
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("lsp_attach_disable_ruff_hover", { clear = true }),
|
||||
@@ -114,15 +112,12 @@ return {
|
||||
desc = "LSP: Disable hover capability from Ruff",
|
||||
})
|
||||
vim.lsp.config(lsp, {
|
||||
capabilities = capabilities,
|
||||
init_options = {
|
||||
settings = {
|
||||
configuration = vim.fn.stdpath("config") .. "lua/utils/ruff.toml",
|
||||
},
|
||||
configuration = vim.fn.stdpath("config") .. "/lua/utils/ruff.toml",
|
||||
logLevel = "info",
|
||||
},
|
||||
})
|
||||
end
|
||||
vim.lsp.config(lsp, { capabilities = capabilities })
|
||||
vim.lsp.enable(lsp)
|
||||
end
|
||||
end,
|
||||
|
||||
@@ -25,22 +25,13 @@ return {
|
||||
local orig_try_lint = lint.try_lint
|
||||
|
||||
lint.try_lint = function(...)
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local buftype = vim.api.nvim_get_option_value("buftype", { buf = bufnr })
|
||||
|
||||
-- Skip linting for non-file buffers (like hover docs)
|
||||
if buftype ~= "" then
|
||||
local opts = select(2, ...)
|
||||
local bufnr = (type(opts) == "table" and opts.bufnr) or vim.api.nvim_get_current_buf()
|
||||
if vim.api.nvim_get_option_value("buftype", { buf = bufnr }) ~= "" then
|
||||
return
|
||||
end
|
||||
|
||||
return orig_try_lint(...)
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
|
||||
callback = function()
|
||||
lint.try_lint()
|
||||
end,
|
||||
})
|
||||
end,
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
}
|
||||
|
||||
@@ -35,6 +35,8 @@ indent-width = 4
|
||||
# Assume Python 3.9
|
||||
target-version = "py39"
|
||||
|
||||
respect-gitignore = true
|
||||
|
||||
[lint]
|
||||
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
|
||||
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
|
||||
@@ -57,7 +59,7 @@ convention = "numpy" # Accepts: "google", "numpy", or "pep257".
|
||||
quote-style = "double"
|
||||
|
||||
# Like Black, indent with spaces, rather than tabs.
|
||||
indent-style = "spaces"
|
||||
indent-style = "space"
|
||||
|
||||
# Like Black, respect magic trailing commas.
|
||||
skip-magic-trailing-comma = false
|
||||
@@ -78,5 +80,3 @@ docstring-code-format = true
|
||||
# This only has an effect when the `docstring-code-format` setting is
|
||||
# enabled.
|
||||
docstring-code-line-length = "dynamic"
|
||||
|
||||
respect-gitignore = true
|
||||
|
||||
Reference in New Issue
Block a user