From 34e30292ed848c4892688630ca513872b270469c Mon Sep 17 00:00:00 2001 From: Aniket-Engg Date: Thu, 26 May 2022 13:39:00 +0530 Subject: [PATCH 01/18] update remix usage --- libs/remixd/src/bin/remixd.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/libs/remixd/src/bin/remixd.ts b/libs/remixd/src/bin/remixd.ts index c345bc89fc..d0f52556e3 100644 --- a/libs/remixd/src/bin/remixd.ts +++ b/libs/remixd/src/bin/remixd.ts @@ -60,13 +60,12 @@ function errorHandler (error: any, service: string) { program.version(version, '-v, --version') program - .usage('-s ') - .description('Provide a two-way connection between the local computer and Remix IDE') - .option('-u, --remix-ide ', 'URL of remix instance allowed to connect to this web sockect connection') - .option('-s, --shared-folder ', 'Folder to share with Remix IDE') + .description('Establish a two-way websocket connection between the local computer and Remix IDE for a folder') + .option('-u, --remix-ide ', 'URL of remix instance allowed to connect') + .option('-s, --shared-folder ', 'Folder to share with Remix IDE (Default: CWD)') .option('-r, --read-only', 'Treat shared folder as read-only (experimental)') .on('--help', function () { - console.log('\nExample:\n\n remixd -s ./ -u http://localhost:8080') + console.log('\nExample:\n\n remixd -s ./shared_project -u http://localhost:8080') }).parse(process.argv) // eslint-disable-next-line From a90a37bf39f4b26b8105eeb8cd72f404e0a5374d Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 30 May 2022 15:39:36 +0200 Subject: [PATCH 02/18] save published file to FE --- .../publish-to-storage/src/lib/publish-to-storage.tsx | 4 ---- .../publish-to-storage/src/lib/publishOnSwarm.tsx | 9 +++++---- .../publish-to-storage/src/lib/publishToIPFS.tsx | 9 +++++---- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/libs/remix-ui/publish-to-storage/src/lib/publish-to-storage.tsx b/libs/remix-ui/publish-to-storage/src/lib/publish-to-storage.tsx index 78812ab83d..79d81b8537 100644 --- a/libs/remix-ui/publish-to-storage/src/lib/publish-to-storage.tsx +++ b/libs/remix-ui/publish-to-storage/src/lib/publish-to-storage.tsx @@ -29,8 +29,6 @@ export const PublishToStorage = (props: RemixUiPublishToStorageProps) => { const result = await publishToSwarm(contract, api) modal(`Published ${contract.name}'s Metadata`, publishMessage(result.uploaded)) - // triggered each time there's a new verified publish (means hash correspond) - api.writeFile('swarm/' + result.item.hash, result.item.content) } catch (err) { let parseError = err try { @@ -44,8 +42,6 @@ export const PublishToStorage = (props: RemixUiPublishToStorageProps) => { const result = await publishToIPFS(contract, api) modal(`Published ${contract.name}'s Metadata`, publishMessage(result.uploaded)) - // triggered each time there's a new verified publish (means hash correspond) - api.writeFile('ipfs/' + result.item.hash, result.item.content) } catch (err) { modal('IPFS Publish Failed', publishMessageFailed(storage, err)) } diff --git a/libs/remix-ui/publish-to-storage/src/lib/publishOnSwarm.tsx b/libs/remix-ui/publish-to-storage/src/lib/publishOnSwarm.tsx index 3f823c5070..af7e189940 100644 --- a/libs/remix-ui/publish-to-storage/src/lib/publishOnSwarm.tsx +++ b/libs/remix-ui/publish-to-storage/src/lib/publishOnSwarm.tsx @@ -79,7 +79,7 @@ export const publishToSwarm = async (contract, api) => { // publish the list of sources in order, fail if any failed await Promise.all(sources.map(async (item) => { try { - const result = await swarmVerifiedPublish(beeNodes, postageStampId, item.content, item.hash) + const result = await swarmVerifiedPublish(beeNodes, postageStampId, item.content, item.hash, api) try { item.hash = result.url.match('bzz-raw://(.+)')[1] @@ -96,9 +96,9 @@ export const publishToSwarm = async (contract, api) => { } })) - const metadataContent = JSON.stringify(metadata) + const metadataContent = JSON.stringify(metadata, null, '\t') try { - const result = await swarmVerifiedPublish(beeNodes, postageStampId, metadataContent, '') + const result = await swarmVerifiedPublish(beeNodes, postageStampId, metadataContent, '', api) try { contract.metadataHash = result.url.match('bzz-raw://(.+)')[1] @@ -121,7 +121,7 @@ export const publishToSwarm = async (contract, api) => { return { uploaded, item } } -const swarmVerifiedPublish = async (beeNodes: Bee[], postageStampId: string, content, expectedHash): Promise> => { +const swarmVerifiedPublish = async (beeNodes: Bee[], postageStampId: string, content, expectedHash, api): Promise> => { try { const results = await uploadToBeeNodes(beeNodes, postageStampId, content) const hash = hashFromResults(results) @@ -129,6 +129,7 @@ const swarmVerifiedPublish = async (beeNodes: Bee[], postageStampId: string, con if (expectedHash && hash !== expectedHash) { return { message: 'hash mismatch between solidity bytecode and uploaded content.', url: 'bzz-raw://' + hash, hash } } else { + api.writeFile('swarm/' + hash, content) return { message: 'ok', url: 'bzz-raw://' + hash, hash } } } catch (error) { diff --git a/libs/remix-ui/publish-to-storage/src/lib/publishToIPFS.tsx b/libs/remix-ui/publish-to-storage/src/lib/publishToIPFS.tsx index 36f92ab9e8..e5721d5868 100644 --- a/libs/remix-ui/publish-to-storage/src/lib/publishToIPFS.tsx +++ b/libs/remix-ui/publish-to-storage/src/lib/publishToIPFS.tsx @@ -63,7 +63,7 @@ export const publishToIPFS = async (contract, api) => { // publish the list of sources in order, fail if any failed await Promise.all(sources.map(async (item) => { try { - const result = await ipfsVerifiedPublish(item.content, item.hash) + const result = await ipfsVerifiedPublish(item.content, item.hash, api) try { item.hash = result.url.match('dweb:/ipfs/(.+)')[1] @@ -76,10 +76,10 @@ export const publishToIPFS = async (contract, api) => { throw new Error(error) } })) - const metadataContent = JSON.stringify(metadata) + const metadataContent = JSON.stringify(metadata, null, '\t') try { - const result = await ipfsVerifiedPublish(metadataContent, '') + const result = await ipfsVerifiedPublish(metadataContent, '', api) try { contract.metadataHash = result.url.match('dweb:/ipfs/(.+)')[1] @@ -101,13 +101,14 @@ export const publishToIPFS = async (contract, api) => { return { uploaded, item } } -const ipfsVerifiedPublish = async (content, expectedHash) => { +const ipfsVerifiedPublish = async (content, expectedHash, api) => { try { const results = await severalGatewaysPush(content) if (expectedHash && results !== expectedHash) { return { message: 'hash mismatch between solidity bytecode and uploaded content.', url: 'dweb:/ipfs/' + results, hash: results } } else { + api.writeFile('ipfs/' + results, content) return { message: 'ok', url: 'dweb:/ipfs/' + results, hash: results } } } catch (error) { From 0e359a586a100f581cdd6116c8c8e151bdac7f85 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 30 May 2022 15:57:11 +0200 Subject: [PATCH 03/18] add e2e --- apps/remix-ide-e2e/src/tests/publishContract.test.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/remix-ide-e2e/src/tests/publishContract.test.ts b/apps/remix-ide-e2e/src/tests/publishContract.test.ts index e1a19ccabb..0cf32d9b56 100644 --- a/apps/remix-ide-e2e/src/tests/publishContract.test.ts +++ b/apps/remix-ide-e2e/src/tests/publishContract.test.ts @@ -30,6 +30,8 @@ module.exports = { }) }) .click('[data-id="publishToStorage-modal-footer-ok-react"]') + .openFile('ipfs/Qmd4XV9j79GPfv5cgVsg62vKzaLuf6igx7VSW2BKaUyF3w') + .openFile('ipfs/QmVyGTHJAPhVephhnBSEHpTga3Svxx7ifynGuxRjWuRCfM') }, /* Disableing the test untill refactoring and the new swarm usage From 508812d35bb3472a1cd8997cae9ecdc87e51d999 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 30 May 2022 16:08:00 +0200 Subject: [PATCH 04/18] update label --- apps/remix-ide-e2e/src/tests/publishContract.test.ts | 6 +++--- .../publish-to-storage/src/lib/publish-to-storage.tsx | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/publishContract.test.ts b/apps/remix-ide-e2e/src/tests/publishContract.test.ts index 0cf32d9b56..0aad522b38 100644 --- a/apps/remix-ide-e2e/src/tests/publishContract.test.ts +++ b/apps/remix-ide-e2e/src/tests/publishContract.test.ts @@ -25,7 +25,7 @@ module.exports = { const value = (result.value) browser.perform((done) => { - if (value.indexOf('Metadata of "ballot" was published successfully.') === -1) browser.assert.fail('ipfs deploy failed') + if (value.indexOf('Metadata and sources of "ballot" were published successfully.') === -1) browser.assert.fail('ipfs deploy failed') done() }) }) @@ -43,7 +43,7 @@ module.exports = { const value = (result.value) browser.perform((done) => { - if (value.indexOf('Metadata of "ballot" was published successfully.') === -1) browser.assert.fail('swarm deploy failed') + if (value.indexOf('Metadata and sources of "ballot" were published successfully.') === -1) browser.assert.fail('swarm deploy failed') if (value.indexOf('bzz') === -1) browser.assert.fail('swarm deploy failed') done() }) @@ -67,7 +67,7 @@ module.exports = { .getText('[data-id="udappModalDialogModalBody-react"]', (result) => { const value = typeof result.value === 'string' ? result.value : null - if (value.indexOf('Metadata of "storage" was published successfully.') === -1) browser.assert.fail('ipfs deploy failed') + if (value.indexOf('Metadata and sources of "storage" were published successfully.') === -1) browser.assert.fail('ipfs deploy failed') }) .modalFooterOKClick('udapp') }, diff --git a/libs/remix-ui/publish-to-storage/src/lib/publish-to-storage.tsx b/libs/remix-ui/publish-to-storage/src/lib/publish-to-storage.tsx index 79d81b8537..fc922dbeeb 100644 --- a/libs/remix-ui/publish-to-storage/src/lib/publish-to-storage.tsx +++ b/libs/remix-ui/publish-to-storage/src/lib/publish-to-storage.tsx @@ -28,7 +28,7 @@ export const PublishToStorage = (props: RemixUiPublishToStorageProps) => { try { const result = await publishToSwarm(contract, api) - modal(`Published ${contract.name}'s Metadata`, publishMessage(result.uploaded)) + modal(`Published ${contract.name}'s Metadata and Sources`, publishMessage(result.uploaded)) } catch (err) { let parseError = err try { @@ -41,7 +41,7 @@ export const PublishToStorage = (props: RemixUiPublishToStorageProps) => { try { const result = await publishToIPFS(contract, api) - modal(`Published ${contract.name}'s Metadata`, publishMessage(result.uploaded)) + modal(`Published ${contract.name}'s Metadata and Sources`, publishMessage(result.uploaded)) } catch (err) { modal('IPFS Publish Failed', publishMessageFailed(storage, err)) } @@ -55,7 +55,7 @@ export const PublishToStorage = (props: RemixUiPublishToStorageProps) => { }, [storage]) const publishMessage = (uploaded) => ( - Metadata of "{contract.name.toLowerCase()}" was published successfully.
+ Metadata and sources of "{contract.name.toLowerCase()}" were published successfully.
         
{ uploaded.map((value, index) =>
{ value.filename } :
{ value.output.url }
) } @@ -65,7 +65,7 @@ export const PublishToStorage = (props: RemixUiPublishToStorageProps) => { ) const publishMessageFailed = (storage, err) => ( - Failed to publish metadata file to { storage }, please check the { storage } gateways is available.
+ Failed to publish metadata file and sources to { storage }, please check the { storage } gateways is available.
{err}
) From 34700e6a4b287299bdcb60bcff8bb4ccdd96ebf1 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 31 May 2022 10:04:58 +0200 Subject: [PATCH 05/18] fix E2E --- apps/remix-ide-e2e/src/tests/publishContract.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/publishContract.test.ts b/apps/remix-ide-e2e/src/tests/publishContract.test.ts index 0aad522b38..d571c7b5df 100644 --- a/apps/remix-ide-e2e/src/tests/publishContract.test.ts +++ b/apps/remix-ide-e2e/src/tests/publishContract.test.ts @@ -30,8 +30,8 @@ module.exports = { }) }) .click('[data-id="publishToStorage-modal-footer-ok-react"]') - .openFile('ipfs/Qmd4XV9j79GPfv5cgVsg62vKzaLuf6igx7VSW2BKaUyF3w') - .openFile('ipfs/QmVyGTHJAPhVephhnBSEHpTga3Svxx7ifynGuxRjWuRCfM') + .openFile('ipfs/QmSUodhSvoorFL5m5CNqve8YvmuBpjCq17NbTf4GUX8ydw') + .openFile('ipfs/QmXYUS1ueS22EqNVRaKuZa31EgHLjKZ8uTM8vWhQLxa3pw') }, /* Disableing the test untill refactoring and the new swarm usage From 44cee02325c86954397674fbb6b976b4c210c45f Mon Sep 17 00:00:00 2001 From: David Disu Date: Mon, 30 May 2022 14:38:46 +0100 Subject: [PATCH 06/18] Show toaster with same content. --- libs/remix-ui/toaster/src/lib/toaster.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-ui/toaster/src/lib/toaster.tsx b/libs/remix-ui/toaster/src/lib/toaster.tsx index 571a0c4afa..22014d8f7f 100644 --- a/libs/remix-ui/toaster/src/lib/toaster.tsx +++ b/libs/remix-ui/toaster/src/lib/toaster.tsx @@ -49,7 +49,7 @@ export const Toaster = (props: ToasterProps) => { } }) } - }, [props.message]) + }, [props.message, state.message]) useEffect(() => { if (state.hiding) { From fb4af91f3180498495853c9b2eae9f7232f74d6a Mon Sep 17 00:00:00 2001 From: David Disu Date: Mon, 30 May 2022 14:59:04 +0100 Subject: [PATCH 07/18] Use JSX for toaster message --- apps/remix-ide/src/app/files/fileManager.ts | 4 ++-- libs/remix-ui/helper/src/lib/helper-components.tsx | 6 ++++++ libs/remix-ui/toaster/src/lib/toaster.tsx | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/apps/remix-ide/src/app/files/fileManager.ts b/apps/remix-ide/src/app/files/fileManager.ts index aa02851c3e..e7ae4763df 100644 --- a/apps/remix-ide/src/app/files/fileManager.ts +++ b/apps/remix-ide/src/app/files/fileManager.ts @@ -4,7 +4,7 @@ import * as packageJson from '../../../../../package.json' import Registry from '../state/registry' import { EventEmitter } from 'events' import { RemixAppManager } from '../../../../../libs/remix-ui/plugin-manager/src/types' -import { fileChangedToastMsg, storageFullMessage } from '@remix-ui/helper' +import { fileChangedToastMsg, recursivePasteToastMsg, storageFullMessage } from '@remix-ui/helper' import helper from '../../lib/helper.js' /* @@ -275,7 +275,7 @@ class FileManager extends Plugin { const provider = this.fileProviderOf(src) if (provider.isSubDirectory(src, dest)) { - this.call('notification', 'toast', 'File(s) to paste is an ancestor of the destination folder') + this.call('notification', 'toast', recursivePasteToastMsg()) } else { await this.inDepthCopy(src, dest) } diff --git a/libs/remix-ui/helper/src/lib/helper-components.tsx b/libs/remix-ui/helper/src/lib/helper-components.tsx index e04e162ffc..c290f7bdf9 100644 --- a/libs/remix-ui/helper/src/lib/helper-components.tsx +++ b/libs/remix-ui/helper/src/lib/helper-components.tsx @@ -78,3 +78,9 @@ export const storageFullMessage = () => (
) + +export const recursivePasteToastMsg = () => ( +
+ File(s) to paste is an ancestor of the destination folder +
+) diff --git a/libs/remix-ui/toaster/src/lib/toaster.tsx b/libs/remix-ui/toaster/src/lib/toaster.tsx index 22014d8f7f..571a0c4afa 100644 --- a/libs/remix-ui/toaster/src/lib/toaster.tsx +++ b/libs/remix-ui/toaster/src/lib/toaster.tsx @@ -49,7 +49,7 @@ export const Toaster = (props: ToasterProps) => { } }) } - }, [props.message, state.message]) + }, [props.message]) useEffect(() => { if (state.hiding) { From e23c375fa8daa1df2edb616b71f0888d2ad02fc7 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 30 May 2022 15:50:44 +0200 Subject: [PATCH 08/18] do not compile if no sol files --- .../solidity-compiler/src/lib/logic/compileTabLogic.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts b/libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts index e84f73a76c..b9e926d4b5 100644 --- a/libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts +++ b/libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts @@ -131,6 +131,11 @@ export class CompileTabLogic { runCompiler (externalCompType) { try { + const currentFile = this.api.currentFile + if (currentFile && (currentFile.endsWith('.ts') || currentFile.endsWith('.js') || currentFile.endsWith('.txt') || currentFile.endsWith('.log'))) { + // these are obviously not solidity files. + return + } if (this.api.getFileManagerMode() === 'localhost') { if (externalCompType === 'hardhat') { const { currentVersion, optimize, runs } = this.compiler.state @@ -183,8 +188,7 @@ export class CompileTabLogic { } } // TODO readd saving current file - this.api.saveCurrentFile() - const currentFile = this.api.currentFile + this.api.saveCurrentFile() return this.compileFile(currentFile) } catch (err) { console.error(err) From b5c06844ccd71abd997bd170d6e6974464ccc3c5 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 30 May 2022 20:38:37 +0200 Subject: [PATCH 09/18] add imported ts files to monaco for autocompletion --- apps/remix-ide/src/app/editor/editor.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/apps/remix-ide/src/app/editor/editor.js b/apps/remix-ide/src/app/editor/editor.js index 9bf7e3fec6..dade5f8015 100644 --- a/apps/remix-ide/src/app/editor/editor.js +++ b/apps/remix-ide/src/app/editor/editor.js @@ -1,5 +1,6 @@ 'use strict' import React from 'react' // eslint-disable-line +import { resolve } from 'path' import { EditorUI } from '@remix-ui/editor' // eslint-disable-line import { Plugin } from '@remixproject/engine' import * as packageJson from '../../../../../package.json' @@ -150,6 +151,25 @@ class Editor extends Plugin { this.currentThemeType = theme.quality this.renderComponent() }) + this.on('fileManager', 'currentFileChanged', async (name) => { + if (name.endsWith('.ts')) { + // extract the import, resolve their content + // and add the imported files to Monaco through the `addModel` + // so Monaco can provide auto completion + let content = await this.call('fileManager', 'readFile', name) + const paths = name.split('/') + paths.pop() + const fromPath = paths.join('/') // get current execution context path + for (const match of content.matchAll(/import\s+.*\s+from\s+(?:"(.*?)"|'(.*?)')/g)) { + let path = match[2] + if (path.startsWith('./') || path.startsWith('../')) path = resolve(fromPath, path) + if (path.startsWith('/')) path = path.substring(1) + if (!path.endsWith('.ts')) path = path + '.ts' + content = await this.call('fileManager', 'readFile', path) + this.emit('addModel', content, 'typescript', path, false) + } + } + }) try { this.currentThemeType = (await this.call('theme', 'currentTheme')).quality } catch (e) { From 3d07b4b6210c1a9bb2e0d2ace15efa1d7e929266 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 31 May 2022 09:37:03 +0200 Subject: [PATCH 10/18] check if file exist --- apps/remix-ide/src/app/editor/editor.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide/src/app/editor/editor.js b/apps/remix-ide/src/app/editor/editor.js index dade5f8015..076740cc73 100644 --- a/apps/remix-ide/src/app/editor/editor.js +++ b/apps/remix-ide/src/app/editor/editor.js @@ -165,8 +165,10 @@ class Editor extends Plugin { if (path.startsWith('./') || path.startsWith('../')) path = resolve(fromPath, path) if (path.startsWith('/')) path = path.substring(1) if (!path.endsWith('.ts')) path = path + '.ts' - content = await this.call('fileManager', 'readFile', path) - this.emit('addModel', content, 'typescript', path, false) + if (await this.call('fileManager', 'exists', path)) { + content = await this.call('fileManager', 'readFile', path) + this.emit('addModel', content, 'typescript', path, false) + } } } }) From 1562422097c9cefdda99e46cd8d1b7e1e7d2079f Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 31 May 2022 09:44:32 +0200 Subject: [PATCH 11/18] use shortkey only if sol file --- apps/solidity-compiler/src/app/compiler-api.ts | 8 +++++--- .../solidity-compiler/src/lib/logic/compileTabLogic.ts | 8 ++------ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/apps/solidity-compiler/src/app/compiler-api.ts b/apps/solidity-compiler/src/app/compiler-api.ts index 8a5437359c..25dfb09925 100644 --- a/apps/solidity-compiler/src/app/compiler-api.ts +++ b/apps/solidity-compiler/src/app/compiler-api.ts @@ -332,9 +332,11 @@ export const CompilerApiMixin = (Base) => class extends Base { // ctrl+s or command+s if ((e.metaKey || e.ctrlKey) && !e.shiftKey && e.keyCode === 83 && this.currentFile !== '') { e.preventDefault() - if(await this.getAppParameter('hardhat-compilation')) this.compileTabLogic.runCompiler('hardhat') - else if(await this.getAppParameter('truffle-compilation')) this.compileTabLogic.runCompiler('truffle') - else this.compileTabLogic.runCompiler(undefined) + if (this.currentFile && (this.currentFile.endsWith('.sol') || this.currentFile.endsWith('.yul'))) { + if(await this.getAppParameter('hardhat-compilation')) this.compileTabLogic.runCompiler('hardhat') + else if(await this.getAppParameter('truffle-compilation')) this.compileTabLogic.runCompiler('truffle') + else this.compileTabLogic.runCompiler(undefined) + } } } window.document.addEventListener('keydown', this.data.eventHandlers.onKeyDown) diff --git a/libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts b/libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts index b9e926d4b5..e84f73a76c 100644 --- a/libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts +++ b/libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts @@ -131,11 +131,6 @@ export class CompileTabLogic { runCompiler (externalCompType) { try { - const currentFile = this.api.currentFile - if (currentFile && (currentFile.endsWith('.ts') || currentFile.endsWith('.js') || currentFile.endsWith('.txt') || currentFile.endsWith('.log'))) { - // these are obviously not solidity files. - return - } if (this.api.getFileManagerMode() === 'localhost') { if (externalCompType === 'hardhat') { const { currentVersion, optimize, runs } = this.compiler.state @@ -188,7 +183,8 @@ export class CompileTabLogic { } } // TODO readd saving current file - this.api.saveCurrentFile() + this.api.saveCurrentFile() + const currentFile = this.api.currentFile return this.compileFile(currentFile) } catch (err) { console.error(err) From a6eb4c3390d4d027af5aecd006bd13fbee7f853c Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 1 Jun 2022 11:27:02 +0200 Subject: [PATCH 12/18] fixed file in error --- apps/solidity-compiler/src/app/compiler-api.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/solidity-compiler/src/app/compiler-api.ts b/apps/solidity-compiler/src/app/compiler-api.ts index 25dfb09925..fb8d848039 100644 --- a/apps/solidity-compiler/src/app/compiler-api.ts +++ b/apps/solidity-compiler/src/app/compiler-api.ts @@ -304,14 +304,15 @@ export const CompilerApiMixin = (Base) => class extends Base { if (data.errors) { for (const error of data.errors) { let pos = helper.getPositionDetails(error.formattedMessage) - if (pos.errFile) { + const file = pos.errFile + if (file) { pos = { row: pos.errLine, column: pos.errCol, text: error.formattedMessage, type: error.severity } - await this.call('editor', 'addAnnotation', pos, pos.errFile) + await this.call('editor', 'addAnnotation', pos, file) } } } From 74048a50a3c75c9f42d69267585364872a52386b Mon Sep 17 00:00:00 2001 From: Aniket-Engg Date: Mon, 30 May 2022 19:54:49 +0530 Subject: [PATCH 13/18] select next tab --- apps/remix-ide/src/app/panels/tab-proxy.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/remix-ide/src/app/panels/tab-proxy.js b/apps/remix-ide/src/app/panels/tab-proxy.js index 645b30ecce..cbcd542642 100644 --- a/apps/remix-ide/src/app/panels/tab-proxy.js +++ b/apps/remix-ide/src/app/panels/tab-proxy.js @@ -283,7 +283,12 @@ export class TabProxy extends Plugin { delete this._handlers[name] let previous = currentFileTab this.loadedTabs = this.loadedTabs.filter((tab, index) => { - if (!previous && tab.name === name) previous = this.loadedTabs[index - 1] + if (!previous && tab.name === name) { + if(index - 1 && this.loadedTabs[index - 1]) + previous = this.loadedTabs[index - 1] + else if (index + 1 && this.loadedTabs[index + 1]) + previous = this.loadedTabs[index + 1] + } return tab.name !== name }) this.renderComponent() From 3adbc4a0413bd1c05faa1e1ec89b538742586585 Mon Sep 17 00:00:00 2001 From: Aniket-Engg Date: Wed, 1 Jun 2022 14:47:24 +0530 Subject: [PATCH 14/18] fix events --- apps/remix-ide/src/app/editor/editor.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/apps/remix-ide/src/app/editor/editor.js b/apps/remix-ide/src/app/editor/editor.js index 076740cc73..689850b88c 100644 --- a/apps/remix-ide/src/app/editor/editor.js +++ b/apps/remix-ide/src/app/editor/editor.js @@ -141,12 +141,6 @@ class Editor extends Plugin { this.on('sidePanel', 'pluginDisabled', (name) => { this.clearAllDecorationsFor(name) }) - this.on('fileManager', 'fileClosed', (name) => { - if (name === this.currentFile) { - this.currentFile = null - this.renderComponent() - } - }) this.on('theme', 'themeLoaded', (theme) => { this.currentThemeType = theme.quality this.renderComponent() @@ -171,6 +165,15 @@ class Editor extends Plugin { } } } + if (name === this.currentFile) { + this.currentFile = name + this.renderComponent() + } + }) + + this.on('fileManager', 'noFileSelected', async () => { + this.currentFile = null + this.renderComponent() }) try { this.currentThemeType = (await this.call('theme', 'currentTheme')).quality From a9369135e59067aa3348a330c07754958c510a46 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 1 Jun 2022 11:36:45 +0200 Subject: [PATCH 15/18] Update publishIpfs --- apps/remix-ide/ci/publishIpfs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide/ci/publishIpfs b/apps/remix-ide/ci/publishIpfs index 0f8fd96ca0..0f4b1a7fc8 100755 --- a/apps/remix-ide/ci/publishIpfs +++ b/apps/remix-ide/ci/publishIpfs @@ -5,8 +5,8 @@ const { globSource } = IpfsHttpClient const folder = process.cwd() + '/dist/apps/remix-ide'; (async () => { - const host = 'ipfs.remixproject.org' - const ipfs = IpfsHttpClient({ host, port: 443, protocol: 'https' }) + const host = 'ipfs.infura.io' + const ipfs = IpfsHttpClient({ host, port: 5001, protocol: 'https' }) try { let result = await ipfs.add(globSource(folder, { recursive: true}), { pin: false }) const hash = result.cid.toString() From f26549ac91255e236111bc36f4d4f78fe2e980bc Mon Sep 17 00:00:00 2001 From: Aniket-Engg Date: Wed, 1 Jun 2022 16:59:11 +0530 Subject: [PATCH 16/18] show editor home on all files closing --- apps/remix-ide/src/app/panels/layout.ts | 3 --- apps/remix-ide/src/app/panels/tab-proxy.js | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/apps/remix-ide/src/app/panels/layout.ts b/apps/remix-ide/src/app/panels/layout.ts index 33704eef35..37a0ee6fe4 100644 --- a/apps/remix-ide/src/app/panels/layout.ts +++ b/apps/remix-ide/src/app/panels/layout.ts @@ -57,9 +57,6 @@ export class Layout extends Plugin { this.panels.main.active = false this.event.emit('change', null) }) - this.on('tabs', 'tabCountChanged', async count => { - if (!count) await this.call('manager', 'activatePlugin', 'home') - }) this.on('manager', 'activate', (profile: Profile) => { switch (profile.name) { case 'filePanel': diff --git a/apps/remix-ide/src/app/panels/tab-proxy.js b/apps/remix-ide/src/app/panels/tab-proxy.js index cbcd542642..82758c169f 100644 --- a/apps/remix-ide/src/app/panels/tab-proxy.js +++ b/apps/remix-ide/src/app/panels/tab-proxy.js @@ -284,7 +284,7 @@ export class TabProxy extends Plugin { let previous = currentFileTab this.loadedTabs = this.loadedTabs.filter((tab, index) => { if (!previous && tab.name === name) { - if(index - 1 && this.loadedTabs[index - 1]) + if(index - 1 >= 0 && this.loadedTabs[index - 1]) previous = this.loadedTabs[index - 1] else if (index + 1 && this.loadedTabs[index + 1]) previous = this.loadedTabs[index + 1] From cedbfb5eb6e25c7dc34151a2bd71c3bd2cdf4450 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 2 Jun 2022 17:36:14 +0200 Subject: [PATCH 17/18] update github actions --- .github/workflows/publish-action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-action.yml b/.github/workflows/publish-action.yml index 3fb3a3031f..0424a8585e 100644 --- a/.github/workflows/publish-action.yml +++ b/.github/workflows/publish-action.yml @@ -9,7 +9,7 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 - - run: yarn install + - run: yarn install --ignore-engines - run: ls - run: pwd - run: yarn run downloadsolc_assets From 311eb2d7c48f94e0a53973d9dd4923d2f3051f26 Mon Sep 17 00:00:00 2001 From: yann300 Date: Fri, 3 Jun 2022 10:04:10 +0200 Subject: [PATCH 18/18] fix publish action --- .github/workflows/publish-action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-action.yml b/.github/workflows/publish-action.yml index 0424a8585e..12e78cebe5 100644 --- a/.github/workflows/publish-action.yml +++ b/.github/workflows/publish-action.yml @@ -12,8 +12,8 @@ jobs: - run: yarn install --ignore-engines - run: ls - run: pwd - - run: yarn run downloadsolc_assets - - run: yarn run build:production + - run: yarn run downloadsolc_assets --ignore-engines + - run: yarn run build:production --ignore-engines - run: echo "action_state=$('./apps/remix-ide/ci/publishIpfs')" >> $GITHUB_ENV - uses: mshick/add-pr-comment@v1 with: