Language-server-protocol: textDocument/documentSymbol result question

Created on 6 Mar 2021  路  3Comments  路  Source: microsoft/language-server-protocol

What is the rationale behind having the textDocument/documentSymbol result being an array of either SymbolInformation or DocumentSymbol types?

Most helpful comment

The real answer is backward compatibility. DocumentSymbol was added in v3.10.0. If DocumentSymbolClientCapabilities.hierarchicalDocumentSymbolSupport is not true, then you must provide SymbolInformation. If it is true, you should prefer DocumentSymbol.

All 3 comments

SymbolInformation is easier to implement. So it's easier to get something out the door. But prefer DocumentSymbol as clients can use the extra structure for a better presentation.

The real answer is backward compatibility. DocumentSymbol was added in v3.10.0. If DocumentSymbolClientCapabilities.hierarchicalDocumentSymbolSupport is not true, then you must provide SymbolInformation. If it is true, you should prefer DocumentSymbol.

@KamasamaK thanks for jumping in.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alanz picture alanz  路  7Comments

davidanthoff picture davidanthoff  路  3Comments

lanza picture lanza  路  6Comments

kaloyan-raev picture kaloyan-raev  路  6Comments

Khaos66 picture Khaos66  路  5Comments