-
Notifications
You must be signed in to change notification settings - Fork 1k
Fixes VSTS 945987: Format document doesn't work from Navigate To when using the new editor #8323
Conversation
|
||
// we used to throw a NotSupportedException, however, that prevented us from | ||
// doing anything with native controls, see: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/945987 | ||
return null; |
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.
I'm ok with being less strict here, but I'm not sure if there was a specific reason to throw here. @Therzok ?
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.
GetNativeWidget
should be called only when we know it should contain that type. This change can be possibly reverted if the suggested change here is applied.
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.
Basically, if we are requesting the bad control type, we should throw.
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.
Depends. This can also serve as a pattern to check - i.e. can we get a type back. This is implemented on the majority of the editor classes, where you call .GetContent<T>
etc., and if we don't support it, we return null. I guess it's got more to do with pattern + consistency. I'm more of a null
guy myself, than an exception guy, but, again, if that's more of the convention across the rest of the codebase, I can revert - provided we also change the other parts to remove any implicit conversions.
@@ -37,6 +37,30 @@ internal protected Window (object window) : base (window) | |||
{ | |||
} | |||
|
|||
public bool IsRealized { |
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.
The naming here might be confusing, IsRealized
means in the Gtk world that the widget is "ready"/initialized and has been added to a parent, but not necessarily visible (in fact showing a widget will realize it first), for a Gtk.Window this means that it has a Gdk.Window. The better match from the Cocoa world would be NSView.Superview != null
, but I'm not sure about NSWindow
...
Is this used somwhere? If not, maybe let's remove that? Otherwise IsVisible
would make more sense.
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.
I honestly "copied" this in from @jsuarezruiz's PR, so maybe he's in a better place to provide that comment? If there's no particular reason, I'll change it to IsVisible
.
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.
@sevoku looking at the code, it feels IsRealized is probably the subset of both methods - as in, it will call IsRealized
in GTK world, and IsVisible
in Cocoa world.
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.
Maybe we just add an XML comment on here explaining, and leave as-is, since we're already in this GTK-focused frame of mind here.
main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs
Outdated
Show resolved
Hide resolved
main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs
Outdated
Show resolved
Hide resolved
main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs
Outdated
Show resolved
Hide resolved
e45dbde
to
26b777a
Compare
main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs
Show resolved
Hide resolved
main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs
Show resolved
Hide resolved
main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs
Show resolved
Hide resolved
main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs
Show resolved
Hide resolved
26b777a
to
0fde3b2
Compare
else | ||
throw new NotSupportedException (); | ||
|
||
throw new NotSupportedException ($"Cannot get native widget {typeof (T)}"); |
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.
❤️
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.
LGTM!
0fde3b2
to
715dcf7
Compare
@slluis this still requires a codeowner review from you, when you get a chance |
@avodovnik let's hold this until test failures are figured out. Sevo says DDRITs and Azure Integration test failures all start with:
So it seems like something regressed here for test automation. |
I relaunched the tests. Let's see what happens. |
715dcf7
to
82d5b90
Compare
This meant changing the behavior of Control, when GetNativeWidget was called. Until now, we threw a NotSupportedException, which meant that any check would fail (i.e. x is Gtk.Container container) would throw that exception, since it would try and convert.
82d5b90
to
71f17fe
Compare
@monojenkins backport release-8.3 |
@monojenkins backport release-8.3 |
This is the second attempt at fixing VSTS 945987, where Format Document doesn't work if invoked from the Navigate To window. The first PR #8265 attempted to resolve in a way that would allow commands to execute correctly on the handler, but as was pointed out, we also needed a way to allow native widgets to be focused.
I built on changes from here #7521 and extended the fix as it kept throwing exceptions.
Fixes https://vsmac.dev/945987