Providing a search feature

Hello! I’d like to provide search functionality in my IDE, pretty much the same thing as search in workspace but I’d like it to search in a folder I’d provide programmatically instead of in the workspace. I was thinking of extending search in workspace but it seems I’d have to do changes in too many places, so I’m not sure if that 's the right approach. Could somebody point me in the right direction? Thank you!

[original thread by Matej]

Do I understand correctly that on some user action you want to reveal the search in workspace view, preconfigure it (i.e. set search folder to include), but Theia does not provide API for it?

I wonder whether something like here could work for you:

You will need to inject SearchInWorkspaceFrontendContribution in your contribution to access such APIs.

[Matej]

Hmm… yes, this might work. I’ll give it a shot, thank you!

[Matej]

Uhh… as it turns out, this won’t do… The idea was to search in a folder which is not necessarily a workspace folder, but another folder on the disc, completely unrelated to the workspace. It seems that what you proposed would just let me narrow the search to a particular workspace folder. I guess I’ll try and build my own solution (I will be looking at search in workspace code to fish for implementation ideas, though :)). Thanks for your input anyway.

yes, it looks you are right, looking at how we construct args at the backend it seems to narrow only to workspace roots

fairly the view is called search in the workspace :slight_smile: