Skip to content

Commit

Permalink
feat: sub menu refactor phoenix diagnostic tools to not confuse user
Browse files Browse the repository at this point in the history
  • Loading branch information
abose committed Dec 14, 2023
1 parent 5bf30b1 commit 73d7d7f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 18 deletions.
36 changes: 20 additions & 16 deletions src/extensions/default/DebugCommands/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ define(function (require, exports, module) {

const KeyboardPrefs = JSON.parse(require("text!keyboard.json"));

const DIAGNOSTICS_SUBMENU = "debug-diagnostics-sub-menu";

// default preferences file name
const DEFAULT_PREFERENCES_FILENAME = "defaultPreferences.json",
SUPPORTED_PREFERENCE_TYPES = ["number", "boolean", "string", "array", "object"];
Expand Down Expand Up @@ -786,34 +788,36 @@ define(function (require, exports, module) {

CommandManager.register(Strings.CMD_OPEN_PREFERENCES, DEBUG_OPEN_PREFERENCES_IN_SPLIT_VIEW, handleOpenPrefsInSplitView);
const debugMenu = Menus.getMenu(Menus.AppMenuBar.DEBUG_MENU);
// Show Developer Tools (optionally enabled)
if(brackets.app.toggleDevtools){
CommandManager.register(Strings.CMD_SHOW_DEV_TOOLS, DEBUG_SHOW_DEVELOPER_TOOLS, _handleShowDeveloperTools);
debugMenu.addMenuItem(DEBUG_SHOW_DEVELOPER_TOOLS, KeyboardPrefs.showDeveloperTools);
}
debugMenu.addMenuItem(DEBUG_REFRESH_WINDOW, KeyboardPrefs.refreshWindow);
debugMenu.addMenuItem(DEBUG_RELOAD_WITHOUT_USER_EXTS, KeyboardPrefs.reloadWithoutUserExts);
debugMenu.addMenuItem(DEBUG_LOAD_CURRENT_EXTENSION);
debugMenu.addMenuItem(DEBUG_UNLOAD_CURRENT_EXTENSION, undefined, undefined, undefined, {
hideWhenCommandDisabled: true
});
debugMenu.addMenuItem(DEBUG_RUN_UNIT_TESTS);
debugMenu.addMenuItem(DEBUG_SHOW_PERF_DATA);
debugMenu.addMenuDivider();
debugMenu.addMenuItem(DEBUG_ENABLE_LOGGING);
debugMenu.addMenuItem(DEBUG_ENABLE_PHNODE_INSPECTOR, undefined, undefined, undefined, {
debugMenu.addMenuItem(DEBUG_OPEN_EXTENSION_FOLDER, undefined, undefined, undefined, {
hideWhenCommandDisabled: true
});
debugMenu.addMenuItem(DEBUG_GET_PHNODE_INSPECTOR_URL, undefined, undefined, undefined, {
debugMenu.addMenuDivider();
// Show Developer Tools (optionally enabled)
if(brackets.app.toggleDevtools){
CommandManager.register(Strings.CMD_SHOW_DEV_TOOLS, DEBUG_SHOW_DEVELOPER_TOOLS, _handleShowDeveloperTools);
debugMenu.addMenuItem(DEBUG_SHOW_DEVELOPER_TOOLS, KeyboardPrefs.showDeveloperTools);
}
const diagnosticsSubmenu = debugMenu.addSubMenu(Strings.CMD_DIAGNOSTIC_TOOLS, DIAGNOSTICS_SUBMENU);
diagnosticsSubmenu.addMenuItem(DEBUG_RUN_UNIT_TESTS);
diagnosticsSubmenu.addMenuDivider();
diagnosticsSubmenu.addMenuItem(DEBUG_ENABLE_LOGGING);
diagnosticsSubmenu.addMenuItem(DEBUG_ENABLE_PHNODE_INSPECTOR, undefined, undefined, undefined, {
hideWhenCommandDisabled: true
});
debugMenu.addMenuItem(DEBUG_LIVE_PREVIEW_LOGGING);
debugMenu.addMenuDivider();
debugMenu.addMenuItem(DEBUG_OPEN_VFS);
debugMenu.addMenuItem(DEBUG_OPEN_EXTENSION_FOLDER, undefined, undefined, undefined, {
diagnosticsSubmenu.addMenuItem(DEBUG_GET_PHNODE_INSPECTOR_URL, undefined, undefined, undefined, {
hideWhenCommandDisabled: true
});
debugMenu.addMenuItem(DEBUG_OPEN_VIRTUAL_SERVER, undefined, undefined, undefined, {
diagnosticsSubmenu.addMenuItem(DEBUG_LIVE_PREVIEW_LOGGING);
diagnosticsSubmenu.addMenuDivider();
diagnosticsSubmenu.addMenuItem(DEBUG_SHOW_PERF_DATA);
diagnosticsSubmenu.addMenuItem(DEBUG_OPEN_VFS);
diagnosticsSubmenu.addMenuItem(DEBUG_OPEN_VIRTUAL_SERVER, undefined, undefined, undefined, {
hideWhenCommandDisabled: true
});

Expand Down
5 changes: 3 additions & 2 deletions src/nls/root/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,7 @@ define({

// Debug menu commands
"CMD_OPEN_VFS": "Open Virtual File System",
"CMD_DIAGNOSTIC_TOOLS": "{APP_NAME} Diagnostic Tools",
"CMD_OPEN_EXTENSIONS_FOLDER": "Open Extensions Folder\u2026",
"CMD_OPEN_VIRTUAL_SERVER": "Open Virtual Server",

Expand Down Expand Up @@ -685,7 +686,7 @@ define({
// extensions/default/DebugCommands
"DEBUG_MENU": "Debug",
"ERRORS": "Errors",
"CMD_SHOW_DEV_TOOLS": "Show Developer Tools",
"CMD_SHOW_DEV_TOOLS": "{APP_NAME} Developer Tools",
"CMD_REFRESH_WINDOW": "Reload With Extensions",
"CMD_LOAD_CURRENT_EXTENSION": "Load Project As Extension",
"CMD_RELOAD_CURRENT_EXTENSION": "Reload Project As Extension",
Expand All @@ -694,7 +695,7 @@ define({
"CMD_NEW_BRACKETS_WINDOW": "New Window",
"CMD_LAUNCH_SCRIPT_MAC": "Install Command Line Shortcut",
"CMD_SWITCH_LANGUAGE": "Switch Language\u2026",
"CMD_RUN_UNIT_TESTS": "Run Tests",
"CMD_RUN_UNIT_TESTS": "Run {APP_NAME} Tests",
"CMD_SHOW_PERF_DATA": "Show Performance Data",
"CMD_ENABLE_LOGGING": "Enable Detailed Logs",
"CMD_ENABLE_PHNODE_INSPECTOR": "Enable PhNode Inspector",
Expand Down

0 comments on commit 73d7d7f

Please sign in to comment.