Today, when you use Treeview.reveal function, no matter the combination you choose for select and focus params, it will always reveal the tree view, if it is not visible.
This is the expected behaviour, based on its documentation
/**
* Reveals the given element in the tree view.
* If the tree view is not visible then the tree view is shown and element is revealed.
*
* By default revealed element is selected.
* In order to not to select, set the option `select` to `false`.
* In order to focus, set the option `focus` to `true`.
* In order to expand the revealed element, set the option `expand` to `true`. To expand recursively set `expand` to the number of levels to expand.
* **NOTE:** You can expand only to 3 levels maximum.
*
* **NOTE:** [TreeDataProvider](#TreeDataProvider) is required to implement [getParent](#TreeDataProvider.getParent) method to access this API.
*/
reveal(element: T, options?: { select?: boolean, focus?: boolean, expand?: boolean | number }): Thenable<void>;
What I'm asking is to have an option to avoid that behaviour, and _simply select_ the desired TreeItem, but leave the tree view hidden. So when the user _intentionally select the tree view_, the previously revealed TreeItem will be _selected/focused_.
I'm basically trying to mimic the Explorer: Auto reveal setting you have natively in VS Code.

Thank you
This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.
Happy Coding!
I had a problem with refreshing the tree. I solved my problem with expanding the tree. Then I figured out TreeView is also revealed when the tree expands. I found a solution for the not revealing the tree. This is checking the visibility of the tree. I wrote a sample code below.
let isChanged: boolean = false;
fileWatcher.onDidChange(() => {
isChanged = true;
if (treeView.visible) { // Reveal if treeview is visible
reveal(treeItem, {expand: true}); // Reveal
treeDataProvider.refresh(); // Run your function
isChanged = false;
}
});
treeView.onDidChangeVisibility((listener) => { // If visibility changed
if (listener.visible && isChanged) { // Check visibility and isChanged
reveal(treeItem, {expand: true}); // Reveal
treeDataProvider.refresh(); // Run your function
isChanged = false;
}
});
This feature request has not yet received the 20 community upvotes it takes to make to our backlog. 10 days to go. To learn more about how we handle feature requests, please see our documentation.
Happy Coding
:slightly_frowning_face: In the last 60 days, this feature request has received less than 20 community upvotes and we closed it. Still a big Thank You to you for taking the time to create this issue! To learn more about how we handle feature requests, please see our documentation.
Happy Coding!
Most helpful comment
I had a problem with refreshing the tree. I solved my problem with expanding the tree. Then I figured out TreeView is also revealed when the tree expands. I found a solution for the not revealing the tree. This is checking the visibility of the tree. I wrote a sample code below.