This repository has been archived by the owner on May 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to show current file in Dependencies tree view (#1019)
* Add ability to show current file in Dependencies tree view By watching the `onDidChangeActiveTextEditor` event, we can reveal the current file in the Dependencies tree view. To be able to do that, however, we need to implement `getParent` method on `DependenciesTree` class. This method is used by VS Code to find the parent of a given node. In our case, we want to return the parent of a given file node, which is either a `GemDirectoryNode` or a `Dependency` node, depending on whether the parent directory is the root path of a gem or not. Moreover, when we can `TreeView.reveal` method to reveal a node, VSCode forces the tree view to be visible, which is a little jarring if the user has hidden the tree view. To avoid that, we store the current item to reveal in an instance variable, and reveal it when the tree view becomes visible again. If the tree view is already visible, we reveal the item immediately. * Use path to determine if we're at root * Respect auto reveal option when showing files from gems --------- Co-authored-by: Vinicius Stock <vinicius.stock@shopify.com>
- Loading branch information
Showing
1 changed file
with
101 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters