-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
Conversation
@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. |
Hi @XVincentX, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution! 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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This cannot be changed...
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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') { |
There was a problem hiding this comment.
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...
@bpasero Cool - I misinterpreted the meaning of Thanks for the patience - I'll keep going and see what I can find out for the history entry! |
Coverage decreased (-0.004%) to 61.23% when pulling def22b0a364b57ff956dc1be011a2470307bfec0 on XVincentX:master into 809cef1 on Microsoft:master. |
Coverage decreased (-0.01%) to 61.222% when pulling d19c3d539f4550a02866554369f5e58654331b49 on XVincentX:master into 809cef1 on Microsoft:master. |
Coverage decreased (-0.01%) to 61.221% when pulling 7296d6a3c11be727d64e5bdb3022ae318b1e2d5a on XVincentX:master into 809cef1 on Microsoft:master. |
Coverage decreased (-0.01%) to 61.222% when pulling 7296d6a3c11be727d64e5bdb3022ae318b1e2d5a on XVincentX:master into 809cef1 on Microsoft:master. |
@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
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 |
I think the right approach to solve this issue is to change the |
@bpasero I see. |
@XVincentX I pushed a change to get rid of |
@bpasero Could you link the commit/change you made? So I can understand what happened in particular. |
@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. |
Thanks! Let’s see if I can come up with something.
V.
|
@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. |
@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. |
Closing in favour of #13909 |
The following PR will solve #12892 - allowing to have a preview editor while navigating into files from a QuickOpen menu.