[clang-tools-extra] [clangd] Support symbolTags for document symbol (PR #113669)

Dietrich Travkin via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 29 01:58:40 PST 2024


travkin79 wrote:

Hi @chouzz,
I started testing your version of clangd that I built locally. It seems that clangd does not return any symbol tags. I'm checking if I missed something in LSP4J, LSP4E or somewhere else. I guess there is something missing when handling the json response and creating Java objects using JSONRPC, but I don't know yet.

At the moment, what I get for your [example](https://github.com/clangd/clangd/issues/2123#issuecomment-2441427739) is the following response (`tags` field is always null):

```json
[Either [
  left = null
  right = DocumentSymbol [
  name = "g_var"
  kind = Variable
  range = Range [
    start = Position [
      line = 0
      character = 0
    ]
    end = Position [
      line = 0
      character = 19
    ]
  ]
  selectionRange = Range [
    start = Position [
      line = 0
      character = 10
    ]
    end = Position [
      line = 0
      character = 15
    ]
  ]
  detail = "const int"
  tags = null
  deprecated = null
  children = null
]
], Either [
  left = null
  right = DocumentSymbol [
  name = "P"
  kind = Class
  range = Range [
    start = Position [
      line = 1
      character = 0
    ]
    end = Position [
      line = 8
      character = 1
    ]
  ]
  selectionRange = Range [
    start = Position [
      line = 1
      character = 6
    ]
    end = Position [
      line = 1
      character = 7
    ]
  ]
  detail = "class"
  tags = null
  deprecated = null
  children = ArrayList (
    DocumentSymbol [
      name = "pub"
      kind = Method
      range = Range [
        start = Position [
          line = 3
          character = 4
        ]
        end = Position [
          line = 3
          character = 14
        ]
      ]
      selectionRange = Range [
        start = Position [
          line = 3
          character = 9
        ]
        end = Position [
          line = 3
          character = 12
        ]
      ]
      detail = "void ()"
      tags = null
      deprecated = null
      children = null
    ],
    DocumentSymbol [
      name = "pri"
      kind = Method
      range = Range [
        start = Position [
          line = 5
          character = 4
        ]
        end = Position [
          line = 5
          character = 14
        ]
      ]
      selectionRange = Range [
        start = Position [
          line = 5
          character = 9
        ]
        end = Position [
          line = 5
          character = 12
        ]
      ]
      detail = "void ()"
      tags = null
      deprecated = null
      children = null
    ],
    DocumentSymbol [
      name = "pro"
      kind = Method
      range = Range [
        start = Position [
          line = 7
          character = 4
        ]
        end = Position [
          line = 7
          character = 14
        ]
      ]
      selectionRange = Range [
        start = Position [
          line = 7
          character = 9
        ]
        end = Position [
          line = 7
          character = 12
        ]
      ]
      detail = "void ()"
      tags = null
      deprecated = null
      children = null
    ]
  )
]
]]
```

https://github.com/llvm/llvm-project/pull/113669


More information about the cfe-commits mailing list