pappasam / jedi-language-server

A Python language server exclusively for Jedi. If Jedi supports it well, this language server should too.
MIT License
596 stars 45 forks source link

textDocument/documentSymbol returns deprecated SymbolInformation #254

Closed levouh closed 1 year ago

levouh commented 1 year ago

textDocument/documentSymbol seems to return SymbolInformation, which is deprecated. As far as I can tell, it should be returning DocumentSymbol instead.

levouh commented 1 year ago

Looks like this is more-so based on what the client reports it can support, e.g. see here, however the client I am using (Neovim 0.9+) reports hierarchicalDocumentSymbolSupport as true per :lua =vim.lsp.protocol.make_client_capabilities():

{
  textDocument = {
    ...,
    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 }
      }
    },
    ...
levouh commented 1 year ago

It seems there are plugins that advise "overriding" the default client capabilities in a way that would seemingly supplement them, however they actually just return a replacement.

Just as a note if anyone using Neovim comes across this, cmp-nvim-lsp notes that you should set your client capabilities to the return of:

local capabilities = require("cmp_nvim_lsp").default_capabilites()

-- Use as needed with `lspconfig.server.setup`, `vim.lsp.start_client`, etc.

however, this only returns values for textDocument/completion. What you should actually do is use this to set only the completion capabilities of the built-in LSP client. This can be done like:

local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion = require("cmp_nvim_lsp").default_capabilities.textDocument.completion

-- Use as needed with `lspconfig.server.setup`, `vim.lsp.start_client`, etc.