neo-tree.nvim icon indicating copy to clipboard operation
neo-tree.nvim copied to clipboard

BUG: Document Symbol source break in some special LS.

Open ngpong opened this issue 1 year ago • 4 comments

Did you check docs and existing issues?

  • [X] I have read all the docs.
  • [X] I have searched the existing issues.
  • [X] I have searched the existing discussions.

Neovim Version (nvim -v)

NVIM v0.10.0-dev

Operating System / Version

wsl2 ubuntu-22.04

Describe the Bug

微信截图_20240117201402

The textDocument/documentSymbol response for bashls is a bit different from the other LS, and thus fails when parsing the symbol tree. For this reason, I compared the results of several ls responses

bashls:

result = { 
  {
    kind = 12,
    location = {
      range = {
        ["end"] = {
          character = 1,
          line = 45
        },
        start = {
          character = 0,
          line = 0
        }
      },
      uri = "file:///home/ngpong/azerothcore-wotlk/apps/installer/includes/functions.sh"
    },
    name = "inst_configureOS"
  } 
}

jsonls

result = { 
  {
    children = {},
    detail = "azerothcore-wotlk",
    kind = 15,
    name = "name",
    range = {
      ["end"] = {
        character = 29,
        line = 1
      },
      start = {
        character = 2,
        line = 1
      }
    },
    selectionRange = {
      ["end"] = {
        character = 8,
        line = 1
      },
      start = {
        character = 2,
        line = 1
      }
    }
  }
}

clangd

result = { 
  {
    kind = 13,
    name = "using namespace boost::program_options",
    range = {
      ["end"] = {
        character = 38,
        line = 38
      },
      start = {
        character = 0,
        line = 38
      }
    },
    selectionRange = {
      ["end"] = {
        character = 38,
        line = 38
      },
      start = {
        character = 23,
        line = 38
      }
    }
  }
}

I'm not quite sure if this response from bashls is in line with the specification, and I'm sorry to say that I'm still very new to this area. But the key point is that I've seen approaches for this kind of differential handling elsewhere, e.g. nvim-navic, so maybe we should do the same, am I right?

Screenshots, Traceback

No response

Steps to Reproduce

  1. install bashls.
  2. open neotree and navigate to the Document Symbols source.

Expected Behavior

can open the document symbol source

Your Configuration

ngpong avatar Jan 17 '24 15:01 ngpong

I would contend that if bashls is not conforming to the LSP specification that an issue should be raised with them instead of here.

I don't actually know if that is the case but my assumption (correct me if I am wrong @pysan3 ) is that the Document Source is operating against the known LSP specification

A side note: I am able to recreate this issue

miversen33 avatar Jan 17 '24 16:01 miversen33

Unfortunately, I also have no knowledge about lsp and doc symbols. I hope @nhat-vo can help us out.

nvim-navic seems to first search for symbol.location.range [ref] and then overwrite the reference with symbol.range [ref] afterwards to handle this issue.

pysan3 avatar Jan 17 '24 17:01 pysan3

I apologize I thought you were the one that created this source 😂 my bad!

miversen33 avatar Jan 17 '24 17:01 miversen33