Julian / lean.nvim

neovim support for the Lean theorem prover
MIT License
248 stars 25 forks source link

Client 1 quit with exit code 0 and signal 11 #322

Closed arbitrary-dev closed 9 months ago

arbitrary-dev commented 9 months ago

I've added following to my ~/.config/nvim/lua/plugins/lean.lua:

return {
    {
        'Julian/lean.nvim',
    event = { 'BufReadPre *.lean', 'BufNewFile *.lean' },

        dependencies = {
            'neovim/nvim-lspconfig',
            'nvim-lua/plenary.nvim',
        },

        opts = {
            lsp = { on_attach = on_attach },
            mappings = true,
        }
    }
}

I also enabled LSP tracing:

[START][2023-11-23 00:20:57] LSP logging initiated                                                                                                                                                   
 22 [INFO][2023-11-23 00:20:57] .../vim/lsp/rpc.lua:662 "Starting RPC client" {  args = { "serve", "--", "/home/user/projects/hrmacbeth-math2001" },  cmd = "/usr/bin/lake",  extra = {    cwd = "/home/user/projects/hrmacbeth-math2001"  }}
 23 [TRACE][2023-11-23 00:20:57] .../lua/vim/lsp.lua:1306 "LSP[leanls]" "initialize_params" {  capabilities = {    textDocument = {      callHierarchy = {        dynamicRegistration = false      },          codeAction = {        codeActionLiteralSupport = {          codeActionKind = {            valueSet = { "", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "sour    ce", "source.organizeImports" }          }        },        dataSupport = true,        dynamicRegistration = false,        isPreferredSupport = true,        resolveSupport = {          properties =     { "edit" }        }      },      completion = {        completionItem = {          commitCharactersSupport = false,          deprecatedSupport = false,          documentationFormat = { "markdown",     "plaintext" },          preselectSupport = false,          snippetSupport = false        },        completionItemKind = {          valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1    6, 17, 18, 19, 20, 21, 22, 23, 24, 25 }        },        contextSupport = false,        dynamicRegistration = false      },      declaration = {        linkSupport = true      },      definition =     {        linkSupport = true      },      documentHighlight = {        dynamicRegistration = false      },      documentSymbol = {        dynamicRegistration = false,        hierarchicalDocumentSymb    olSupport = true,        symbolKind = {          valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 }        }      },      hover = {            contentFormat = { "markdown", "plaintext" },        dynamicRegistration = false      },      implementation = {        linkSupport = true      },      publishDiagnostics = {        relatedInformati    on = true,        tagSupport = {          valueSet = { 1, 2 }        }      },      references = {        dynamicRegistration = false      },      rename = {        dynamicRegistration = false,            prepareSupport = true      },      semanticTokens = {        augmentsSyntaxTokens = true,        dynamicRegistration = false,        formats = { "relative" },        multilineTokenSupport = fal    se,        overlappingTokenSupport = true,        requests = {          full = {            delta = true          },          range = false        },        serverCancelSupport = false,        toke    nModifiers = { "declaration", "definition", "readonly", "static", "deprecated", "abstract", "async", "modification", "documentation", "defaultLibrary" },        tokenTypes = { "namespace", "type",     "class", "enum", "interface", "struct", "typeParameter", "parameter", "variable", "property", "enumMember", "event", "function", "method", "macro", "keyword", "modifier", "comment", "string", "numb    er", "regexp", "operator", "decorator" }      },      signatureHelp = {        dynamicRegistration = false,        signatureInformation = {          activeParameterSupport = true,          document    ationFormat = { "markdown", "plaintext" },          parameterInformation = {            labelOffsetSupport = true          }        }      },      synchronization = {        didSave = true,            dynamicRegistration = false,        willSave = true,        willSaveWaitUntil = true      },      typeDefinition = {        linkSupport = true      }    },    window = {      showDocument = {            support = true      },      showMessage = {        messageActionItem = {          additionalPropertiesSupport = false        }      },      workDoneProgress = true    },    workspace = {      app    lyEdit = true,      configuration = true,      didChangeWatchedFiles = {        dynamicRegistration = false,        relativePatternSupport = true      },      semanticTokens = {        refreshSuppo    rt = true      },      symbol = {        dynamicRegistration = false,        hierarchicalWorkspaceSymbolSupport = true,        symbolKind = {          valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11    , 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 }        }      },      workspaceEdit = {        resourceOperations = { "rename", "create", "delete" }      },      workspaceFolders = t    rue    }  },  clientInfo = {    name = "Neovim",    version = "0.9.4"  },  initializationOptions = {    hasWidgets = true  },  processId = 5538,  rootPath = "/home/user/projects/hrmacbeth-math200    1",  rootUri = "file:///home/user/projects/hrmacbeth-math2001",  trace = "off",  workspaceFolders = { {      name = "/home/user/projects/hrmacbeth-math2001",      uri = "file:///home/user/projects/hrmacbeth-math2001"    } }}
 24 [DEBUG][2023-11-23 00:20:57] .../vim/lsp/rpc.lua:284  "rpc.send"  {  id = 1,  jsonrpc = "2.0",  method = "initialize",  params = {    capabilities = {      textDocument = {        callHierarchy = {              dynamicRegistration = false        },        codeAction = {          codeActionLiteralSupport = {            codeActionKind = {              valueSet = { "", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" }            }          },          dataSupport = true,          dynamicRegistration = false,          isPre    ferredSupport = true,          resolveSupport = {            properties = { "edit" }          }        },        completion = {          completionItem = {            commitCharactersSupport = fals    e,            deprecatedSupport = false,            documentationFormat = { "markdown", "plaintext" },            preselectSupport = false,            snippetSupport = false          },          co    mpletionItemKind = {            valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }          },          contextSupport = false,          dynami    cRegistration = false        },        declaration = {          linkSupport = true        },        definition = {          linkSupport = true        },        documentHighlight = {          dynami    cRegistration = false        },        documentSymbol = {          dynamicRegistration = false,          hierarchicalDocumentSymbolSupport = true,          symbolKind = {            valueSet = { 1,     2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 }          }        },        hover = {          contentFormat = { "markdown", "plaintext" },          dy    namicRegistration = false        },        implementation = {          linkSupport = true        },        publishDiagnostics = {          relatedInformation = true,          tagSupport = {                valueSet = { 1, 2 }          }        },        references = {          dynamicRegistration = false        },        rename = {          dynamicRegistration = false,          prepareSupport = t    rue        },        semanticTokens = {          augmentsSyntaxTokens = true,          dynamicRegistration = false,          formats = { "relative" },          multilineTokenSupport = false,              overlappingTokenSupport = true,          requests = {            full = {              delta = true            },            range = false          },          serverCancelSupport = false,              tokenModifiers = { "declaration", "definition", "readonly", "static", "deprecated", "abstract", "async", "modification", "documentation", "defaultLibrary" },          tokenTypes = { "namespace"    , "type", "class", "enum", "interface", "struct", "typeParameter", "parameter", "variable", "property", "enumMember", "event", "function", "method", "macro", "keyword", "modifier", "comment", "stri    ng", "number", "regexp", "operator", "decorator" }        },        signatureHelp = {          dynamicRegistration = false,          signatureInformation = {            activeParameterSupport = tru    e,            documentationFormat = { "markdown", "plaintext" },            parameterInformation = {              labelOffsetSupport = true            }          }        },        synchronization     = {          didSave = true,          dynamicRegistration = false,          willSave = true,          willSaveWaitUntil = true        },        typeDefinition = {          linkSupport = true            }      },      window = {        showDocument = {          support = true        },        showMessage = {          messageActionItem = {            additionalPropertiesSupport = false          }            },        workDoneProgress = true      },      workspace = {        applyEdit = true,        configuration = true,        didChangeWatchedFiles = {          dynamicRegistration = false,              relativePatternSupport = true        },        semanticTokens = {          refreshSupport = true        },        symbol = {          dynamicRegistration = false,          hierarchicalWorkspac    eSymbolSupport = true,          symbolKind = {            valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 }          }        },        wo    rkspaceEdit = {          resourceOperations = { "rename", "create", "delete" }        },        workspaceFolders = true      }    },    clientInfo = {      name = "Neovim",      version = "0.9.4"        },    initializationOptions = {      hasWidgets = true    },    processId = 5538,    rootPath = "/home/user/projects/hrmacbeth-math2001",    rootUri = "file:///home/user/projects/hrmacbeth-math2001",    trace = "off",    workspaceFolders = { {        name = "/home/user/projects/hrmacbeth-math2001",        uri = "file:///home/user/projects/hrmacbeth-math2001"      } }  }}
~

Yet no warnings for my file. And running :LeanRestartFile results in:

E5108: Error executing lua ...user/.local/share/nvim/lazy/lean.nvim/lua/lean/lsp.lua:109: attempt to index local 'client' (a nil value)                                                               
stack traceback:
        ...user/.local/share/nvim/lazy/lean.nvim/lua/lean/lsp.lua:109: in function 'restart_file'
        [string ":lua"]:1: in main chunk

Info window is present, though nothing there.

Julian commented 9 months ago

/usr/bin/lake Is a slightly suspicious place for your lake to be. What's the output of type -a lake in a terminal?

How did you install Lean?

And what happens if you run lake build?

arbitrary-dev commented 9 months ago

What's the output of type -a lake in a terminal?

$ type -a lake
lake is /usr/bin/lake

How did you install Lean?

Through the package manager in Gentoo:

$ emerge lean
$ equery l lean
 * Searching for lean ...
[IP-] [  ] sci-mathematics/lean-4.2.0_rc4:0/4

And what happens if you run lake build?

$ lake build
<it consumes one processor core & some 200m of RAM, yet no output>
Julian commented 9 months ago

Does your version of lean match your project then? Installing lean via anything but elan isn't really supported by the community. It of course will work if you do it right but if I'm honest I'm not very interested in helping make sure you did :) so you'll have to do so on your own before trying to use this plugin or else use elan.

arbitrary-dev commented 9 months ago

if I'm honest I'm not very interested in helping make sure you did :)

I appreciate your honesty :D

$ lake exe cache get          
zsh: segmentation fault  lake exe cache get

Perhaps I should try getting Lean from Elan instead, thanks for suggestion!

arbitrary-dev commented 9 months ago

Ok, seems to be the problem with lean itself when compiled for x86 architecture.