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

Make switching between external reference-view and internal reference-view more feasible #146037

Closed
CsCherrYY opened this issue Mar 25, 2022 · 1 comment · Fixed by #152008
Closed
Assignees
Labels
insiders-released Patch has been released in VS Code Insiders polish Cleanup and polish issue references-viewlet
Milestone

Comments

@CsCherrYY
Copy link
Contributor

TL;DR

See the Requests section.

Background

Currently, vscode-java supports Type Hierarchy in its own way (not standard LSP) and use the reference-view API to show the result. Since Type Hierarchy has been supported in vscode, reference-view and language-client, we are trying to migrate our current implementation to LSP based and there is a PR in progress.

About the implementation in reference-view, we had a discussion in #126666. Now we can successfully migrate our UI implementation of supertype and subtype view to the [type hierarchy implementation] (https://github.com/microsoft/vscode-references-view/tree/main/src/types) in reference-view. However, for vscode-java, there is an extra Class Hierarchy view is not supported in reference-view and LSP. We want to implement it ourselves via reference-view API and find some gaps here.

Gaps

We can successfully register our own Class Hierarchy view and show it.
image
You can see we can switch to other view in vscode-java current implementation. either in the view title or in the item menu.

When migrating to LSP implementation, we encounter some difficulties in switching the Class Hierarchy view (implemented in vscode-java) and the Supertype/Subtype Hierarchy view (implemented in reference-view).

Switch from Class Hierarchy view (in vscode-java) to Supertype/Subtype Hierarchy view (in reference-view)

We need to execute command references-view.showSupertypes or references-view.showSubtypes to switch the view. We can offer the right location as an anchor, but the current implementation only receives TypeItem | unknown. We'd like to change this behavior to accept a vscode.Location as an anchor as well. (Actually, all we need here is the location)

Switch from Supertype/Subtype Hierarchy view to Class Hierarchy view

We can call our constructors to create a new Class Hierarchy view, but we don't have the current anchor information from current reference-view. The reference-view API only exposes setInput() method. If there is any api like getInput(): SymbolTreeInput then we can get the current anchor via SymbolTreeInput.location.

Requests

  1. Make the implementation of setTypeHierarchyDirection() accepts a vscode.Location as its parameter anchor as well.
  2. Add a new API
getInput(): SymbolTreeInput<unknown>;

on the opposite side of current setInput().

@jrieken do you think it make sense? If so, I can create corresponding PRs in the reference-view repository.

@CsCherrYY
Copy link
Contributor Author

@jrieken I found the references-view repo has been archived. Should I create the related PRs in vscode repo?

@jrieken jrieken added this to the August 2022 milestone Jul 21, 2022
@jrieken jrieken added polish Cleanup and polish issue references-viewlet labels Jul 21, 2022
@VSCodeTriageBot VSCodeTriageBot added unreleased Patch has not yet been released in VS Code Insiders insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Aug 19, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Oct 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
insiders-released Patch has been released in VS Code Insiders polish Cleanup and polish issue references-viewlet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants