Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search additional roots #10448

Closed
wants to merge 1 commit into from
Closed

Conversation

gbodeen
Copy link
Contributor

@gbodeen gbodeen commented Nov 22, 2021

Signed-off-by: Gabriel Bodeen [email protected]

What it does

This adds a preference for additional root directories to search in both the Search-In-Workspace widget and the File-Search (ctrl+p) menu.

In interviews with our users, one of their requests was for the search features to be able to find code that wasn't technically within their workspace, but that was located in other, closely-related directories. For particularly large directories, it can be advantageous to make the code easily searchable with Theia without incurring other costs such as file watching.

I wanted to check whether there was appetite for this preference to be added directly to the Theia project. This preference explicitly goes beyond what is currently available in VS Code.

How to test

  1. Build Theia and launch with the Theia repository as the workspace.
  2. Search the preferences for additional, switch to Workspace scope, and edit the JSON to enter one or more paths, e.g. to the Blueprint repo and to a non-existent directory. You can use variable substitutions. For example, in my settings.json I added "search.additionalRoots": ["${env:HOME}/test/", "/repo/${env:USER}/theia-blueprint"].
  3. Use the Search-In-Workspace widget and the File-Search (ctrl+p) menu with various terms and filenames. You should observe entries from both the Theia and Blueprint repos; the presence of a non-existent directory should not cause any errors.

Review checklist

** Note: I haven't tested on Windows or Mac.

Reminder for reviewers

@colin-grant-work colin-grant-work self-requested a review November 22, 2021 17:54
@colin-grant-work colin-grant-work added proposal feature proposals (potential future features) search in workspace issues related to the search-in-workspace file search issues related to the file search labels Nov 22, 2021
Copy link
Member

@vince-fugnitto vince-fugnitto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gbodeen speaking offline with @colin-grant-work, I believe in order for the pull-request to work well, we might need some variable resolution in settings.json. I'm not sure that setting absolute paths will work well in the workspace scope as this is usually checked-in to the repo, and will not work for other users.

@gbodeen
Copy link
Contributor Author

gbodeen commented Nov 29, 2021

@gbodeen speaking offline with @colin-grant-work, I believe in order for the pull-request to work well, we might need some variable resolution in settings.json. I'm not sure that setting absolute paths will work well in the workspace scope as this is usually checked-in to the repo, and will not work for other users.

OK, I'll take a look soon.

@gbodeen
Copy link
Contributor Author

gbodeen commented Dec 2, 2021

@vince-fugnitto Variable resolution is added now.

@gbodeen gbodeen force-pushed the siw-addl-roots branch 2 times, most recently from 8a07c83 to 0242c73 Compare December 2, 2021 20:11
Signed-off-by: Gabriel Bodeen <[email protected]>
@alvsan09 alvsan09 self-requested a review December 14, 2021 15:46
Copy link
Contributor

@alvsan09 alvsan09 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested the following, and it works as expected 👍

  • Search of files (ctrl+p) within the folder of the additionalRoots
  • Search in workspace results include files withing the configured additionalRoots

The code looks good to me as well,
Thanks !!

@vince-fugnitto
Copy link
Member

@gbodeen do you mind rebasing the pull-request, I can take a final look afterwards :)

@gbodeen
Copy link
Contributor Author

gbodeen commented Feb 16, 2022

@gbodeen do you mind rebasing the pull-request, I can take a final look afterwards :)

Downstream, we've decided on a different approach. Just like there's a little toggle button for searching in ignored files, we've added another button to toggle between searching the workspace roots and searching the git roots. It makes sense for our users, whose workspaces are subdirectories of very large repos.

I'm not sure whether there's a variation on that which would be more generally useful and so suitable for Theia.

@vince-fugnitto
Copy link
Member

I'm not sure whether there's a variation on that which would be more generally useful and so suitable for Theia.

@gbodeen sounds good! If you don't feel that the feature is useful in the base framework I think we can close the pr for the moment.

@gbodeen gbodeen closed this Feb 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
file search issues related to the file search proposal feature proposals (potential future features) search in workspace issues related to the search-in-workspace
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants