This repository was archived by the owner on May 30, 2024. It is now read-only.
Commit c0ccf6c
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>1 parent a70af33 commit c0ccf6c
1 file changed
Lines changed: 101 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
| |||
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
23 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
24 | 28 | | |
25 | 29 | | |
26 | 30 | | |
27 | 31 | | |
28 | 32 | | |
29 | 33 | | |
30 | 34 | | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
39 | 44 | | |
40 | 45 | | |
41 | 46 | | |
42 | | - | |
| 47 | + | |
43 | 48 | | |
44 | 49 | | |
45 | 50 | | |
| |||
59 | 64 | | |
60 | 65 | | |
61 | 66 | | |
62 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
63 | 91 | | |
64 | 92 | | |
65 | 93 | | |
66 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
67 | 144 | | |
| 145 | + | |
| 146 | + | |
68 | 147 | | |
69 | 148 | | |
70 | 149 | | |
| |||
76 | 155 | | |
77 | 156 | | |
78 | 157 | | |
79 | | - | |
| 158 | + | |
80 | 159 | | |
81 | 160 | | |
82 | 161 | | |
| |||
87 | 166 | | |
88 | 167 | | |
89 | 168 | | |
90 | | - | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
91 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
92 | 180 | | |
93 | 181 | | |
94 | 182 | | |
| |||
0 commit comments