-
Notifications
You must be signed in to change notification settings - Fork 7.6k
This fixes 2 issues when changing the Close Other Preferences #7088
Conversation
…mmands that were never registerd
@JeffryBooher @njx Can we merge this for Release 37? This fixes a pretty nasty bug that won't let you open the working set context menu when disabling all close other preferences. |
Sure - leaving it up to @JeffryBooher to assess the risk. |
@TomMalbran Please file a bug for the problem with context menus so we can track and regress the issue. I'm not clear on the steps to reproduce the symptoms you describe above. |
@JeffryBooher Is easy to reproduce. For the context menu issue open the preferences file and add the following preferences:
For the second issue, after adding any of those preferences, restart Brackets and check the developers tools. I can make an issue if you want. |
@JeffryBooher can you bring this up in the standup tomorrow so we can discuss merging it for release 37? I'll go ahead and tag it so it's on the radar. |
Isn't |
Some observations here: The original impl came long before preferences could be changed and reloaded so that means that some of the original impl should be updated to reflect that. Primarily with respect to registering commands. It seems better to just register the commands regardless of whether or not they are enabled in prefs and then enable / disable them as needed. Additionally the code enables and disables commands when the the context menu is opened regardless of the fact that the commands may not have been registered. This should generate an error or warning in the console. If we just register all commands regardless of whether or not their prefs are turned on then we don't have this problem. So line 108 should be:
This allows external methods (such as another commands) to invoke the command even if all of the context menu prefs for the commands are turned off. The team discussed this today and, since these prefs are not documented, the risk of anyone hitting any of these scenarios is minimal. We need to get sprint 37 wrapped up today so we're going to move this to sprint 38 when the changes discussed above are done. |
@SAplayer Not really. The items in @JeffryBooher That would solve the issue too and it would work fine. Would be the same behavior as before the preference were added, but you were able to remove the items from the settings. I am thinking that we should just separate the initial creation from the preferences update, since the code can be quite different now, and will be a better solution that using |
@JeffryBooher No, in fact this code was updated by me a few days ago, introducing these prefs. |
@SAplayer I think we need to separate the model from the view in this case so that the commands are always available and the menu is updated according to the prefs. |
@JeffryBooher @SAplayer I just split the initialization part from the preferences updates which makes the code look cleaner. The Commands now are always register. Since this fixes an issue created in this Sprint it would be nice if we can fix it for Sprint 37, The fix is kind of simple too, but I guess is a lower priority bug. |
@TomMalbran Looks much better now, thanks. Haven't tested it out yet. Another point, but not a showstopper (it would definitely be nice to get this PR landed in Sprint 37), is to add more tests. |
I'll try to add them later, if I have time. |
@SAplayer Which kind of tests are you thinking about? |
Maybe one to check that the prefs are minded at all and one to check the behaviour on pref change, if that's possible. |
Yeah it is possible but a lot of work. I'm going to merge this and confer internally to see what we should do about it. We had a discussion today around having unit tests to ensure bug fixes don't regress but this is hardly the bug to start with. We can file a separate issue for unit tests on this pull request since it really involves testing for menu changes. |
This fixes 2 issues when changing the Close Other Preferences
When all 3 Close other preferences are false, the commands are never registered, but it was still trying to change them which makes the working set context menu not open.
It was also trying to remove the menu Items when those were never added in the first place.