Skip to content

LSP handling for code actions is broken and deprecated #468

@SephVelut

Description

@SephVelut

The LSP handler injected by lean.setup() appears to strip the data field from codeAction/resolve requests. When executing a :lua vim.lsp.buf.code_action() the following panic occurs

[ERROR] .../lean/stderr.lua:92    "rpc"    "lake"    "stderr"    "PANIC at Lean.Server.CodeAction.getFileSource! Lean.Server.CodeActions.Basic:47:22: no data param on code action Change to IO.println\nbacktrace:\n" 

Disabling this plugin's LSP management and using the native Neovim client fixes the issue:

require('lean').setup{ lsp = { enable = false } }

vim.lsp.config('leanls', {
    cmd = { 'lean', '--server' },
    init_options = {
        editDelay = 10,
        hasWidgets = true,
    },
    on_attach = function(client, bufnr)
        local opts = { buffer = bufnr, noremap = true, silent = true }
        vim.keymap.set('n', '<C-CR>', vim.lsp.buf.code_action, opts)
    end,
})
vim.lsp.enable('leanls')

neovim v0.11.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions