Skip to content

Make tree find controls more discoverable #173742

Open

Description

@Eskibear

The Find control in tree view is very useful and highly requested by the community, but still a lot of people are not aware that we already have it in vscode. For the moment, to find something in tree view, you have to

  • select an item to focus on the tree view
  • press ctrl/cmd + F

To expose the feature more, can we add an option to show a button on view/title as below?

The behavior will look like below.

find-button.mp4

(I mimic the behavior by calling commands viewId.focus and list.find in above demo...but to add the buttons for multiple views, I have to do that repeatedly registering multiple commands).

As this is a generic feature for all tree views, I think it probably we can add a new option showFindControl in TreeViewOptions, just like how we add "showCollapseAll" button. WDYT?

vscode/src/vscode-dts/vscode.d.ts

Lines 10349 to 10352 in a7d49b0

/**
* Whether to show collapse all action or not.
*/
showCollapseAll?: boolean;

Activity

  1. added
    feature-request
    tree-views
    on Feb 8, 2023
  2. added
    tree-widget
    and removed
    tree-views
    on Feb 17, 2023
  3. isidorn commented on May 5, 2023

    @isidorn

    Let's reopen this one and assign to backlog since we have been getting consistent feedback from extension authors that Find is not discoverable in the Custom Trees.

  4. changed the title [-]Add a button to show Find control in tree view [/-] [+]Make tree find controls more discoverable[/+] on Mar 27, 2024
  5. LucaGabi commented on May 22, 2024

    @LucaGabi

    Regarding #213055: please consider having an input text to filter like in this image (not only for the outline view but also for breadcrumbs) because this is in my opinion a very common action a developer dose to move easy around the code:
    image

  6. RedCMD commented on May 22, 2024

    @RedCMD
    Contributor

    and allow the extension to prefill/modify the find/filter field

  7. RedCMD commented on Feb 18, 2025

    @RedCMD
    Contributor

    I added a Find button to my extension

    Image
    Image

    I just have it execute the builtin list.find command

    async function tree_find(element?: element) {
    	await treeView.reveal(undefined, { focus: true });
    	vscode.commands.executeCommand('list.find');
    	// vscode.commands.executeCommand('list.toggleFindMode');
    	// vscode.commands.executeCommand('list.toggleFindMatchType');
    }

    sadly I can't prefill it or set the filter options (you can toggle them, but can't know what state they're in)

  8. Leong-Qi-Jin commented on Jul 10, 2025

    @Leong-Qi-Jin

    Is there any extension that does this? I would prefer not to use a shortcut (in fact, I never knew I could do this until today - I always used Cmd+P which isn't ideal)

  9. RedCMD commented on Jul 11, 2025

    @RedCMD
    Contributor

    Leong Qi Jin (Michael) (@Leong-Qi-Jin)

    atm it's just not possible to implement it in a clean way

    its very easy to add a find button to all views
    however there are multiple problems with that

    1. a lot of views don't support find at all
      we don't want to just be adding useless buttons everywhere
      Isidor Nikolic (@isidorn) can we have a context for when the find widget is available please?
    2. VSCode does not provide us any context to where the button was pressed
      and doesn't even switch focus to the correct view
      so you would very often press find on one view, and the find widget would appear on a different view
      currently only the active element is given
      undefined if the view is not owned by the extension
      can we context to which view the button came from please?
      currently we have to register a separate command for every single view
    3. enabling the find button to appear only in in-focus views doesn't work
      using the when clause "when": "view == focusedView" just straight up doesn't work
      even tho "when": "view == workbench.explorer.fileView && focusedView == workbench.explorer.fileView" works fine
      Benjamin Christopher Simmonds (@benibenj) can we get view == focusedView working please?
    4. VSCode provides us no way to change the focus
      even if we did know where the button was pressed, there would be nothing we could do about it
      can we get a command to change focus from one view to another?
    5. The only way to do it is to add a separate find command for every single view you want
      and with the 77,000 marketplace extensions, that's a lot
      can we get a when context for if a view is built-in or a 3rd party extension please?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

feature-requesttree-widget

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions