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-seach: improve handling of command #7846

Merged
merged 2 commits into from
May 26, 2020
Merged

file-seach: improve handling of command #7846

merged 2 commits into from
May 26, 2020

Conversation

vince-fugnitto
Copy link
Member

@vince-fugnitto vince-fugnitto commented May 19, 2020

What it does

Fixes #7844

This pull-request contributes the following items:

  • introduces the workspaceState when context which can ultimately be used by new commands
  • improves the handling of the quick-file open:
    • enables the command in all cases (even when no workspace is opened)
    • adds proper handling when no results are found (No matching results)

How to test

  1. start the application without a workspace opened
  2. execute the file-search command (ctrlcmd+p)
  3. the quick-file-open should be properly displayed
  4. searching for results will yield the No matching results item
  5. open a workspace
  6. execute the file-search command (ctrlcmd+p)
  7. searching should yield results in the quick-file open
  8. search for a random string (ex: adsaasdadsadad) it should yield the No matching results item

Review checklist

Reminder for reviewers

Signed-off-by: vince-fugnitto vincent.fugnitto@ericsson.com

@vince-fugnitto vince-fugnitto added quality issues related to code and application quality file search issues related to the file search labels May 19, 2020
@vince-fugnitto vince-fugnitto self-assigned this May 19, 2020
Copy link
Contributor

@lmcbout lmcbout left a comment

Choose a reason for hiding this comment

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

Somewhere in the issue, it should stipulate this is for ELECTRON only, not for the browser. If there is no workspace and I do (CTRL + P) in the browser, there is a command attach to it.(Print)

Works as expected BUT if I open the command and remove the ">", it says in the quick open bar "File name to search" , but it is looking inside the workspace and if there is no workspace, it does nothing. (As an end-user, I expect something here) Should we allow to have the quick open search box available in this case?

Second, If I open a file (CTRL + O) with no workspace, it opens the file and then the command (CTRL+P) it opens the quick search , but still, cannot return any files to open.

@vince-fugnitto

This comment has been minimized.

@lmcbout
Copy link
Contributor

lmcbout commented May 20, 2020

So if not exclusive to ELECTRON, then it does not work properly since the command ( CTRL + P) in a CHROME browser, it tries to print, not opening the quick open file selection

@vince-fugnitto
Copy link
Member Author

So if not exclusive to ELECTRON, then it does not work properly since the command ( CTRL + P) in a CHROME browser, it tries to print, not opening the quick open file selection

@lmcbout the command should not be present without a workspace present (which is the case).
The ctrl+p is a reserved keybinding (ex: chrome) if no command is present.

@lmcbout

This comment has been minimized.

@vince-fugnitto

This comment has been minimized.

@vince-fugnitto
Copy link
Member Author

@akosyakov what should the behavior be when we are in the browser and no command is available which uses the browser's print keybinding? At the moment (after these changes), the print dialog from the browser will be prompted to end-users.

@akosyakov
Copy link
Member

@vince-fugnitto VS Code shows the quick find always, so no fix? introducing a new context key is nice anyway

Screenshot 2020-05-25 at 10 02 11

@vince-fugnitto
Copy link
Member Author

@vince-fugnitto VS Code shows the quick find always, so no fix? introducing a new context key is nice anyway

I can align to show the context-menu.
The issue of displaying the browser's print will still occur for applications which are not using the file-search however, so I was wondering if there was anything we should do about it.

This commit introduces the `workspaceState` when context which
can be used by commands to have proper `when` closure.

Signed-off-by: vince-fugnitto <vincent.fugnitto@ericsson.com>
@akosyakov
Copy link
Member

I can align to show the context-menu.

@vince-fugnitto Not sure what you mean. In VS Code they always show the quick search, we should do the same, just fix the error in console. If we show it always then there is no print.

@vince-fugnitto
Copy link
Member Author

I can align to show the context-menu.

@vince-fugnitto Not sure what you mean. In VS Code they always show the quick search, we should do the same, just fix the error in console. If we show it always then there is no print.

Yes I’m currently working on it.
What I meant was that it an application does not include @theia/file-search as an extension then using the ctrlcmd+p keybinding will result in the browser’s print window. I’m asking if in a separate pull-request we should override this behaviour (ex: in core) so the print dialog is not shown.

@akosyakov
Copy link
Member

akosyakov commented May 25, 2020

What I meant was that it an application does not include @theia/file-search as an extension then using the ctrlcmd+p keybinding will result in the browser’s print window.

Let's wait for issues from adopters about it. We don't need to fix each possible combination if it never used.

- improves the quick-file open to show 'no matching results' when a search
yields no results
- improves handling of no workspaces
- enables the command always similarly to vscode

Signed-off-by: vince-fugnitto <vincent.fugnitto@ericsson.com>
@vince-fugnitto
Copy link
Member Author

@lmcbout do you mind retrying the pull-request?

@lmcbout
Copy link
Contributor

lmcbout commented May 25, 2020

@vince-fugnitto will do in a few minutes.

Copy link
Contributor

@lmcbout lmcbout left a comment

Choose a reason for hiding this comment

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

Tested on UBUNtu 18.04
Tested on electron, Firefox and Chrome
When there is no workspace, the "CTRLCMD+P"now open the quick open menu and works as expected
Note: may be on this PR or on another PR: If we use "CTRLCMD+P", -> open the quick view, then I enter the whole path for the file, we should allow to open that file even if there is no workspace.
i.e. "CTRLCMD+P" then enter "/home/lmcbout/.bashrc" (I am on UBUNTU, so this file exist for me), the file should open in the editor

@vince-fugnitto
Copy link
Member Author

Note: may be on this PR or on another PR: If we use "CTRLCMD+P", -> open the quick view, then I enter the whole path for the file, we should allow to open that file even if there is no workspace.
i.e. "CTRLCMD+P" then enter "/home/lmcbout/.bashrc" (I am on UBUNTU, so this file exist for me), the file should open in the editor

@lmcbout this is not the purpose of the quick-file open (it does not search for files outside the workspace nor does it open files on the filesystem by path). This behavior also does not align with vscode so I am not for adding it.

@lmcbout
Copy link
Contributor

lmcbout commented May 25, 2020

@lmcbout this is not the purpose of the quick-file open (it does not search for files outside the workspace nor does it open files on the filesystem by path). This behavior also does not align with vscode so I am not for adding it.

Just did a quick test on VSCODE and the file opens, so I guess it would be aligned with VSCODE 👍

@vince-fugnitto
Copy link
Member Author

@lmcbout this is not the purpose of the quick-file open (it does not search for files outside the workspace nor does it open files on the filesystem by path). This behavior also does not align with vscode so I am not for adding it.

Just did a quick test on VSCODE and the file opens, so I guess it would be aligned with VSCODE 👍

Not in this pull-request.

Copy link
Member

@akosyakov akosyakov left a comment

Choose a reason for hiding this comment

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

have not tried, but code changes look good

@vince-fugnitto vince-fugnitto merged commit 02f4400 into master May 26, 2020
@vince-fugnitto vince-fugnitto deleted the vf/gh-7844 branch May 26, 2020 18:42
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 quality issues related to code and application quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

file-search: better handling of command when no workspace is present
3 participants