Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rectify differences between lsp.DocumentSymbol and lsif.RangeBasedDocumentSymbol #124

Closed
beyang opened this issue Feb 24, 2021 · 1 comment
Milestone

Comments

@beyang
Copy link

beyang commented Feb 24, 2021

LSIF defines DocumentSymbolResult like this:

export interface DocumentSymbolResult extends V {

  label: 'documentSymbolResult';

  result: lsp.DocumentSymbol[] | RangeBasedDocumentSymbol[];
}

Note the choice between lsp.DocumentSymbol or RangeBasedDocumentSymbol. The latter points to a range that includes one of DeclarationTag, DefinitionTag, ReferenceTag or UnknownTag.

There is some information that is present in lsp.DocumentSymbol that doesn't appear to be able to be reconstructed from RangeBasedDocumentSymbol and the range tag:

  1. lsp.DocumentSymbol contains a tags?: SymbolTag[] field, which isn't present in any of the range tags.
  2. lsp.DocumentSymbol includes a name: string field while DefinitionTag and DeclarationTag include a text: string field.

Proposal 1: Add a field tags?: Symbol[] to DefinitionTag and DeclarationTag so that this information is present for symbols when a LSIF indexer chooses to use the RangeBasedDocumentSymbol-based representation.

Proposal 2: Add a name: string field to DefinitionTag and DeclarationTag or else rename the text: string field in these interfaces to name.

@dbaeumer dbaeumer transferred this issue from microsoft/language-server-protocol Mar 1, 2021
@dbaeumer dbaeumer added this to the Next milestone Mar 1, 2021
@dbaeumer
Copy link
Member

dbaeumer commented Mar 1, 2021

Having a symbol tag makes sense. And we should document that name === text. There needs to be some transformation anyways from a RangeBasedDocumentSymbol to a DocumentSymbol.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants