neovim / nvim-lspconfig

Quickstart configs for Nvim LSP
Apache License 2.0
10.5k stars 2.07k forks source link

Jump to definition does not work for Jedi #750

Closed WhyNotHugo closed 3 years ago

WhyNotHugo commented 3 years ago

I've set up jedi_language_server, and things like error messages and alike work okay. However, jumping to definition does not work.

Sample file:

class MyClass():
    pass

a = MyClass()
#     ^Put cursor here 

Run :lua vim.lsp.buf.definition(). Nothing happens.

mjlbach commented 3 years ago

Please do not delete the issue template.

Seems like a server issue, try pyright (can't reproduce locally with pyright) and report upstream.

WhyNotHugo commented 3 years ago

Odd, I didn't see the template (I was surprised by the lack of one).

Using coc-jedi does provide jumping to definition, in not fully certain it's a server issue.

Can I somehow debug the server directly?

mjlbach commented 3 years ago

Here's the template, I'll still need this information (especially clear the log, enable logging, do only go-to definition on this test file)


<!-- Before reporting: search existing issues and ensure you are running the latest nightly of neovim and the latest version of nvim-lspconfig. Note that this repository implements configuration and initialization of language servers. Implementation of the language server spec itself is located in the neovim core repository-->

- `nvim --version`:
- nvim-lsp version(commit hash):
- What language server (If the problem is related to a specific language server):
- Can you reproduce this behavior on other language server clients (vscode, languageclient-neovim, coc.nvim, etc.):
- Can you reproduce this behavior on other language servers offered in the nvim-lspconfig repo? (pyls -> pyright):
- Is the problem isolated to a particular language server:
- Operating system/version:

### How to reproduce the problem from neovim startup

### Actual behaviour

### Expected behaviour

### Minimal init.vim or init.lua and code sample
<!-- You can download a minimal_init.lua from here 
      curl -fLO https://raw.githubusercontent.com/neovim/nvim-lspconfig/master/test/minimal_init.lua 
      After editing to include your language server, run neovim with nvim -u minimal_init.lua -->

### Health check
<details>
<summary>Checkhealth result</summary>
<!-- Run `:checkhealth lspconfig` and paste the result here-->
</details>

### LSP log
<!-- If not using the minimal_init.lua please add vim.lsp.set_log_level("debug") to your lua block 
     in init.vim and paste a link to your log file, located at  $HOME/.cache/nvim/lsp.log (formerly $HOME/.local/share/nvim/lsp.log) -->
<details>
<summary>Log file</summary>
<!-- past you log between here -->
</details>
``
mjlbach commented 3 years ago

Any followup?

WhyNotHugo commented 3 years ago

How to reproduce the problem from neovim startup

class MyClass():
    pass

a = MyClass()
#     ^Put cursor here 

Run :lua vim.lsp.buf.definition().

Actual behaviour

Nothing happens.

Expected behaviour

Should jump to definition of the above.

Minimal init.vim or init.lua and code sample

The minimal template did not create a log in $HOME/.local/share/nvim/lsp.log, but here's the regular log from ~/.cache/nvim/lsp.log:

[ INFO ] 2021-03-01T09:33:16+0100 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:311 ]   "Starting RPC client"   {  args = {},  cmd = "jedi-language-server",  extra = {}}
[ DEBUG ] 2021-03-01T09:33:16+0100 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:626 ]  "LSP[jedi_language_server]" "initialize_params" {  capabilities = {    callHierarchy = {      dynamicRegistration = false,      <metatable> = <1>{        __tostring = <function 1>      }    },    textDocument = {      codeAction = {        codeActionLiteralSupport = {          codeActionKind = {            valueSet = { "", "Empty", "QuickFix", "Refactor", "RefactorExtract", "RefactorInline", "RefactorRewrite", "Source", "SourceOrganizeImports", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" },            <metatable> = <table 1>          },          <metatable> = <table 1>        },        dynamicRegistration = false,        <metatable> = <table 1>      },      completion = {        completionItem = {          commitCharactersSupport = false,          deprecatedSupport = false,          documentationFormat = { "markdown", "plaintext" },          preselectSupport = false,          snippetSupport = false,          <metatable> = <table 1>        },        completionItemKind = {          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 },          <metatable> = <table 1>        },        contextSupport = false,        dynamicRegistration = false,        <metatable> = <table 1>      },      declaration = {        linkSupport = true,        <metatable> = <table 1>      },      definition = {        linkSupport = true,        <metatable> = <table 1>      },      documentHighlight = {        dynamicRegistration = false,        <metatable> = <table 1>      },      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 },          <metatable> = <table 1>        },        <metatable> = <table 1>      },      hover = {        contentFormat = { "markdown", "plaintext" },        dynamicRegistration = false,        <metatable> = <table 1>      },      implementation = {        linkSupport = true,        <metatable> = <table 1>      },      publishDiagnostics = {        relatedInformation = true,        tagSupport = {          valueSet = { 1, 2 },          <metatable> = <table 1>        },        <metatable> = <table 1>      },      references = {        dynamicRegistration = false,        <metatable> = <table 1>      },      rename = {        dynamicRegistration = false,        prepareSupport = true,        <metatable> = <table 1>      },      signatureHelp = {        dynamicRegistration = false,        signatureInformation = {          documentationFormat = { "markdown", "plaintext" },          <metatable> = <table 1>        },        <metatable> = <table 1>      },      synchronization = {        didSave = true,        dynamicRegistration = false,        willSave = false,        willSaveWaitUntil = false,        <metatable> = <table 1>      },      typeDefinition = {        linkSupport = true,        <metatable> = <table 1>      },      <metatable> = <table 1>    },    window = {      showDocument = {        support = false,        <metatable> = <table 1>      },      showMessage = {        messageActionItem = {          additionalPropertiesSupport = false,          <metatable> = <table 1>        },        <metatable> = <table 1>      },      workDoneProgress = true,      <metatable> = <table 1>    },    workspace = {      applyEdit = true,      configuration = 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 },          <metatable> = <table 1>        },        <metatable> = <table 1>      },      workspaceFolders = true,      <metatable> = <table 1>    }  },  clientInfo = {    name = "Neovim",    version = "0.5.0"  },  initializationOptions = vim.empty_dict(),  processId = 1757984,  rootPath = "/home/hugo/tmp",  rootUri = "file:///home/hugo/tmp",  trace = "off",  workspaceFolders = { {      name = "/home/hugo/tmp",      uri = "file:///home/hugo/tmp"    } }}
[ DEBUG ] 2021-03-01T09:33:16+0100 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:388 ]  "rpc.send.payload"  {  id = 1,  jsonrpc = "2.0",  method = "initialize",  params = {    capabilities = {      callHierarchy = {        dynamicRegistration = false,        <metatable> = <1>{          __tostring = <function 1>        }      },      textDocument = {        codeAction = {          codeActionLiteralSupport = {            codeActionKind = {              valueSet = { "", "Empty", "QuickFix", "Refactor", "RefactorExtract", "RefactorInline", "RefactorRewrite", "Source", "SourceOrganizeImports", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" },              <metatable> = <table 1>            },            <metatable> = <table 1>          },          dynamicRegistration = false,          <metatable> = <table 1>        },        completion = {          completionItem = {            commitCharactersSupport = false,            deprecatedSupport = false,            documentationFormat = { "markdown", "plaintext" },            preselectSupport = false,            snippetSupport = false,            <metatable> = <table 1>          },          completionItemKind = {            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 },            <metatable> = <table 1>          },          contextSupport = false,          dynamicRegistration = false,          <metatable> = <table 1>        },        declaration = {          linkSupport = true,          <metatable> = <table 1>        },        definition = {          linkSupport = true,          <metatable> = <table 1>        },        documentHighlight = {          dynamicRegistration = false,          <metatable> = <table 1>        },        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 },            <metatable> = <table 1>          },          <metatable> = <table 1>        },        hover = {          contentFormat = { "markdown", "plaintext" },          dynamicRegistration = false,          <metatable> = <table 1>        },        implementation = {          linkSupport = true,          <metatable> = <table 1>        },        publishDiagnostics = {          relatedInformation = true,          tagSupport = {            valueSet = { 1, 2 },            <metatable> = <table 1>          },          <metatable> = <table 1>        },        references = {          dynamicRegistration = false,          <metatable> = <table 1>        },        rename = {          dynamicRegistration = false,          prepareSupport = true,          <metatable> = <table 1>        },        signatureHelp = {          dynamicRegistration = false,          signatureInformation = {            documentationFormat = { "markdown", "plaintext" },            <metatable> = <table 1>          },          <metatable> = <table 1>        },        synchronization = {          didSave = true,          dynamicRegistration = false,          willSave = false,          willSaveWaitUntil = false,          <metatable> = <table 1>        },        typeDefinition = {          linkSupport = true,          <metatable> = <table 1>        },        <metatable> = <table 1>      },      window = {        showDocument = {          support = false,          <metatable> = <table 1>        },        showMessage = {          messageActionItem = {            additionalPropertiesSupport = false,            <metatable> = <table 1>          },          <metatable> = <table 1>        },        workDoneProgress = true,        <metatable> = <table 1>      },      workspace = {        applyEdit = true,        configuration = 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 },            <metatable> = <table 1>          },          <metatable> = <table 1>        },        workspaceFolders = true,        <metatable> = <table 1>      }    },    clientInfo = {      name = "Neovim",      version = "0.5.0"    },    initializationOptions = vim.empty_dict(),    processId = 1757984,    rootPath = "/home/hugo/tmp",    rootUri = "file:///home/hugo/tmp",    trace = "off",    workspaceFolders = { {        name = "/home/hugo/tmp",        uri = "file:///home/hugo/tmp"      } }  }}

[ INFO ] 2021-03-01T09:33:16+0100 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:311 ]   "Starting RPC client"   {  args = {},  cmd = "jedi-language-server",  extra = {}}
[ DEBUG ] 2021-03-01T09:33:16+0100 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:626 ]  "LSP[jedi_language_server]" "initialize_params" {  capabilities = {    callHierarchy = {      dynamicRegistration = false,      <metatable> = <1>{        __tostring = <function 1>      }    },    textDocument = {      codeAction = {        codeActionLiteralSupport = {          codeActionKind = {            valueSet = { "", "Empty", "QuickFix", "Refactor", "RefactorExtract", "RefactorInline", "RefactorRewrite", "Source", "SourceOrganizeImports", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" },            <metatable> = <table 1>          },          <metatable> = <table 1>        },        dynamicRegistration = false,        <metatable> = <table 1>      },      completion = {        completionItem = {          commitCharactersSupport = false,          deprecatedSupport = false,          documentationFormat = { "markdown", "plaintext" },          preselectSupport = false,          snippetSupport = false,          <metatable> = <table 1>        },        completionItemKind = {          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 },          <metatable> = <table 1>        },        contextSupport = false,        dynamicRegistration = false,        <metatable> = <table 1>      },      declaration = {        linkSupport = true,        <metatable> = <table 1>      },      definition = {        linkSupport = true,        <metatable> = <table 1>      },      documentHighlight = {        dynamicRegistration = false,        <metatable> = <table 1>      },      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 },          <metatable> = <table 1>        },        <metatable> = <table 1>      },      hover = {        contentFormat = { "markdown", "plaintext" },        dynamicRegistration = false,        <metatable> = <table 1>      },      implementation = {        linkSupport = true,        <metatable> = <table 1>      },      publishDiagnostics = {        relatedInformation = true,        tagSupport = {          valueSet = { 1, 2 },          <metatable> = <table 1>        },        <metatable> = <table 1>      },      references = {        dynamicRegistration = false,        <metatable> = <table 1>      },      rename = {        dynamicRegistration = false,        prepareSupport = true,        <metatable> = <table 1>      },      signatureHelp = {        dynamicRegistration = false,        signatureInformation = {          documentationFormat = { "markdown", "plaintext" },          <metatable> = <table 1>        },        <metatable> = <table 1>      },      synchronization = {        didSave = true,        dynamicRegistration = false,        willSave = false,        willSaveWaitUntil = false,        <metatable> = <table 1>      },      typeDefinition = {        linkSupport = true,        <metatable> = <table 1>      },      <metatable> = <table 1>    },    window = {      showDocument = {        support = false,        <metatable> = <table 1>      },      showMessage = {        messageActionItem = {          additionalPropertiesSupport = false,          <metatable> = <table 1>        },        <metatable> = <table 1>      },      workDoneProgress = true,      <metatable> = <table 1>    },    workspace = {      applyEdit = true,      configuration = 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 },          <metatable> = <table 1>        },        <metatable> = <table 1>      },      workspaceFolders = true,      <metatable> = <table 1>    }  },  clientInfo = {    name = "Neovim",    version = "0.5.0"  },  initializationOptions = vim.empty_dict(),  processId = 1757991,  rootPath = "/home/hugo/tmp",  rootUri = "file:///home/hugo/tmp",  trace = "off",  workspaceFolders = { {      name = "/home/hugo/tmp",      uri = "file:///home/hugo/tmp"    } }}
[ DEBUG ] 2021-03-01T09:33:16+0100 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:388 ]  "rpc.send.payload"  {  id = 1,  jsonrpc = "2.0",  method = "initialize",  params = {    capabilities = {      callHierarchy = {        dynamicRegistration = false,        <metatable> = <1>{          __tostring = <function 1>        }      },      textDocument = {        codeAction = {          codeActionLiteralSupport = {            codeActionKind = {              valueSet = { "", "Empty", "QuickFix", "Refactor", "RefactorExtract", "RefactorInline", "RefactorRewrite", "Source", "SourceOrganizeImports", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" },              <metatable> = <table 1>            },            <metatable> = <table 1>          },          dynamicRegistration = false,          <metatable> = <table 1>        },        completion = {          completionItem = {            commitCharactersSupport = false,            deprecatedSupport = false,            documentationFormat = { "markdown", "plaintext" },            preselectSupport = false,            snippetSupport = false,            <metatable> = <table 1>          },          completionItemKind = {            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 },            <metatable> = <table 1>          },          contextSupport = false,          dynamicRegistration = false,          <metatable> = <table 1>        },        declaration = {          linkSupport = true,          <metatable> = <table 1>        },        definition = {          linkSupport = true,          <metatable> = <table 1>        },        documentHighlight = {          dynamicRegistration = false,          <metatable> = <table 1>        },        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 },            <metatable> = <table 1>          },          <metatable> = <table 1>        },        hover = {          contentFormat = { "markdown", "plaintext" },          dynamicRegistration = false,          <metatable> = <table 1>        },        implementation = {          linkSupport = true,          <metatable> = <table 1>        },        publishDiagnostics = {          relatedInformation = true,          tagSupport = {            valueSet = { 1, 2 },            <metatable> = <table 1>          },          <metatable> = <table 1>        },        references = {          dynamicRegistration = false,          <metatable> = <table 1>        },        rename = {          dynamicRegistration = false,          prepareSupport = true,          <metatable> = <table 1>        },        signatureHelp = {          dynamicRegistration = false,          signatureInformation = {            documentationFormat = { "markdown", "plaintext" },            <metatable> = <table 1>          },          <metatable> = <table 1>        },        synchronization = {          didSave = true,          dynamicRegistration = false,          willSave = false,          willSaveWaitUntil = false,          <metatable> = <table 1>        },        typeDefinition = {          linkSupport = true,          <metatable> = <table 1>        },        <metatable> = <table 1>      },      window = {        showDocument = {          support = false,          <metatable> = <table 1>        },        showMessage = {          messageActionItem = {            additionalPropertiesSupport = false,            <metatable> = <table 1>          },          <metatable> = <table 1>        },        workDoneProgress = true,        <metatable> = <table 1>      },      workspace = {        applyEdit = true,        configuration = 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 },            <metatable> = <table 1>          },          <metatable> = <table 1>        },        workspaceFolders = true,        <metatable> = <table 1>      }    },    clientInfo = {      name = "Neovim",      version = "0.5.0"    },    initializationOptions = vim.empty_dict(),    processId = 1757991,    rootPath = "/home/hugo/tmp",    rootUri = "file:///home/hugo/tmp",    trace = "off",    workspaceFolders = { {        name = "/home/hugo/tmp",        uri = "file:///home/hugo/tmp"      } }  }}
[ DEBUG ] 2021-03-01T09:33:17+0100 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:489 ]  "decoded"   {  id = 1,  jsonrpc = "2.0",  result = {    capabilities = {      codeActionProvider = true,      completionProvider = {        resolveProvider = false,        triggerCharacters = { ".", "'", '"' }      },      definitionProvider = true,      documentFormattingProvider = false,      documentHighlightProvider = true,      documentRangeFormattingProvider = false,      documentSymbolProvider = true,      executeCommandProvider = {        commands = {}      },      hoverProvider = true,      referencesProvider = true,      renameProvider = true,      signatureHelpProvider = {        triggerCharacters = { "(", "," }      },      textDocumentSync = 2,      workspace = {        workspaceFolders = {          changeNotifications = true,          supported = true        }      },      workspaceSymbolProvider = true    }  }}
[ DEBUG ] 2021-03-01T09:33:17+0100 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:388 ]  "rpc.send.payload"  {  jsonrpc = "2.0",  method = "initialized",  params = {    [true] = 6  }}
[ DEBUG ] 2021-03-01T09:33:17+0100 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:653 ]  "LSP[jedi_language_server]" "server_capabilities"   {  codeActionProvider = true,  completionProvider = {    resolveProvider = false,    triggerCharacters = { ".", "'", '"' }  },  definitionProvider = true,  documentFormattingProvider = false,  documentHighlightProvider = true,  documentRangeFormattingProvider = false,  documentSymbolProvider = true,  executeCommandProvider = {    commands = {}  },  hoverProvider = true,  referencesProvider = true,  renameProvider = true,  signatureHelpProvider = {    triggerCharacters = { "(", "," }  },  textDocumentSync = 2,  workspace = {    workspaceFolders = {      changeNotifications = true,      supported = true    }  },  workspaceSymbolProvider = true}
[ INFO ] 2021-03-01T09:33:17+0100 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:654 ]   "LSP[jedi_language_server]" "initialized"   {  resolved_capabilities = {    call_hierarchy = false,    code_action = true,    completion = true,    declaration = false,    document_formatting = false,    document_highlight = true,    document_range_formatting = false,    document_symbol = true,    execute_command = true,    find_references = true,    goto_definition = true,    hover = true,    implementation = false,    rename = true,    signature_help = true,    signature_help_trigger_characters = { "(", "," },    text_document_did_change = 2,    text_document_open_close = true,    text_document_save = false,    text_document_save_include_text = false,    text_document_will_save = false,    text_document_will_save_wait_until = false,    type_definition = false,    workspace_folder_properties = {      changeNotifications = true,      supported = true    },    workspace_symbol = true  }}
[ DEBUG ] 2021-03-01T09:33:17+0100 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:388 ]  "rpc.send.payload"  {  jsonrpc = "2.0",  method = "textDocument/didOpen",  params = {    textDocument = {      languageId = "python",      text = "\nclass MyClass():\n    pass\n\na = MyClass()\n#     ^Put cursor here \n",      uri = "file:///home/hugo/tmp/test.py",      version = 0    }  }}
[ DEBUG ] 2021-03-01T09:33:17+0100 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:489 ]  "decoded"   {  id = 1,  jsonrpc = "2.0",  result = {    capabilities = {      codeActionProvider = true,      completionProvider = {        resolveProvider = false,        triggerCharacters = { ".", "'", '"' }      },      definitionProvider = true,      documentFormattingProvider = false,      documentHighlightProvider = true,      documentRangeFormattingProvider = false,      documentSymbolProvider = true,      executeCommandProvider = {        commands = {}      },      hoverProvider = true,      referencesProvider = true,      renameProvider = true,      signatureHelpProvider = {        triggerCharacters = { "(", "," }      },      textDocumentSync = 2,      workspace = {        workspaceFolders = {          changeNotifications = true,          supported = true        }      },      workspaceSymbolProvider = true    }  }}
[ DEBUG ] 2021-03-01T09:33:17+0100 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:388 ]  "rpc.send.payload"  {  jsonrpc = "2.0",  method = "initialized",  params = {    [true] = 6  }}
[ DEBUG ] 2021-03-01T09:33:17+0100 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:653 ]  "LSP[jedi_language_server]" "server_capabilities"   {  codeActionProvider = true,  completionProvider = {    resolveProvider = false,    triggerCharacters = { ".", "'", '"' }  },  definitionProvider = true,  documentFormattingProvider = false,  documentHighlightProvider = true,  documentRangeFormattingProvider = false,  documentSymbolProvider = true,  executeCommandProvider = {    commands = {}  },  hoverProvider = true,  referencesProvider = true,  renameProvider = true,  signatureHelpProvider = {    triggerCharacters = { "(", "," }  },  textDocumentSync = 2,  workspace = {    workspaceFolders = {      changeNotifications = true,      supported = true    }  },  workspaceSymbolProvider = true}
[ INFO ] 2021-03-01T09:33:17+0100 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:654 ]   "LSP[jedi_language_server]" "initialized"   {  resolved_capabilities = {    call_hierarchy = false,    code_action = true,    completion = true,    declaration = false,    document_formatting = false,    document_highlight = true,    document_range_formatting = false,    document_symbol = true,    execute_command = true,    find_references = true,    goto_definition = true,    hover = true,    implementation = false,    rename = true,    signature_help = true,    signature_help_trigger_characters = { "(", "," },    text_document_did_change = 2,    text_document_open_close = true,    text_document_save = false,    text_document_save_include_text = false,    text_document_will_save = false,    text_document_will_save_wait_until = false,    type_definition = false,    workspace_folder_properties = {      changeNotifications = true,      supported = true    },    workspace_symbol = true  }}
[ DEBUG ] 2021-03-01T09:33:17+0100 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:489 ]  "decoded"   {  jsonrpc = "2.0",  method = "textDocument/publishDiagnostics",  params = {    diagnostics = {},    uri = "file:///home/hugo/tmp/test.py"  }}
[ DEBUG ] 2021-03-01T09:33:17+0100 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:487 ]  "notification"  "textDocument/publishDiagnostics"   {  diagnostics = {},  uri = "file:///home/hugo/tmp/test.py"}
[ DEBUG ] 2021-03-01T09:33:17+0100 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:407 ] "default_handler"   "textDocument/publishDiagnostics"   {  client_id = 1,  params = {    diagnostics = {},    uri = "file:///home/hugo/tmp/test.py"  }}
[ DEBUG ] 2021-03-01T09:33:19+0100 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:691 ]  "LSP[jedi_language_server]" "client.request"    1   "textDocument/definition"   {  position = {    character = 4,    line = 4  },  textDocument = {    uri = "file:///home/hugo/tmp/test.py"  }}    <function 1>    1
[ DEBUG ] 2021-03-01T09:33:19+0100 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:388 ]  "rpc.send.payload"  {  id = 2,  jsonrpc = "2.0",  method = "textDocument/definition",  params = {    position = {      character = 4,      line = 4    },    textDocument = {      uri = "file:///home/hugo/tmp/test.py"    }  }}
[ DEBUG ] 2021-03-01T09:33:19+0100 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:489 ]  "decoded"   {  id = 2,  jsonrpc = "2.0",  result = { {      range = {        end = {          character = 13,          line = 1        },        start = {          character = 6,          line = 1        }      },      uri = vim.NIL    } }}
[ DEBUG ] 2021-03-01T09:33:19+0100 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:407 ] "default_handler"   "textDocument/definition"   {  bufnr = 1,  client_id = 1,  params = { {      range = {        end = {          character = 13,          line = 1        },        start = {          character = 6,          line = 1        }      }    } }}

Health check

health#lspconfig#check
========================================================================
## Checking language server protocol configuration
  - INFO: jedi_language_server: configuration checked.
mjlbach commented 3 years ago

https://user-images.githubusercontent.com/13316262/109472392-ebe60b80-7a26-11eb-8d21-add87bc6ba2f.mov

WhyNotHugo commented 3 years ago

This is the minimal file I used:

local execute = vim.api.nvim_command
local fn = vim.fn

local install_path = "/tmp/site/pack/packer/opt/packer.nvim"

if fn.empty(fn.glob(install_path)) > 0 then
  execute("!git clone https://github.com/wbthomason/packer.nvim " .. install_path)
end

execute "packadd packer.nvim"

vim.cmd [[packadd packer.nvim]]
vim.cmd [[autocmd BufWritePost minimal_init.lua PackerCompile]]
vim.cmd [[autocmd BufWritePost minimal_init.lua PackerInstall]]

local use = require('packer').use
require("packer").startup(
  {
    function()
      use "neovim/nvim-lspconfig"
    end,
    config = {package_root = "/tmp/site/pack"}
  }
)

-- LSP settings
-- log file location: $HOME/.local/share/nvim/lsp.log
vim.lsp.set_log_level("debug")
local nvim_lsp = require('lspconfig')
local on_attach = function(_, bufnr)
  local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
  local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end

  buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')

  -- Mappings.
  local opts = { noremap=true, silent=true }
  buf_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts)
  buf_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)
  buf_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
  buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
  buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
  buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
  buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
  buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
  buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
  buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
  buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
  buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
  buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
  buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
  buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
end

-- Add the server that troubles you here
local name = "jedi_language_server"
if not name then
  print("You have not defined a server name, please edit minimal_init.lua")
end
if not nvim_lsp[name].document_config.default_config.cmd and (not cmd) then
  print([[You have not defined a server default cmd for a server
          that requires it please edit minimal_init.lua]])
end

nvim_lsp[name].setup {
    on_attach = on_attach,
  }

print([[You can find your log at $HOME/.local/share/nvim/lsp.log. Please paste in a
  github issue under a details tag as described in the issue template.]])

What results do you get with it?

mjlbach commented 3 years ago

(For reference, that file is based on my personal config)

I get the same results. I'm not sure what could be going on, but I'd check the python version you're installing jedi-language-server in is active

WhyNotHugo commented 3 years ago

Oh, figured it out. The jedi-language-server package for my distro is severely outdated. Built an updated package and it works.

Thanks for helping debug this, it's been far more helpful than you make think! :sweat_smile:

mjlbach commented 3 years ago

No worries! Glad you figured it out :) I'd also recommend you checkout pyright, which IMO gives faster/better completion and error results than jedi.

lithammer commented 3 years ago

@WhyNotHugo you should look into https://pipxproject.github.io/pipx/. It's a convenient way to install newer versions of Python tooling than the ones provided by your distro (or if they're missing completely).

WhyNotHugo commented 3 years ago

Thanks, but I'll just push for my distro to update these -- having two package managers on my system turns to complex too fast :sweat_smile: