|
|
|
@ -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) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|