pull/5370/head
bunsenstraat 3 years ago
parent 5c9e68aca1
commit b22195f0d2
  1. 8
      libs/remix-core-plugin/src/lib/editor-context-listener.ts

@ -69,8 +69,13 @@ export class EditorContextListener extends Plugin {
this.on('solidity', 'loadingCompiler', async (url) => { this.on('solidity', 'loadingCompiler', async (url) => {
console.log('loading compiler', url) console.log('loading compiler', url)
this.compiler.event.register('compilerLoaded', async () => await this.compile())
this.compiler.loadVersion(true, url) this.compiler.loadVersion(true, url)
this.compiler.event.register('compilerLoaded', async () =>{
console.log('compiler loaded')
await this.compile()
await this.getAST()
})
}) })
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 = new Compiler((url, cb) => this.call('contentImport', 'resolveAndSave', url, undefined, false).then((result) => cb(null, result)).catch((error) => cb(error.message)))
@ -162,6 +167,7 @@ export class EditorContextListener extends Plugin {
this.currentFile = await this.call('fileManager', 'file') this.currentFile = await this.call('fileManager', 'file')
if (!this.currentFile) return if (!this.currentFile) return
const content = await this.call('fileManager', 'readFile', this.currentFile) const content = await this.call('fileManager', 'readFile', this.currentFile)
console.log('compile', this.currentFile, content)
const sources = { [this.currentFile]: { content } } const sources = { [this.currentFile]: { content } }
this.compiler.compile(sources, this.currentFile) this.compiler.compile(sources, this.currentFile)
} catch (e) { } catch (e) {

Loading…
Cancel
Save