@@ -8465,6 +8465,12 @@ define("command/Commands", function (require, exports, module) {
84658465 /** Submenu for zoom options */
84668466 exports.VIEW_ZOOM_SUBMENU = "zoom-view-submenu";
84678467
8468+ /** Submenu for Open in project context menu */
8469+ exports.OPEN_IN_SUBMENU = "file-open-in-submenu";
8470+
8471+ /** Submenu for Open in working set context menu */
8472+ exports.OPEN_IN_SUBMENU_WS = "file-open-in-submenu-ws";
8473+
84688474 /** Increases editor font size */
84698475 exports.VIEW_INCREASE_FONT_SIZE = "view.increaseFontSize"; // ViewCommandHandlers.js _handleIncreaseFontSize()
84708476
@@ -8532,6 +8538,12 @@ define("command/Commands", function (require, exports, module) {
85328538 /** Shows current file in OS file explorer */
85338539 exports.NAVIGATE_SHOW_IN_OS = "navigate.showInOS"; // DocumentCommandHandlers.js handleShowInOS()
85348540
8541+ /** Shows current file in OS Terminal */
8542+ exports.NAVIGATE_OPEN_IN_TERMINAL = "navigate.openInTerminal";
8543+
8544+ /** Shows current file in open powershell in Windows os */
8545+ exports.NAVIGATE_OPEN_IN_POWERSHELL = "navigate.openInPowerShell";
8546+
85358547 /** Opens quick open dialog */
85368548 exports.NAVIGATE_QUICK_OPEN = "navigate.quickOpen"; // QuickOpen.js doFileSearch()
85378549
@@ -8734,7 +8746,7 @@ define("command/DefaultMenus", function (require, exports, module) {
87348746 return err;
87358747 }
87368748 _setContextMenuItemsVisible(isPresent, [Commands.FILE_RENAME,
8737- Commands.NAVIGATE_SHOW_IN_FILE_TREE, Commands.NAVIGATE_SHOW_IN_OS]);
8749+ Commands.NAVIGATE_SHOW_IN_FILE_TREE, Commands.NAVIGATE_SHOW_IN_OS, Commands.NAVIGATE_OPEN_IN_TERMINAL ]);
87388750 });
87398751 }
87408752 }
@@ -8973,7 +8985,12 @@ define("command/DefaultMenus", function (require, exports, module) {
89738985 workingset_cmenu.addMenuItem(Commands.FILE_SAVE);
89748986 workingset_cmenu.addMenuItem(Commands.NAVIGATE_SHOW_IN_FILE_TREE);
89758987 if(Phoenix.isNativeApp){
8976- workingset_cmenu.addMenuItem(Commands.NAVIGATE_SHOW_IN_OS);
8988+ let subMenu = workingset_cmenu.addSubMenu(Strings.CMD_OPEN_IN, Commands.OPEN_IN_SUBMENU_WS);
8989+ subMenu.addMenuItem(Commands.NAVIGATE_SHOW_IN_OS);
8990+ subMenu.addMenuItem(Commands.NAVIGATE_OPEN_IN_TERMINAL);
8991+ if (brackets.platform === "win") {
8992+ subMenu.addMenuItem(Commands.NAVIGATE_OPEN_IN_POWERSHELL);
8993+ }
89778994 }
89788995 workingset_cmenu.addMenuDivider();
89798996 workingset_cmenu.addMenuItem(Commands.FILE_COPY);
@@ -9007,7 +9024,12 @@ define("command/DefaultMenus", function (require, exports, module) {
90079024 project_cmenu.addMenuItem(Commands.FILE_NEW);
90089025 project_cmenu.addMenuItem(Commands.FILE_NEW_FOLDER);
90099026 if(Phoenix.isNativeApp){
9010- project_cmenu.addMenuItem(Commands.NAVIGATE_SHOW_IN_OS);
9027+ let subMenu = project_cmenu.addSubMenu(Strings.CMD_OPEN_IN, Commands.OPEN_IN_SUBMENU);
9028+ subMenu.addMenuItem(Commands.NAVIGATE_SHOW_IN_OS);
9029+ subMenu.addMenuItem(Commands.NAVIGATE_OPEN_IN_TERMINAL);
9030+ if (brackets.platform === "win") {
9031+ subMenu.addMenuItem(Commands.NAVIGATE_OPEN_IN_POWERSHELL);
9032+ }
90119033 }
90129034 project_cmenu.addMenuDivider();
90139035 project_cmenu.addMenuItem(Commands.FILE_CUT);
@@ -14362,6 +14384,7 @@ define("document/DocumentCommandHandlers", function (require, exports, module) {
1436214384 LanguageManager = require("language/LanguageManager"),
1436314385 NewFileContentManager = require("features/NewFileContentManager"),
1436414386 NodeConnector = require("NodeConnector"),
14387+ NodeUtils = require("utils/NodeUtils"),
1436514388 _ = require("thirdparty/lodash");
1436614389
1436714390 /**
@@ -16263,6 +16286,20 @@ define("document/DocumentCommandHandlers", function (require, exports, module) {
1626316286 }
1626416287 }
1626516288
16289+ function openDefaultTerminal() {
16290+ const entry = ProjectManager.getSelectedItem();
16291+ if (entry && entry.fullPath) {
16292+ NodeUtils.openNativeTerminal(entry.fullPath);
16293+ }
16294+ }
16295+
16296+ function openPowerShell() {
16297+ const entry = ProjectManager.getSelectedItem();
16298+ if (entry && entry.fullPath) {
16299+ NodeUtils.openNativeTerminal(entry.fullPath, true);
16300+ }
16301+ }
16302+
1626616303 function raceAgainstTime(promise, timeout = 2000) {
1626716304 const timeoutPromise = new Promise((_resolve, reject) => {
1626816305 setTimeout(() => {
@@ -16555,11 +16592,13 @@ define("document/DocumentCommandHandlers", function (require, exports, module) {
1655516592 exports._parseDecoratedPath = _parseDecoratedPath;
1655616593
1655716594 // Set some command strings
16558- var quitString = Strings.CMD_QUIT,
16559- showInOS = Strings.CMD_SHOW_IN_OS;
16595+ let quitString = Strings.CMD_QUIT,
16596+ showInOS = Strings.CMD_SHOW_IN_FILE_MANAGER,
16597+ defaultTerminal = Strings.CMD_OPEN_IN_TERMINAL;
1656016598 if (brackets.platform === "win") {
1656116599 quitString = Strings.CMD_EXIT;
1656216600 showInOS = Strings.CMD_SHOW_IN_EXPLORER;
16601+ defaultTerminal = Strings.CMD_OPEN_IN_CMD;
1656316602 } else if (brackets.platform === "mac") {
1656416603 showInOS = Strings.CMD_SHOW_IN_FINDER;
1656516604 }
@@ -16608,6 +16647,10 @@ define("document/DocumentCommandHandlers", function (require, exports, module) {
1660816647
1660916648 // Special Commands
1661016649 CommandManager.register(showInOS, Commands.NAVIGATE_SHOW_IN_OS, handleShowInOS);
16650+ CommandManager.register(defaultTerminal, Commands.NAVIGATE_OPEN_IN_TERMINAL, openDefaultTerminal);
16651+ if (brackets.platform === "win") {
16652+ CommandManager.register(Strings.CMD_OPEN_IN_POWER_SHELL, Commands.NAVIGATE_OPEN_IN_POWERSHELL, openPowerShell);
16653+ }
1661116654 CommandManager.register(Strings.CMD_NEW_BRACKETS_WINDOW, Commands.FILE_NEW_WINDOW, handleFileNewWindow);
1661216655 CommandManager.register(quitString, Commands.FILE_QUIT, handleFileCloseWindow);
1661316656 CommandManager.register(Strings.CMD_SHOW_IN_TREE, Commands.NAVIGATE_SHOW_IN_FILE_TREE, handleShowInTree);
@@ -92343,6 +92386,7 @@ define("nls/root/strings", {
9234392386 "CMD_FILE_REFRESH": "Refresh File Tree",
9234492387 "CMD_FILE_SHOW_FOLDERS_FIRST": "Sort Folders First",
9234592388 "CMD_QUIT": "Quit",
92389+ "CMD_OPEN_IN": "Open In",
9234692390 // Used in native File menu on Windows
9234792391 "CMD_EXIT": "Exit",
9234892392
@@ -92442,9 +92486,12 @@ define("nls/root/strings", {
9244292486 "CMD_NEXT_DOC_LIST_ORDER": "Next Document in List",
9244392487 "CMD_PREV_DOC_LIST_ORDER": "Previous Document in List",
9244492488 "CMD_SHOW_IN_TREE": "Show in File Tree",
92445- "CMD_SHOW_IN_EXPLORER": "Show in Explorer",
92446- "CMD_SHOW_IN_FINDER": "Show in Finder",
92447- "CMD_SHOW_IN_OS": "Show in OS Files",
92489+ "CMD_SHOW_IN_EXPLORER": "Windows File Explorer",
92490+ "CMD_SHOW_IN_FINDER": "macOS Finder",
92491+ "CMD_SHOW_IN_FILE_MANAGER": "File Manager",
92492+ "CMD_OPEN_IN_TERMINAL": "Terminal",
92493+ "CMD_OPEN_IN_CMD": "Command Prompt",
92494+ "CMD_OPEN_IN_POWER_SHELL": "Power Shell",
9244892495 "CMD_SWITCH_PANE_FOCUS": "Switch Pane Focus",
9244992496
9245092497 // Debug menu commands
@@ -148968,6 +149015,23 @@ define("utils/NodeUtils", function (require, exports, module) {
148968149015 });
148969149016 }
148970149017
149018+ /**
149019+ * Runs ESLint on a file
149020+ * This is only available in the native app
149021+ *
149022+ * @param {string} cwd the working directory of terminal
149023+ * @param {boolean} [usePowerShell]
149024+ */
149025+ async function openNativeTerminal(cwd, usePowerShell = false) {
149026+ if(!Phoenix.isNativeApp) {
149027+ throw new Error("openNativeTerminal not available in browser");
149028+ }
149029+ return utilsConnector.execPeer("openNativeTerminal", {
149030+ cwd: window.fs.getTauriPlatformPath(cwd),
149031+ usePowerShell
149032+ });
149033+ }
149034+
148971149035 if(NodeConnector.isNodeAvailable()) {
148972149036 // todo we need to update the strings if a user extension adds its translations. Since we dont support
148973149037 // node extensions for now, should consider when we support node extensions.
@@ -149004,6 +149068,7 @@ define("utils/NodeUtils", function (require, exports, module) {
149004149068 exports.openUrlInBrowser = openUrlInBrowser;
149005149069 exports.ESLintFile = ESLintFile;
149006149070 exports.getEnvironmentVariable = getEnvironmentVariable;
149071+ exports.openNativeTerminal = openNativeTerminal;
149007149072
149008149073 /**
149009149074 * checks if Node connector is ready
0 commit comments