From c7ee12435e55efdea1690490abd2238f4668c24c Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Fri, 9 Feb 2024 15:40:20 +0100 Subject: [PATCH] add context menu option to compile vyper contracts --- apps/remix-ide/src/remixAppManager.js | 13 ++++++++++++- apps/vyper/src/app/utils/remix-client.tsx | 6 +++++- apps/vyper/src/profile.json | 2 +- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/apps/remix-ide/src/remixAppManager.js b/apps/remix-ide/src/remixAppManager.js index 19716a2f84..83ae4d4a5a 100644 --- a/apps/remix-ide/src/remixAppManager.js +++ b/apps/remix-ide/src/remixAppManager.js @@ -153,7 +153,7 @@ export class RemixAppManager extends PluginManager { if (Registry.getInstance().get('platform').api.isDesktop()) { requiredModules = [...requiredModules, 'fs', 'electronTemplates', 'isogit', 'remix-templates', 'electronconfig', 'xterm', 'compilerloader', 'ripgrep'] } - + } async canActivatePlugin(from, to) { @@ -331,6 +331,17 @@ export class RemixAppManager extends PluginManager { sticky: true, group: 7 }) + await this.call('filePanel', 'registerContextMenuItem', { + id: 'vyper', + name: 'vyperCompileCustomAction', + label: 'Compile vyper', + type: [], + extension: ['.vy'], + path: [], + pattern: [], + sticky: true, + group: 7 + }) if (Registry.getInstance().get('platform').api.isDesktop()) { await this.call('filePanel', 'registerContextMenuItem', { id: 'fs', diff --git a/apps/vyper/src/app/utils/remix-client.tsx b/apps/vyper/src/app/utils/remix-client.tsx index a4fda680cf..96c7dd209f 100644 --- a/apps/vyper/src/app/utils/remix-client.tsx +++ b/apps/vyper/src/app/utils/remix-client.tsx @@ -1,4 +1,4 @@ -import {HighlightPosition, CompilationResult, RemixApi} from '@remixproject/plugin-api' +import {HighlightPosition, CompilationResult, RemixApi, customAction} from '@remixproject/plugin-api' import {Api, Status} from '@remixproject/plugin-utils' import {createClient} from '@remixproject/plugin-webview' import {PluginClient} from '@remixproject/plugin' @@ -26,6 +26,10 @@ export class RemixClient extends PluginClient { }) } + async vyperCompileCustomAction(action: customAction) { + console.log('vyperCompileCustomAction', action) + } + /** Load Ballot contract example into the file manager */ async loadContract({name, address}: ExampleContract) { try { diff --git a/apps/vyper/src/profile.json b/apps/vyper/src/profile.json index 4567720716..c641db5ad8 100644 --- a/apps/vyper/src/profile.json +++ b/apps/vyper/src/profile.json @@ -1,7 +1,7 @@ { "name": "vyper", "displayName": "Vyper Plugin", - "methods": ["getCompilationResult", "compile"], + "methods": ["getCompilationResult", "compile", "vyperCompileCustomAction"], "url": "https://ipfs-cluster.ethdevops.io/ipfs/QmbmPzUg7ghTKcF2eo64zm1k1LKdibYfqYmiqXkHKXks8r", "documentation": "https://remix-ide.readthedocs.io/en/latest/plugin_list.html", "description": "Compile vyper contracts",