rm save option

editorcontextDummy
filip mertens 2 years ago
parent 59f9d087b6
commit 634f3b3e0d
  1. 7
      libs/remix-core-plugin/src/lib/editor-context-listener.ts
  2. 4
      libs/remix-solidity/src/compiler/compiler-input.ts
  3. 14
      libs/remix-solidity/src/compiler/compiler-worker.ts
  4. 1
      libs/remix-solidity/src/compiler/compiler.ts
  5. 1
      libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx
  6. 9
      libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts

@ -2,6 +2,7 @@
import { Plugin } from '@remixproject/engine'
import { sourceMappingDecoder } from '@remix-project/remix-debug'
import { CompilerAbstract } from '@remix-project/remix-solidity'
import { getValidLanguage, Compiler} from '@remix-project/remix-solidity'
const profile = {
name: 'contextualListener',
@ -41,6 +42,7 @@ export class EditorContextListener extends Plugin {
lastCompilationResult: any
lastAST: any
compiler: any
constructor(astWalker) {
super(profile)
@ -60,6 +62,9 @@ export class EditorContextListener extends Plugin {
this._stopHighlighting()
})
this.compiler = new Compiler((url, cb) => this.call('contentImport', 'resolveAndSave', url, undefined, false).then((result) => cb(null, result)).catch((error) => cb(error.message)))
this.compiler.loadVersion(true,'https://binaries.soliditylang.org/wasm/soljson-v0.8.7+commit.e28d00a7.js')
this.on('solidity', 'astFinished', async (file, source, languageVersion, data, input, version) => {
// console.log('compilation result', Object.keys(data.sources))
if (languageVersion.indexOf('soljson') !== 0 || !data.sources) return
@ -76,7 +81,7 @@ export class EditorContextListener extends Plugin {
})
setInterval(async () => {
await this.compile()
//await this.compile()
}, 5000)

@ -16,9 +16,9 @@ export default (sources: Source, opts: CompilerInputOptions): string => {
outputSelection: {
'*': {
'': ['ast'],
'*': []
//'*': []
//'*' : ['abi', 'metadata']
// '*': ['abi', 'metadata', 'devdoc', 'userdoc', 'storageLayout', 'evm.legacyAssembly', 'evm.bytecode', 'evm.deployedBytecode', 'evm.methodIdentifiers', 'evm.gasEstimates', 'evm.assembly']
'*': ['abi', 'metadata', 'devdoc', 'userdoc', 'storageLayout', 'evm.legacyAssembly', 'evm.bytecode', 'evm.deployedBytecode', 'evm.methodIdentifiers', 'evm.gasEstimates', 'evm.assembly']
}
}
}

@ -44,13 +44,13 @@ export default function (self) { // eslint-disable-line @typescript-eslint/expli
case 'compile':
missingInputs.length = 0
if (data.input && compileJSON) {
self.postMessage({
cmd: 'compiled',
job: data.job,
data: compileJSON(data.input),
input: data.input,
missingInputs: missingInputs
})
self.postMessage({
cmd: 'compiled',
job: data.job,
data: compileJSON(data.input),
input: data.input,
missingInputs: missingInputs
})
}
break
}

@ -272,6 +272,7 @@ export class Compiler {
const jobs: Record<'sources', SourceWithTarget> [] = []
this.state.worker.addEventListener('message', (msg: Record <'data', MessageFromWorker>) => {
console.log(msg)
const data: MessageFromWorker = msg.data
switch (data.cmd) {
case 'versionLoaded':

@ -478,6 +478,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
console.log('VERSION', selectedVersion)
if (selectedVersion === 'builtin') selectedVersion = state.defaultVersion
if (selectedVersion !== 'builtin' && canUseWorker(selectedVersion)) {
console.log('loading ' + url + ' with worker')
compileTabLogic.compiler.loadVersion(true, url)
} else {
compileTabLogic.compiler.loadVersion(false, url)

@ -99,8 +99,7 @@ export class CompileTabLogic {
* Compile a specific file of the file manager
* @param {string} target the path to the file to compile
*/
compileFile (target: string, settings: any = {save: true}) {
console.log(settings)
compileFile (target: string) {
if (!target) throw new Error('No target provided for compiliation')
return new Promise((resolve, reject) => {
this.api.readFile(target).then((content) => {
@ -110,12 +109,6 @@ export class CompileTabLogic {
this.api.readFile(this.configFilePath).then( contentConfig => {
this.compiler.set('configFileContent', contentConfig)
})
if(settings.save) {
this.compiler.handleImportCall = (url, cb) => this.api.resolveContentAndSave(url).then((result) => cb(null, result)).catch((error) => cb(error.message))
}else{
this.compiler.handleImportCall = (url, cb) => this.api.resolveContent(url).then((result) => cb(null, result)).catch((error) => cb(error.message))
}
console.log(this.compiler)
// setTimeout fix the animation on chrome... (animation triggered by 'staringCompilation')
setTimeout(() => { this.compiler.compile(sources, target); resolve(true) }, 100)
}).catch((error) => {

Loading…
Cancel
Save