-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Improve include/exclude search in workspace #9307
Improve include/exclude search in workspace #9307
Conversation
d2e3b53
to
946d53e
Compare
packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.ts
Outdated
Show resolved
Hide resolved
packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.ts
Show resolved
Hide resolved
packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.ts
Outdated
Show resolved
Hide resolved
packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.ts
Outdated
Show resolved
Hide resolved
packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.ts
Outdated
Show resolved
Hide resolved
packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.ts
Outdated
Show resolved
Hide resolved
e5fb8e9
to
b0e3dbb
Compare
packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.ts
Outdated
Show resolved
Hide resolved
packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.slow-spec.ts
Outdated
Show resolved
Hide resolved
packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.slow-spec.ts
Outdated
Show resolved
Hide resolved
packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.slow-spec.ts
Outdated
Show resolved
Hide resolved
packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.ts
Outdated
Show resolved
Hide resolved
packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.slow-spec.ts
Outdated
Show resolved
Hide resolved
packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.ts
Outdated
Show resolved
Hide resolved
packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.ts
Outdated
Show resolved
Hide resolved
packages/search-in-workspace/src/browser/search-in-workspace-result-tree-widget.tsx
Show resolved
Hide resolved
packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.ts
Outdated
Show resolved
Hide resolved
packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.ts
Outdated
Show resolved
Hide resolved
packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.ts
Outdated
Show resolved
Hide resolved
packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.ts
Outdated
Show resolved
Hide resolved
packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.ts
Outdated
Show resolved
Hide resolved
packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.ts
Outdated
Show resolved
Hide resolved
packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.ts
Outdated
Show resolved
Hide resolved
packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.ts
Outdated
Show resolved
Hide resolved
packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.ts
Outdated
Show resolved
Hide resolved
bf41d62
to
3132c25
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some suggestions 😄
Let me know what you think!
packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.ts
Outdated
Show resolved
Hide resolved
packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.ts
Outdated
Show resolved
Hide resolved
packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.ts
Outdated
Show resolved
Hide resolved
packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.ts
Outdated
Show resolved
Hide resolved
packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.ts
Outdated
Show resolved
Hide resolved
packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.ts
Outdated
Show resolved
Hide resolved
packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.ts
Outdated
Show resolved
Hide resolved
packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.ts
Outdated
Show resolved
Hide resolved
packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.ts
Outdated
Show resolved
Hide resolved
packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.ts
Outdated
Show resolved
Hide resolved
20e14e9
to
98b503a
Compare
Hi @vince-fugnitto , @marechal-p , @dukengn, |
17b9d4a
to
34f535e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alvsan09 I only have minor comments left regarding the source-code. When addressed can you please squash the commits so that I can verify the final commit message and perform functional tests?
packages/search-in-workspace/src/node/ripgrep-search-paths-resolver.ts
Outdated
Show resolved
Hide resolved
packages/search-in-workspace/src/node/ripgrep-search-paths-resolver.ts
Outdated
Show resolved
Hide resolved
packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.ts
Outdated
Show resolved
Hide resolved
a309ada
to
10538dd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I confirmed that the search works for various use-cases 👍
- searching like today on master
- prefixing search with
./
for narrower results - searching outside the workspace (similarly to vscode)
- no visible regressions to search behavior
Enhancements: * Search with 'Files to include' specifying a relative path e.g. './README.md' will only consider existing files from workspace roots e.g. '${ROOT1}/README.md', '${ROOT2}/README.md'. * 'Files to include' are limiting the search to specific folders e.g. './test' should not include '${ROOT}/dir/test'. * Include/Exclude strings (i.e. not resolving to relative paths) are converted to two globs in order to include results of a resulting file and include files under a resulting folder i.e. resolved globs are `**/string` and `**/string/*`. e.g. input file '.snaphot' shall include a file '.snapshot' or if it's a folder it should apply to all the files underneath it. * Absulte path(s) given as include patterns override the search in workspace to search under the given file/folder path(s). * Files opened in editor will search the contents in editor so the search will exclude these files when searching the file system. * Include / Exclude file strings starting with './' (linux) or '.\' (windows) will be applied as absolute patterns relative to the applicable search paths (even if they include glob patterns). Signed-off-by: Alvaro Sanchez-Leon <[email protected]> Co-authored-by: marechal-p <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I confirmed that the changes still work well functionally with the latest updates 👍
The following descriptions apply to the user input for the fields
'Files to include' and 'Files to exclude' for the 'Search in
workspace' feature.
Enhancements:
apply the specified file.
not include './dir/path/test'.
to two globs in order to include results of a resulting file and
include files under a resulting folder i.e. resolved globs are
**/string
and**/string/*
.E.g. input file '.snaphot' shall include a file '.snapshot' or if
it's a folder it should apply to all the files underneath it.
Fixes: #8469
The search strategy offered by the search in workspace server
(RipgrepSearchInWorkspaceServer.search) is changed as follows:
By default, sets the search directories for the string WHAT to the provided ROOTURIS directories
and returns the assigned search id.
The include / exclude (options in SearchInWorkspaceOptions) are lists of patterns for files to
include / exclude during search (glob characters are allowed).
include patterns successfully recognized as absolute paths will override the default search and set
the search directories to the ones provided as includes.
Relative paths are allowed, the application will attempt to translate them to valid absolute paths
based on the applicable search directories.
Signed-off-by: Alvaro Sanchez-Leon [email protected]
What it does
For strings provided for files to include / exclude
How to test
4 new unit test cases provided
Manual testing can be performed as follows:
Using theia repo as an example directory structure:
.eslintcache
(verify that multiple matches are reported)Review checklist
Reminder for reviewers