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

file search: include workspace folder in filter #89765

Merged
merged 2 commits into from
Mar 2, 2020

Conversation

urbas
Copy link
Contributor

@urbas urbas commented Jan 31, 2020

It is now possible to filter files by the containing workspace folder in the "Go to File..." popup.

This is particularly useful when your workspace contains multiple projects, each with the same file.

A common example is the README.md file. Say you want to find a README.md file from a particular folder, say my-folder. Before this change you'd have to press the Down button a few times before you could get to the file.

With this change you'd instead search for mfREADME.md. The desired readme file should now appear closer to the top of the file search popup.

This PR fixes #32444

@msftclas
Copy link

msftclas commented Jan 31, 2020

CLA assistant check
All CLA requirements met.

Copy link
Member

@roblourens roblourens left a comment

Choose a reason for hiding this comment

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

Sorry @urbas, I thought I had written a response to this already but I guess I didn't. This is a good start, thanks for the PR But the solution will need a little more than this because I think it should

  1. only search with the folder name when in a multiroot workspace
  2. and it should also search with custom configured folder names instead of the real folder name when it is set in the workspace.

This will require changing the QueryBuilder and the query object that it creates to search. Let me know if you aren't interested in doing that work and I could look into it this month.

@roblourens roblourens added this to the February 2020 milestone Feb 7, 2020
@urbas
Copy link
Contributor Author

urbas commented Feb 8, 2020

@roblourens: both points sound very good. I'll do it.

Regarding the implementation: yes, I'll change the query interfaces, but I will probably also have to change the IRawFileMatch interface.

I will try to avoid API breaking changes but this will be easier to do if I could test against some external code (i.e. extensions that implement the family of interfaces specified in the src/vs/workbench/services/search/common/search.ts file). Do you know of any extension that implement these interfaces?

@roblourens
Copy link
Member

The extension search API is in vscode.proposed.d.ts, and that's not stabilized yet so it's not a big deal. I think you will need to add a folderName: string that goes next to the folder.

@urbas
Copy link
Contributor Author

urbas commented Feb 21, 2020

@roblourens: I have started by introducing a concept of "named folders" and expanding the QueryBuilder's file function to accept named folders. This is just the start, but I'm committing it now so you see where I'm headed.

Unfortunately, I wasn't able to find a way to make the code simpler. However, I could make a slight modification to my approach. Instead of introducing INamedFolder I could just use IWorkspaceFolderData. This results in a bit less code. Let me know which way would be preferred.

I will also rebase on top of master asap to resolve the conflict.

@urbas urbas force-pushed the master branch 2 times, most recently from 5ed11b5 to 22115c1 Compare February 21, 2020 21:06
@urbas
Copy link
Contributor Author

urbas commented Feb 22, 2020

@roblourens: this is now ready for another round of reviews. The feature uses workspace folder names (not basenames) and it's disabled when there's only one folder in the workspace.

The Windows build timed out but I'm not sure if my change caused that. Is that a flaky build or a real failure?

Copy link
Member

@roblourens roblourens left a comment

Choose a reason for hiding this comment

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

This looks great! We are stabilizing the Feb release this week. I will take another look next week when we start the March iteration.

src/vs/platform/workspace/common/workspace.ts Outdated Show resolved Hide resolved
@roblourens roblourens modified the milestones: February 2020, March 2020 Feb 24, 2020
"Go to File..." search can now filter files based on the workspace folder name.

This feature is activated only when the workspace contains more than one folder.

This is particularly useful when your workspace contains multiple files with the same name, each of them in another workspace folder.

A common example is the `README.md` file. Say you want to find a `README.md` file from a particular folder, say `my-folder`. Before this change you'd have to press the `Down` button a few times before you could get to the file.

With this change you'd instead search for `mfREADME.md`. The desired readme file should now appear closer to the top of the file search popup.
Copy link
Member

@roblourens roblourens left a comment

Choose a reason for hiding this comment

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

Thanks!

@roblourens roblourens merged commit 7cc0c75 into microsoft:master Mar 2, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Apr 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't search root folder names in quickopen
3 participants