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] Fixed Windows file search inconsistencies #6029

Merged
merged 1 commit into from
Aug 28, 2019
Merged

[file-search] Fixed Windows file search inconsistencies #6029

merged 1 commit into from
Aug 28, 2019

Conversation

mcgordonite
Copy link
Contributor

What it does

Before:
windows-before
Note:

  • Labels for found files were relative paths from the workspace root containing backslashes.
  • Descriptions were the decoded path part of the workspace root URI.

After:
windows-after

Linux (for comparison):
linux-after

Also, allow Windows users to use both forwards or back slashes as path separators (same behaviour as VS code).

Fixes #1591

How to test

  • Use CTRLCMD+P file quick-open on Windows and compare with Linux / Mac.
  • Test on Windows using both forwards and back slash as path separator.

Review checklist

Reminder for reviewers

@akosyakov akosyakov added search in workspace issues related to the search-in-workspace file search issues related to the file search and removed search in workspace issues related to the search-in-workspace labels Aug 23, 2019
@vince-fugnitto
Copy link
Member

@mcgordonite please see the failing CI test on windows.
It looks as tho it comes from the test that was enabled during this PR.

@kittaakos
Copy link
Contributor

I am reviewing it.

@@ -54,7 +54,7 @@ describe('search-service', function (): void {
expect(testFile).to.be.not.undefined;
});

it.skip('shall respect nested .gitignore', async () => {
it('shall respect nested .gitignore', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please revert. It does not work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverted.

I had thought this test was fixed because it worked on both my linux and windows machines, but it's still failing on appveyor.

@kittaakos
Copy link
Contributor

I have verified the behavior on Windows, it worked and was in sync with VS Code.

Strange, that on Windows, the scm/package.json query provides the same result as the scm\package.json. The latter one does not work on macOS, but this behavior is still in sync with VS Code, so I am going to approve it once you revert the test.

- On Windows, `FileSearchService`.find now returns valid file URIs
as it already did on linux.
- Use LabelProvider to create tooltip field for quick open entries.
- Allow Windows users to search for file paths using either '/' or '\\'.

This makes the search UI consistent across platorms.

Signed-off-by: Matthew Gordon <matthew.gordon@arm.com>
@mcgordonite
Copy link
Contributor Author

@kittaakos thanks for the review!

Strange, that on Windows, the scm/package.json query provides the same result as the scm\package.json. The latter one does not work on macOS, but this behavior is still in sync with VS Code, so I am going to approve it once you revert the test.

I think this behaviour is consistent with other Theia behaviour on Windows: Theia displays relative paths with forward slash throughout the UI (e.g. SCM changes view, search results). It would be confusing if they couldn't use the same separator when searching.

@@ -25,7 +25,7 @@ export interface FileSearchService {

/**
* finds files by a given search pattern.
* @return the matching paths, relative to the given `options.rootUri`.
* @return the matching file uris
Copy link
Contributor

Choose a reason for hiding this comment

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

<3

Copy link
Contributor

@kittaakos kittaakos left a comment

Choose a reason for hiding this comment

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

Initially, I have checked the changes on my Windows 10 image, it worked as expected. I did another verification on Linux (Gitpod). The behavior is in sync with VS Code, in fact, VS Code throws an error if I search for ////, Theia does not. 😎

VS Code:
Screen Shot 2019-08-28 at 14 16 37

Thank you for your help, @mcgordonite!

@kittaakos kittaakos merged commit 7b5627a into eclipse-theia:master Aug 28, 2019
@mcgordonite mcgordonite deleted the file-search-windows branch August 28, 2019 12:43
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[file-search] The file search looks different on Windows and OS X
4 participants