-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Conversation
FYI, one of the big chunks of code, the function _disableCache() in main.js, has not been changed, it has only been moved to the top of the file to avoid a JSLint error, so disregard that part of the diff. |
This PR replaces PR #5620. |
I notice that extensions in the src/extensions/dev folder are still loaded in "Reload Without User Extensions" mode. Seems like they should not be loaded either. |
@redmunds, updated code committed. |
I notice that Menus.js is using CollectionUtils (which is deprecated in favor of lodash) when removing MenuItems. You can see warnings in console log. This should be cleaned up either in this pull request or split into a separate one. |
CommandManager.register(Strings.CMD_NEW_BRACKETS_WINDOW, DEBUG_NEW_BRACKETS_WINDOW, _handleNewBracketsWindow); | ||
CommandManager.register(Strings.CMD_REFRESH_WINDOW, DEBUG_REFRESH_WINDOW, handleFileReload); | ||
CommandManager.register(Strings.CMD_RELOAD_WITHOUT_USER_EXTS, DEBUG_RELOAD_WITHOUT_USER_EXTS, _handleReloadWithoutUserExts); | ||
CommandManager.register(Strings.CMD_NEW_BRACKETS_WINDOW, DEBUG_NEW_BRACKETS_WINDOW, _handleNewBracketsWindow); |
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 can see that this existed before you made any changes to this file, but functions are not named consistently -- some are preceded with underscores and some are not. Since extensions can not (yet, anyway) export functions, all functions are, by definition, private -- so there's no reason to precede names with underscores. I can go either way as long as it's consistent.
Also, handleFileReload
doesn't seem quite right since all files are being reloaded, so this should just be handleReload
(or _handleReload
).
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.
It does export _runUnitTests()
, which I imagine is used by Jasmine, so should I remove all underscores from functions except for _runUnitTests()
? Or should I set exports._runUnitTests
to runUnitTests
?
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 missed that one. It should be _runUnitTests()
because it's only for unit tests.
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.
Done. Removed underscores from all methods except _runUnitTests()
.
This functionality should be mentioned in the documentation. Here are a couple places that come to mind:
|
Updating Menus.js to use lodash instead of CollectionUtils: Done. |
Another piece of documentation that needs to be updated: The How to Report an Issue Extension bugs section Do you want me to make these changes now or after the next Sprint release? |
@redmunds, I reviewed your review. Made some changes but have not yet done the commit because I have some additional questions. See above. |
Good point. These changes should be done right after next Sprint Release. |
@redmunds, code review updates committed. |
|
||
if (params.get("reloadWithoutUserExts") === "true") { | ||
paths = ["default"]; | ||
} |
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 block of code assumes that the only possible values for the paths array is ["default", "dev", getUserExtensionPath()]
or ["default"]
. This seems to currently be the case, but this code would be more robust if it were to remove the "dev"
and getUserExtensionPath()
elements instead.
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.
Other than unit tests, the paths
argument is always null -- so the standard list is already hardcoded right here on line 323. So one alternative would be to just move this if
up into the !paths
case (i.e. if a list of paths is explicitly provided by unit tests, we ignore the reloadWithoutUserExts
flag and use the list verbatim; the flag would only be respected when using the default set of paths.
I like that a little better since it's actually hard to guess what the correct response is when the array contains unexpected additional elements -- are those elements more similar to "default" (i.e. we should still load them even in safe mode) or are they more similar to "dev"/"user" (we shouldn't load them)? Impossible to say if we don't know anything about them...
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 agree that is good enough for now, and it's a simpler fix.
Done with final pass through the code. 1 more comment. |
Also, I just submitted pull request adobe/brackets-shell#407 to fix menu drawing performance on Windows. Not sure if you noticed this, but on Windows you can watch each menu being removed one at a time because the menu is redrawn for every menu item removed (which really slows down performance). This is not a common or time-critical operation, so it's not required for this pull request, but I'd like to get it in the same Sprint. Let me know if you want to review that one. |
@redmunds, sounds good. I will look at this pull request and your pull request this weekend. |
@redmunds and @peterflynn, code review changes committed. |
Looks good. Thanks for sticking with this complicated issue! Merging. |
Reload Without User Extensions
"Extension Manager" is disabled when reloaded for NO Extensions, but the menu item "Reload Without User Extensions" is still there and not disabled. Doesn't it makes more sense to disable that too ? |
@ishanatmuz Thanks for trying out this new feature. Installing and uninstalling extensions is not the only reason for wanting to Reload Brackets (with or without user extensions), so we need to keep this enabled for now. |
@redmunds What I was trying to imply is this: If there are no extensions left to disable after the first use of "Reload Without User Extensions", then what's the point of keeping it there ? |
@ishanatmuz "Reload Without User Extensions" does not change you to a different mode. It's a quick way to Reload Brackets to try to isolate whether a problem you are seeing is caused by an extension (or not). If you then "Reload Brackets" or shutdown and restart Brackets, user extensions are once again loaded. So, if you use "Reload Without User Extensions" and then do something that requires a reload (such as make an update to your system externally from Brackets), then you may want to "Reload Without User Extensions" again to refresh your system, but not load user extensions. Hope that makes sense. If you have any suggestions on how to improve this, then your feedback is welcome. |
Part of the problem might be that it's not obvious that "Reload Brackets" will turn extensions back on again. Should we consider making it so that menu item changes its name to "Reload With Extensions" when we're in safe mode? |
@redmunds As its mentioned here #5078 (comment) I was expecting shutdown/restart to be the only way to get the extensions enabled back. @njx I think that better solution is not just to change the menu, but change it's behavior to re-load without extensions. I am just pitching the previously stated idea here. I was expecting this to be a feature since I started using brackets. And the original idea seemed more practical to me as most of us use keyboard shortcuts instead of going to menus. |
"Reload Brackets" and shutdown/restart are only slightly different, so I am not sure that they were intended to be handled differently. I, personally, considered them to be synonymous in this context. One missing piece to this puzzle is that we plan to provide a UI in the Extension Manager for explicitly enabling and disabling individual extensions. These settings will persist across sessions. Do you agree that this will be even better than the behavior that you are describing? If so, is the current behavior ok as it is? If you think a SAFE MODE is important, then it seems like it should persist across shutdown/restart. |
@redmunds Obviously having the ability to disable extensions individually which persists, over more than one session is a good feature to have. The point here to note is that even if there is a single option to Disable All extensions. One problem can still arise there. As you yourself mentioned here #5078 (comment) that A user could leave brackets open for long enough to forget that they're in this mode. It gets expanded to multiple sessions when the Extension Manager persists the behavior across sessions and disables the extensions. What I suggest is to have the feature of enabling/disabling extensions with persistence across different sessions. And we should also have the "Reload Without User Extensions" feature. Just the modification in this feature is that when once in the No User Extension mode, the menu item Reload Without User Extensions should be disabled. The Reload Brackets (F5) menu item should be modified to behave as Reload Without User Extensions. And when the user shutdown/restart the behavior of Reload Brackets (F5) goes back to the norm of reloading with extensions. |
@ishanatmuz What you're proposing doesn't sound very different from what's already in this pull request:
You mentioned the risk that users might forget that they're in the mode where extensions are disabled -- but that actually seems to argue more for the behavior in the pull request, where it's easier to turn extensions back on. (I'm not terribly worried about users having this issue though). It seems simpler technically to leave this as is, and also less confusing to avoid having the menu items' meanings juggle around after disabling extensions. @njx's suggestion to relabel the menu items while extensions are disabled wold make it even more explicit -- I can't see any way users would get confused at that point. @ishanatmuz does that labeling change sound ok to you? |
@@ -436,6 +437,7 @@ define({ | |||
"DEBUG_MENU" : "Debug", | |||
"CMD_SHOW_DEV_TOOLS" : "Show Developer Tools", | |||
"CMD_REFRESH_WINDOW" : "Reload {APP_NAME}", | |||
"CMD_RELOAD_WITHOUT_USER_EXTS" : "Reload Without User Extensions", |
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.
@redmunds @lkcampbell
Independent of the thread above, I wonder if we should consider relabeling this. "User Extensions" seems easy to misinterpret as referring to the "extensions/user" folder, which is wrong since this command also affects the "src/extensions/dev" folder.
I think we should simply say "Extensions" in these strings -- as far as most users are concerned, the only "extensions" that exist are the ones that show up in Extension Manager. The average end user has no idea that, as an implementation detail, certain non-optional core functionality happens to be structured as extensions too. So I think we may be trying to parse hairs more than needed in the labels here.
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 support @peterflynn in this.
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 like this idea as well mainly because it is a shorter length and fits in the menu better, while retaining the important semantics.
@SAplayer, @WebsiteDeveloper I know you guys were discussing this as part of the really long German translation (pull request #6366). Since I can't read German, what was the final translation, in English, that you guys agreed on?
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.
@lkcampbell
Yes, we were talking about the same thing.
We first had this:
Reload without custom (meaning installed/User) extensions
Then I changed it to this:
Reload without extensions
But our reason to change this wasn't because it hadn't included the dev folder, it was just too long.
@peterflynn Of-course label change is a better scenario, and of-course it is technically simpler to leave it as it is. But what I am concerned more about is adopting to the way users behave. Users generally reload using the shortcut-key instead of going to the menus. |
@ishanatmuz, so, are you saying that you want a shortcut key assigned to the command? Because we could probably do that as well, assuming a good option is still available. |
My opinion: |
I thought that I was clear enough on what I think is better. Anyways....
I think this time it's clear enough to not have any confusions regarding what I am trying to say. As @lkcampbell suggested we can have another shortcut-key associated with Reload Without User Extensions say F6. And this is almost a good idea, but it adds the burden of remembering one more shortcut, and it will be a deviation from the normal work-flow of the user. I tend to agree more with the suggestion made by @SAplayer . This will not be a deviation from the normal work-flow. But I have just one tiny little comment to make on this. I have also mentioned it earlier. It just doesn't sticks with what @lkcampbell mentioned earlier #5078 (comment) shutdown/restart to be the only way to get out of the _mode_. Now I do realize that design decisions change with the development. And if everybody wants that there should be some option to get the extensions back on without shutdown/restart, then I think the suggestion made by @SAplayer is solid. But I can't help but notice that there isn't any discussion regarding this change in the original goal. |
@ishanatmuz, the change of the goal that I stated is in the next comment. That's the point that it went from "Restart" to "Reload". It was in response to some implementation questions that @redmunds was posing and I was investigating at the time. |
My final suggestion:
This would hopefully avoid confusion in case someone doesn't know how to exit this mode and doesn't want to search through all menu entries. |
@ishanatmuz To solve the "user could leave brackets open for long enough to forget that they're in this mode" issue, "User Extensions Disabled" is displayed in the status bar when extensions are not loaded. Thank you everyone for the input. The core team discussed this offline and decided that we should change the wording of the menu items and add a shortcut for the new command to:
This keeps these menu items and shortcuts always the same and always enabled. |
@redmunds, sounds good, I will submit the PR tonight. |
@lkcampbell Thanks! FYI, this feature is already coming in handy -- it helped me isolate this one: #6401 |
@lkcampbell I thought that #5078 (comment) was only meant to change the name, and not change the exit behavior. Sorry for misinterpreting that. @redmunds That is a good decision. I wonder why no-one came up with the idea of using Shift-F5 for disabling extensions earlier. It would have saved a lot of trouble. P.S. Seeing that issue #5078 is marked as Low Priority, I apologize for wasting so much time of the team over this matter. |
@redmunds, update committed. |
@ishanatmuz, it's always been high priority for me :). You never need to apologize for helping to make the Brackets better. |
This PR fixes issue #5078 by adding a new Debug Command: Reload Without User Extensions.