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

SearchEditor: Add command to focus queryEditorWidget #94439

Closed
kdnk opened this issue Apr 4, 2020 · 11 comments · Fixed by #94799
Closed

SearchEditor: Add command to focus queryEditorWidget #94439

kdnk opened this issue Apr 4, 2020 · 11 comments · Fixed by #94799
Assignees
Labels
feature-request Request for new features or functionality good first issue Issues identified as good for first-time contributors help wanted Issues identified as good community contribution opportunities search-editor verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@kdnk
Copy link
Contributor

kdnk commented Apr 4, 2020

I want a command to focus on the queryEditorWidget in SearchEditor.
I use the SeachEditor feature with VScodeVim so I frequently use the ESC key. But I put the ESC to switch to normal mode but the cursor focuses on the queryEditorWidget.
I want to set another shortcut to do this but I can't.

I read source code and identified the cause of the focus on queryEditorWidget by ESC.

If I could I want to add a configurable command like search.action.focusQueryEditorWidget to focus on the queryEditorWidget.

@kdnk kdnk changed the title Add command to focus queryEditorWidget [SearchEditor] Add command to focus queryEditorWidget Apr 4, 2020
@kdnk kdnk changed the title [SearchEditor] Add command to focus queryEditorWidget SearchEditor: Add command to focus queryEditorWidget Apr 5, 2020
@JacksonKearl JacksonKearl added this to the April 2020 milestone Apr 6, 2020
@kdnk
Copy link
Contributor Author

kdnk commented Apr 7, 2020

@JacksonKearl Can I contribute to this issue?

@JacksonKearl
Copy link
Contributor

@kdnk I'm currently in the middle of a large refactoring of the search editor, which will almost certainly make merging any work you do difficult. However it should be completed in the coming days.

I may end up fixing this as part of the refactoring, but if not I'll ping you when I'm done!

@JacksonKearl
Copy link
Contributor

JacksonKearl commented Apr 9, 2020

Hey @kdnk, refactoring is in. If you want to take this onn you can start by looking at how we declare actions here:

export class OpenResultsInEditorAction extends Action {
static readonly ID: string = Constants.OpenInEditorCommandId;
static readonly LABEL = localize('search.openResultsInEditor', "Open Results in Editor");
constructor(id: string, label: string,
@IViewsService private viewsService: IViewsService,
@IInstantiationService private readonly instantiationService: IInstantiationService,
) {
super(id, label, 'codicon-go-to-file');
}
get enabled(): boolean {
const searchView = getSearchView(this.viewsService);
return !!searchView && searchView.hasSearchResults();
}
update() {
this._setEnabled(this.enabled);
}
async run() {
const searchView = getSearchView(this.viewsService);
if (searchView) {
await this.instantiationService.invokeFunction(createEditorFromSearchResult, searchView.searchResult, searchView.searchIncludePattern.getValue(), searchView.searchExcludePattern.getValue());
}
}
}

and how they get registered and assigned here:

registry.registerWorkbenchAction(SyncActionDescriptor.create(RerunSearchEditorSearchAction, RerunSearchEditorSearchAction.ID, RerunSearchEditorSearchAction.LABEL,
{ mac: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_R } }, ContextKeyExpr.and(SearchEditorConstants.InSearchEditor)),
'Search Editor: Search Again', category);

@JacksonKearl JacksonKearl added feature-request Request for new features or functionality help wanted Issues identified as good community contribution opportunities good first issue Issues identified as good for first-time contributors labels Apr 9, 2020
@kdnk
Copy link
Contributor Author

kdnk commented Apr 9, 2020

Thanks! I'll work on it!

@JacksonKearl JacksonKearl added the verification-needed Verification of issue is requested label Apr 22, 2020
@alexr00 alexr00 reopened this Apr 29, 2020
@alexr00 alexr00 added the verification-found Issue verification failed label Apr 29, 2020
@alexr00
Copy link
Member

alexr00 commented Apr 29, 2020

When I run the command Search Editor: Focus Search Editor Query Widget nothing happens. I assume I need to take some action first that causes the widget to show. If the command isn't always applicable, it should have a when clause so that it isn't run from the command palette with no effect.

JacksonKearl referenced this issue Apr 29, 2020
Fixup outdated saved search.
@JacksonKearl
Copy link
Contributor

Thanks, fixed.

@JacksonKearl JacksonKearl removed the verification-found Issue verification failed label Apr 29, 2020
@isidorn
Copy link
Contributor

isidorn commented Apr 30, 2020

Still happens. Steps

  1. Open search editor
  2. Click on Search Viewlet
  3. F1 > focus search editor widget -> nothing happens

Also please rename the action to be called
"Focus Search Editor Input"
We never have widget in our UI, it is an implementation detail

@isidorn isidorn reopened this Apr 30, 2020
@isidorn isidorn added the verification-found Issue verification failed label Apr 30, 2020
@JacksonKearl JacksonKearl removed the verification-found Issue verification failed label Apr 30, 2020
@JacksonKearl
Copy link
Contributor

Thanks, updated.

@isidorn
Copy link
Contributor

isidorn commented Apr 30, 2020

Thanks, works fine now. Adding verified label.

@isidorn isidorn added the verified Verification succeeded label Apr 30, 2020
@ArturoDent
Copy link

I note that the when clause has duplicated inSearchEditor && inSearchEditor for this command.

Version: 1.45.0-insider (user setup)
Commit: a0fe378
Date: 2020-04-30T05:39:08.281Z
Electron: 7.2.2
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.19619

@JacksonKearl
Copy link
Contributor

Thanks, fixed.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality good first issue Issues identified as good for first-time contributors help wanted Issues identified as good community contribution opportunities search-editor verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants