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

Added an optional uri property to the DocumentSymbol. #425

Closed
wants to merge 1 commit into from

Conversation

kittaakos
Copy link

Clients can use this when the URI of the text document
cannot be inferred from the request context.

Issue: microsoft/language-server-protocol#582

Signed-off-by: Akos Kitta [email protected]

Clients can use this when the URI of the text document
cannot be inferred from the request context.

Signed-off-by: Akos Kitta <[email protected]>
@dbaeumer
Copy link
Member

I understand why you are requesting this (because of the type hierarchy request) but IMO this is not the right way to go. DocumentSymbols are as the name implies scoped to a document and we shouldn't start changing this. I would rather opt to have a new type TypeHierarchyItem. This ensures we can evolve them independently. In addition we can make these items lazy to better support large type hierarchies.

Any objection to close this ?

@kittaakos
Copy link
Author

because of the type hierarchy request

Yes :)

I would rather opt to have a new type TypeHierarchyItem.
This ensures we can evolve them independently.

This was the initial idea.

Any objection to close this ?

I do not mind adopting the proposals. What's your take on that, @svenefftinge?

@yyoncho
Copy link

yyoncho commented Oct 17, 2018

I would rather opt to have a new type TypeHierarchyItem.

IMO the name TypeHierarchyItem is not good since the class could be usefull for cases not related to type hierarchy. E. g. in Eclipse you could list the class symbols + inherited members.

@kittaakos
Copy link
Author

IMO the name TypeHierarchyItem is not good since the class could be usefull for cases not related to type hierarchy. E. g. in Eclipse you could list the class symbols + inherited members.

It should be still possible with the TypeHierarchyItem.

Presumably, you are talking about the Ctrl/Cmd+o functionality in Eclipse. It is your outline: textDocument/documentSymbol.

If you want the inherited members (Ctrl/Cmd+o and Ctrl/Cmd+o again), you can get the supertypes of the current document: textDocument/superTypes, and execute textDocument/documentSymbol for each type. Finally, you merge the result on the client. Although, I did not check with JDT, I would assume, Eclipse does it in two steps too. @yyoncho, correct me if I've overlooked something.

@svenefftinge
Copy link
Contributor

If you want the inherited members (Ctrl/Cmd+o and Ctrl/Cmd+o again), you can get the supertypes of the current document: textDocument/superTypes, and execute textDocument/documentSymbol for each type. Finally, you merge the result on the client. Although, I did not check with JDT, I would assume, Eclipse does it in two steps too. @yyoncho, correct me if I've overlooked something.

Deciding on whether a symbol is inherited or overridden requires knowledge of language semantics, so I'd say this is something to be provided by the language server and not the client.

@svenefftinge
Copy link
Contributor

Given the various listed use cases I still think it would be reasonable to have an abstraction for 'a symbol in a document'. But I see @dbaeumer point about the documentSymbols name conflicting.

@dbaeumer
Copy link
Member

The LSP actually tries hard to stay way from this. All the types it declares are bound to a tool action and usually return UI data types. The documentSymbols request would have better be named documentOutline and returned OutlineItems.

For most servers that request doesn't return all symbols defined in a document (for example locals are usually not part of this).

I will close the issue. Please ping if someone disagrees.

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

Successfully merging this pull request may close these issues.

4 participants