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

Open a previewEditor while navigating files through QuickOpen #13236

Closed
wants to merge 2 commits into from
Closed

Open a previewEditor while navigating files through QuickOpen #13236

wants to merge 2 commits into from

Conversation

XVincentX
Copy link
Member

The following PR will solve #12892 - allowing to have a preview editor while navigating into files from a QuickOpen menu.

@mention-bot
Copy link

@XVincentX, thanks for your PR! By analyzing the history of the files in this pull request, we identified @egamma, @bpasero and @sandy081 to be potential reviewers.

@msftclas
Copy link

msftclas commented Oct 5, 2016

Hi @XVincentX, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!

The agreement was validated by Microsoft and real humans are currently evaluating your PR.

TTYL, MSBOT;

@@ -404,7 +404,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
}

// Focus (unless prevented)
const focus = !options || !options.preserveFocus;
const focus = !options || options.preserveFocus;
Copy link
Member

Choose a reason for hiding this comment

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

This cannot be changed...

Copy link
Member Author

@XVincentX XVincentX Oct 5, 2016

Choose a reason for hiding this comment

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

Ok, effectively we're not really taking about preserving focus at the end, but if give focus to the new opened editor - which is a different option. Now I understand that.

Anyway, if the options object is undefined it's going to focus the thing anyway - how should we handle this situation?

Copy link
Member

Choose a reason for hiding this comment

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

that is the correct behaviour. keeping focus should be the exception so please leave it like that


if (input instanceof EditorInput) {
if (isPreview) {
options.preserveFocus = false;
Copy link
Member

Choose a reason for hiding this comment

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

flip this

@@ -532,7 +532,7 @@ export class TextEditorOptions extends EditorOptions {
public static from(input: IResourceInput): TextEditorOptions {
let options: TextEditorOptions = null;
if (input && input.options) {
if (input.options.selection || input.options.forceOpen || input.options.revealIfVisible || input.options.preserveFocus || input.options.pinned || input.options.inactive || typeof input.options.index === 'number') {
if (input.options.selection || input.options.forceOpen || input.options.revealIfVisible || !input.options.preserveFocus || input.options.pinned || input.options.inactive || typeof input.options.index === 'number') {
Copy link
Member

Choose a reason for hiding this comment

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

all of this cannot be changed...

@XVincentX
Copy link
Member Author

@bpasero Cool - I misinterpreted the meaning of preserveFocus
I've flipped the behaviours and now it works correctly!

Thanks for the patience - I'll keep going and see what I can find out for the history entry!

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling b839e72d86be47cd181a0cc958f2764602607256 on XVincentX:master into * on Microsoft:master*.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling b839e72d86be47cd181a0cc958f2764602607256 on XVincentX:master into * on Microsoft:master*.

@bpasero bpasero self-assigned this Oct 5, 2016
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.004%) to 61.23% when pulling def22b0a364b57ff956dc1be011a2470307bfec0 on XVincentX:master into 809cef1 on Microsoft:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.01%) to 61.222% when pulling d19c3d539f4550a02866554369f5e58654331b49 on XVincentX:master into 809cef1 on Microsoft:master.

@XVincentX XVincentX changed the title WIP - Open a previewEditor while navigating files through QuickOpen Open a previewEditor while navigating files through QuickOpen Oct 5, 2016
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.01%) to 61.221% when pulling 7296d6a3c11be727d64e5bdb3022ae318b1e2d5a on XVincentX:master into 809cef1 on Microsoft:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.01%) to 61.222% when pulling 7296d6a3c11be727d64e5bdb3022ae318b1e2d5a on XVincentX:master into 809cef1 on Microsoft:master.

@bpasero
Copy link
Member

bpasero commented Oct 7, 2016

@XVincentX I am not 100% convinced that this should be an editor option. It seems very specific to the history management so maybe it would be better to just add a method to the history service to temporarily ignore editor changes while you navigate through the results.

There are 2 ugly cases that we still need to figure out: If you check for listeners of onEditorOpening you can find:

Obviously those two would not work anymore if we start to preview editors while navigating. i wonder if another solution should be added to avoid the onEditorOpening event hack.

@bpasero
Copy link
Member

bpasero commented Oct 7, 2016

I think the right approach to solve this issue is to change the IQuickOpenService.show() method to allow to be run in a mode where the result is returned, e.g. by passing in a function that should be called when an element is selected. If this is provided, the default action in the run method would not be called. That needs quite some adoption though across quick open providers...

@XVincentX
Copy link
Member Author

@bpasero I see.
I am totally willing to contribute! However if we do not really have a concrete action plan (agreed by you and probably your team mates) I have no idea how to start and make sure I do not come up with wrong solutions.

@bpasero
Copy link
Member

bpasero commented Oct 13, 2016

@XVincentX I pushed a change to get rid of onEditorOpening because I felt it was very ugly. This should make your PR simpler now. I think you should push for a method in history service to simply ignore pushing to the stack and try to leverage that 👍

@XVincentX
Copy link
Member Author

@bpasero Could you link the commit/change you made? So I can understand what happened in particular.

@bpasero
Copy link
Member

bpasero commented Oct 13, 2016

@XVincentX here: dfd3f57

This event would always fire when an editor is about to open and it would interfere with your contribution to open editors while navigating over results in the picker. I was never fond of that event and now decided to get rid of it. This should make your life easier.

@XVincentX
Copy link
Member Author

XVincentX commented Oct 13, 2016 via email

@XVincentX
Copy link
Member Author

@bpasero Unfortunately I will not be able to work on this during this week as I'll be out for the entire week. Please bear with me, hopefully I should be able to get the hands on next week.

@bpasero
Copy link
Member

bpasero commented Oct 17, 2016

@XVincentX np at all 👍 . To get it into this month release we would need to finish it on Monday though as we are closing then for finishing the sprint.

@bpasero
Copy link
Member

bpasero commented Oct 26, 2016

Closing in favour of #13909

@bpasero bpasero closed this Oct 26, 2016
@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.

5 participants