feat(lsp): add custom diagnostics for 'really' usage

pull/128/head
flin16 2025-06-14 18:30:52 -05:00
parent 95f9550202
commit 315f9f753b
2 changed files with 31 additions and 2 deletions

View File

@ -1,4 +1,2 @@
-- bootstrap lazy.nvim, LazyVim and your plugins
require("config.lazy")
vim.g.copilot_no_tab_map = true
vim.api.nvim_set_keymap("i", "<C-Tab>", 'copilot#Accept("<CR>")', { silent = true, expr = true })

31
lua/config/lsp.lua 100644
View File

@ -0,0 +1,31 @@
local null_ls = require("null-ls")
local no_really = {
method = null_ls.methods.DIAGNOSTICS,
filetypes = { "markdown", "text", "tex" },
generator = {
fn = function(params)
local diagnostics = {}
-- sources have access to a params object
-- containing info about the current file and editor state
for i, line in ipairs(params.content) do
local col, end_col = line:find("really")
if col and end_col then
-- null-ls fills in undefined positions
-- and converts source diagnostics into the required format
table.insert(diagnostics, {
row = i,
col = col,
end_col = end_col + 1,
source = "no-really",
message = "Don't use 'really!'",
severity = vim.diagnostic.severity.WARN,
})
end
end
return diagnostics
end,
},
}
null_ls.register(no_really)