mirror of
https://github.com/ksyasuda/dotfiles.git
synced 2026-02-04 06:36:35 -08:00
fix ruff config and linting
This commit is contained in:
@@ -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",
|
||||
},
|
||||
settings = {
|
||||
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" },
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user