fix: Enabled virtual text in lean

This commit is contained in:
Sayantan Santra 2025-04-24 23:39:31 -05:00
parent 47840ea0fd
commit d77ba87c3e
Signed by: SinTan1729
GPG key ID: 0538DD402EA50898

View file

@ -13,15 +13,6 @@ local function on_attach(_, bufnr)
-- gd in normal mode will jump to definition -- gd in normal mode will jump to definition
cmd('n', 'gd', vim.lsp.buf.definition) cmd('n', 'gd', vim.lsp.buf.definition)
-- <localleader>n will jump to the next Lean line with a diagnostic message on it
-- <localleader>N will jump backwards
cmd('n', '<localleader>n', function() vim.diagnostic.goto_next { popup_opts = { show_header = false } } end)
cmd('n', '<localleader>N', function() vim.diagnostic.goto_prev { popup_opts = { show_header = false } } end)
-- <localleader>K will show all diagnostics for the current line in a popup window
cmd('n', '<localleader>k',
function() vim.diagnostic.open_float(0, { scope = "line", header = false, focus = false }) end)
-- <localleader>q will load all errors in the current lean file into the location list -- <localleader>q will load all errors in the current lean file into the location list
-- (and then will open the location list) -- (and then will open the location list)
-- see :h location-list if you don't generally use it in other vim contexts -- see :h location-list if you don't generally use it in other vim contexts
@ -36,6 +27,14 @@ require('lean').setup {
mappings = true, mappings = true,
} }
-- Enable virtual text for Lean
vim.api.nvim_create_autocmd("LspAttach", {
pattern = "*.lean",
callback = function()
vim.diagnostic.config({ virtual_text = true })
end,
})
-- Update error messages even while you're typing in insert mode -- Update error messages even while you're typing in insert mode
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics, { vim.lsp.diagnostic.on_publish_diagnostics, {