From abafe68dd355792acb8258a868e2c0c9d06027bd Mon Sep 17 00:00:00 2001 From: filip mertens Date: Mon, 11 Dec 2023 23:05:30 +0100 Subject: [PATCH] opn in FE --- apps/remix-ide/src/remixAppManager.js | 13 +++++++++++++ apps/remixdesktop/package.json | 1 + apps/remixdesktop/src/plugins/fsPlugin.ts | 9 +++++++-- apps/remixdesktop/yarn.lock | 14 ++++++++++++++ list.json | 0 5 files changed, 35 insertions(+), 2 deletions(-) delete mode 100644 list.json diff --git a/apps/remix-ide/src/remixAppManager.js b/apps/remix-ide/src/remixAppManager.js index 411570ebc7..19aedf8570 100644 --- a/apps/remix-ide/src/remixAppManager.js +++ b/apps/remix-ide/src/remixAppManager.js @@ -327,6 +327,19 @@ export class RemixAppManager extends PluginManager { sticky: true, group: 7 }) + if (Registry.getInstance().get('platform').api.isDesktop()) { + await this.call('filePanel', 'registerContextMenuItem', { + id: 'fs', + name: 'revealInExplorer', + label: 'Reveal in file explorer', + type: ['folder', 'file'], + extension: [], + path: [], + pattern: [], + sticky: true, + group: 8 + }) + } } } diff --git a/apps/remixdesktop/package.json b/apps/remixdesktop/package.json index 679ad1f1d4..0957529dc2 100644 --- a/apps/remixdesktop/package.json +++ b/apps/remixdesktop/package.json @@ -41,6 +41,7 @@ "@remixproject/engine": "0.3.41", "@remixproject/engine-electron": "0.3.41", "@remixproject/plugin": "0.3.41", + "@remixproject/plugin-api": "^0.3.38", "@remixproject/plugin-electron": "0.3.41", "@vscode/ripgrep": "^1.15.6", "add": "^2.0.6", diff --git a/apps/remixdesktop/src/plugins/fsPlugin.ts b/apps/remixdesktop/src/plugins/fsPlugin.ts index 11695633d7..92cf4c47ac 100644 --- a/apps/remixdesktop/src/plugins/fsPlugin.ts +++ b/apps/remixdesktop/src/plugins/fsPlugin.ts @@ -2,7 +2,7 @@ import { ElectronBasePlugin, ElectronBasePluginClient } from "@remixproject/plug import fs from 'fs/promises' import { Profile } from "@remixproject/plugin-utils"; import chokidar from 'chokidar' -import { dialog } from "electron"; +import { dialog, shell } from "electron"; import { createWindow, isPackaged } from "../main"; import { writeConfig } from "../utils/config"; import { Path } from 'path-scurry' @@ -11,6 +11,7 @@ import byline from 'byline'; import path from "path"; import { spawn } from "child_process"; +import { customAction } from "@remixproject/plugin-api"; const profile: Profile = { displayName: 'fs', @@ -85,7 +86,7 @@ const clientProfile: Profile = { name: 'fs', displayName: 'fs', description: 'fs', - methods: ['readdir', 'readFile', 'writeFile', 'mkdir', 'rmdir', 'unlink', 'rename', 'stat', 'lstat', 'exists', 'currentPath', 'watch', 'closeWatch', 'setWorkingDir', 'openFolder', 'openFolderInSameWindow', 'getRecentFolders', 'removeRecentFolder', 'openWindow', 'selectFolder'] + methods: ['readdir', 'readFile', 'writeFile', 'mkdir', 'rmdir', 'unlink', 'rename', 'stat', 'lstat', 'exists', 'currentPath', 'watch', 'closeWatch', 'setWorkingDir', 'openFolder', 'openFolderInSameWindow', 'getRecentFolders', 'removeRecentFolder', 'openWindow', 'selectFolder', 'revealInExplorer', 'openInVSCode'] } class FSPluginClient extends ElectronBasePluginClient { @@ -328,6 +329,10 @@ class FSPluginClient extends ElectronBasePluginClient { await this.call('fileManager', 'closeAllFiles') } + async revealInExplorer(action: customAction): Promise { + shell.showItemInFolder(this.fixPath(action.path[0])) + } + fixPath(path: string): string { if (this.workingDir === '') throw new Error('workingDir is not set') if (path) { diff --git a/apps/remixdesktop/yarn.lock b/apps/remixdesktop/yarn.lock index 746e4441dc..045e3ae5bc 100644 --- a/apps/remixdesktop/yarn.lock +++ b/apps/remixdesktop/yarn.lock @@ -690,6 +690,13 @@ dependencies: "@remixproject/plugin-utils" "0.3.41" +"@remixproject/plugin-api@^0.3.38": + version "0.3.38" + resolved "https://registry.yarnpkg.com/@remixproject/plugin-api/-/plugin-api-0.3.38.tgz#7dcff37483451b654fc51290157992fff3fbd8b7" + integrity sha512-GLXAnV7TMYV2KlXTml+W0H6s0m5EkVb5w610Jh9k4PLFVrocl9xDEG4VlZ8BF/uv+yjXRi4dn++8zWMRe5375Q== + dependencies: + "@remixproject/plugin-utils" "0.3.38" + "@remixproject/plugin-electron@0.3.41": version "0.3.41" resolved "https://registry.yarnpkg.com/@remixproject/plugin-electron/-/plugin-electron-0.3.41.tgz#6f736dfa5146bdf41fe0c452ab0b78e7f914fda1" @@ -700,6 +707,13 @@ "@remixproject/plugin-api" "0.3.41" "@remixproject/plugin-utils" "0.3.41" +"@remixproject/plugin-utils@0.3.38": + version "0.3.38" + resolved "https://registry.yarnpkg.com/@remixproject/plugin-utils/-/plugin-utils-0.3.38.tgz#402adbef700a9392fbeae7d536ba020b7cfbdfaa" + integrity sha512-DpbB+BFfWvZ/pKWlXY0Ms3mqp/ajWxBI+TUiJor2AkLtCSBS1+Uk7BWG++jNSqgjdvVKxxWa4kJygFwUPtUYXA== + dependencies: + tslib "2.0.1" + "@remixproject/plugin-utils@0.3.41": version "0.3.41" resolved "https://registry.yarnpkg.com/@remixproject/plugin-utils/-/plugin-utils-0.3.41.tgz#6de4d016084cf54fbf710ed717c9c1efc0a990de" diff --git a/list.json b/list.json deleted file mode 100644 index e69de29bb2..0000000000