Skip to content

Make prefill in quick open configurable#41586

Closed
ColCh wants to merge 17 commits intomicrosoft:masterfrom
ColCh:10413-fill-quick-open-with-selection
Closed

Make prefill in quick open configurable#41586
ColCh wants to merge 17 commits intomicrosoft:masterfrom
ColCh:10413-fill-quick-open-with-selection

Conversation

@ColCh
Copy link
Contributor

@ColCh ColCh commented Jan 14, 2018

@msftclas
Copy link

msftclas commented Jan 14, 2018

CLA assistant check
All committers have signed the CLA.

@usernamehw
Copy link
Contributor

usernamehw commented Jan 14, 2018

Have you tried to invoke quick pick | go to symbol | command palette | ... when no editor is opened?

Cannot read property 'getControl' of null

Cannot read property 'getControl' of undefined


You've already made similar PR in Atom => and you hid functionality under configuration and turned it off by default. What is different now?


Multi-line: in your Atom PR when having multi-line selection you don't prefill the input, right? Seems more logical to me to skip multi-line selections here too...

@ColCh
Copy link
Contributor Author

ColCh commented Jan 14, 2018

Have you tried to invoke quick pick | go to symbol | command palette | ... when no editor is opened?

wow thank you! didn't expected this case. Fixed

You've already made similar PR in Atom => and you hid functionality under configuration and turned it off by default. What is different now?

That behaviour was requested by member of Atom. Personally, I think that this feature should be turned ON by default and be unconfigurable. What do you think?

Webstorm has this feature as well. And AFAIK there is no config to turn it off.

Hm... I think it will be useful to control this feature

I will create 2 config entries:

  • to turn it ON/OFF
  • to control which prefixes to prefill from selection (it's for symbols and other prefixes I don't know)

Multi-line: in your Atom PR when having multi-line selection you don't prefill the input, right? Seems more logical to me to skip multi-line selections here too...

Agreed. Skipped that too. Fixed. Thank you!

}

private shouldPrefill(prefix?: string): boolean {
const isTurnedOn = this.configurationService.getValue('workbench.quickOpen.prefillFromSelection') as string;
Copy link
Contributor

Choose a reason for hiding this comment

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

This is boolean, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh yes my bad

fixed


const prefillsPrefix = prefixes.indexOf(prefix) !== -1;

return prefillsPrefix;
Copy link
Contributor

Choose a reason for hiding this comment

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

Could've been one line?
return prefixes.indexOf(prefix) !== -1;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah

corrected to be one line

'type': ['string', 'null']
},
'default': [
null,
Copy link
Contributor

Choose a reason for hiding this comment

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

Not obvious for what null stands for.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

null prefix is in file quick open

Copy link
Contributor

Choose a reason for hiding this comment

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

Then ... what for empty string?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it seems that empty string has no reason to be here

removed it

Copy link
Contributor

Choose a reason for hiding this comment

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

I thought maybe it would be better to remove null from config and use empty string (since empty string is the value in quick picker associated with go to file) - map it to null in code.

@bpasero
Copy link
Member

bpasero commented Jan 14, 2018

@ColCh I see two possible solutions:

  • we have a setting for this (disabled by default)
  • we introduce a new command that opens quick open with the selected text of the editor

My reason why I would never want this as default is that our quick open includes a list of recently opened editors in order of their appearance. This list would not show up anymore as soon as some text is prefilled based on the selection in the editor.

Btw we have code that gets selection from the editor for the "Open Symbol in Workspace" quick open handler already, check out: https://github.com/Microsoft/vscode/blob/master/src/vs/workbench/parts/search/electron-browser/search.contribution.ts#L268

@bpasero bpasero self-assigned this Jan 14, 2018
@bpasero bpasero added this to the On Deck milestone Jan 14, 2018
@ColCh
Copy link
Contributor Author

ColCh commented Jan 20, 2018

@bpasero thanks for suggestions and link to code

Ok, seems reasonable to turn on this feature only for search for all symbols, which is # prefix. This also will preserve current behaviour for prefill.

Open Symbol in Workspace is cool, but it prefills on ShowAllSymbolsAction, not counting all other quick open actions. Also, it selects text in quick open window, which was prefilled.

Feature implemented in current PR prefills on QuickOpen level, which stands separately.

I will remove prefill logic from ShowAllSymbolsAction and add selection of prefilled value.

* master:
  implement closeEditors properly when passing in editors
@ColCh
Copy link
Contributor Author

ColCh commented Jan 20, 2018

Done, please check again

@ColCh ColCh changed the title Prefill quick open with selection Make prefill in quick open configurable Jan 20, 2018
* master: (280 commits)
  fix issue with useAltAsMultiSelectModifier
  Log ripgrep cmd from quickopen to logservice
  Switch search output panel to logservice
  Use absolute paths for webview core resources
  Explicitly hide TS version status when in ts/js file with unknown scheme
  First attempt of search caching.
  Pick up latest TS insiders
  2018-01-19. Merged in translations from Transifex.
  Avoid double-counting same settings search query
  Use latest emmet helper that has fixes microsoft#33818
  Remove settings search @groupId filters - since group ids can now be extension guids, and nobody uses this anyway
  backups - make sure to use "utf8" as encoding and not "utf-8"
  Catch any errors that onLineData users throw
  use uuid as extensions configuration id
  fix format on save problem that occurs when a provider returns no edits
  fix microsoft#41724
  Fix microsoft#41868
  some menu polish for issue reporter
  Fix microsoft#40260
  Simplify edits handling in TextModelTokens
  ...
@bpasero bpasero removed this from the On Deck milestone Jan 21, 2018
@bpasero bpasero modified the milestone: Backlog Jan 21, 2018
@ColCh
Copy link
Contributor Author

ColCh commented Jan 21, 2018

Build is failing on Travis, but it seems that I can't clearly understand why it's failing...

@ColCh
Copy link
Contributor Author

ColCh commented Feb 1, 2018

@bpasero ping?

@bpasero
Copy link
Member

bpasero commented Feb 1, 2018

This change is not what I was expecting. I think I was expecting either a setting for just quick open (Cmd+P) or just a new command that would do this (I think a new command would be better).

@ColCh
Copy link
Contributor Author

ColCh commented Feb 1, 2018

Thank you for your thoughts

I think I was expecting either a setting for just quick open (Cmd+P)

This will introduce same logic as symbol search across the project with different implementation. I just think that having single place of handing input prefill is better, isn't it?

a new command that would do this (I think a new command would be better)

Hm, interesting proposal. You mean, one command will open command menu with defined prefix (quick open, symbol search, other ...) and will append selected text, and another command, which will just open command menu without prefill (like now) ?

Ok, I will code this. AFAIK only symbol search across the project now prefills selected text?

Any other points to consider?

@bpasero
Copy link
Member

bpasero commented Feb 1, 2018

@ColCh yeah we could add a new quick open command similar to Cmd+P today that puts the selection in. If there is any code to share between open symbols and open file, that would be good.

@bpasero bpasero added this to the On Deck milestone Feb 5, 2018
@bpasero
Copy link
Member

bpasero commented Feb 7, 2018

@ColCh you could also do this from an extension, see my comment in #10413 (comment)

@ColCh
Copy link
Contributor Author

ColCh commented Feb 7, 2018

@bpasero ooh thank you so much for that snippet! It seems that this functionality should not exist in core, but in extension, right?

@bpasero
Copy link
Member

bpasero commented Feb 8, 2018

@ColCh yeah let's start with an extension 👍

@bpasero bpasero closed this Feb 8, 2018
@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 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.

Prefill quick open input with selected text

4 participants