pull/5370/head
filip mertens 3 years ago committed by yann300
parent 20d31e79bb
commit 084ec41d5f
  1. 2
      apps/remix-ide/src/app/plugins/config.ts
  2. 8
      apps/remix-ide/src/app/tabs/compile-tab.js
  3. 4
      apps/solidity-compiler/src/app/compiler-api.ts
  4. 40
      libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx

@ -21,10 +21,12 @@ export class ConfigPlugin extends Plugin {
const param = params[name] ? params[name] : config.get(name)
if (param === 'true') return true
if (param === 'false') return false
console.log(param)
return param
}
setAppParameter (name: string, value: any) {
console.log('setAppParameter', name, value)
const config = Registry.getInstance().get('config').api
config.set(name, value)
}

@ -144,12 +144,12 @@ class CompileTab extends CompilerApiMixin(ViewPlugin) { // implements ICompilerA
this.queryParams.update(params)
}
getAppParameter (name) {
return this.call('config', 'getAppParameter', name)
async getAppParameter (name) {
return await this.call('config', 'getAppParameter', name)
}
setAppParameter (name, value) {
this.call('config', 'setAppParameter', name, value)
async setAppParameter (name, value) {
await this.call('config', 'setAppParameter', name, value)
}
}

@ -291,11 +291,11 @@ export const CompilerApiMixin = (Base) => class extends Base {
this.on('themeModule', 'themeChanged', this.data.eventHandlers.onThemeChanged)
// Run the compiler instead of trying to save the website
this.data.eventHandlers.onKeyDown = (e) => {
this.data.eventHandlers.onKeyDown = async (e) => {
// ctrl+s or command+s
if ((e.metaKey || e.ctrlKey) && e.keyCode === 83 && this.currentFile !== '') {
e.preventDefault()
this.compileTabLogic.runCompiler(this.getAppParameter('hardhat-compilation'))
this.compileTabLogic.runCompiler(await this.getAppParameter('hardhat-compilation'))
}
}
window.document.addEventListener('keydown', this.data.eventHandlers.onKeyDown)

@ -64,23 +64,29 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
}, [])
useEffect(() => {
if (compileTabLogic && compileTabLogic.compiler) {
setState(prevState => {
const params = api.getCompilerParameters()
const optimize = params.optimize
const runs = params.runs as string
const evmVersion = params.evmVersion
return {
...prevState,
hideWarnings: api.getAppParameter('hideWarnings') as boolean || false,
autoCompile: api.getAppParameter('autoCompile') as boolean || false,
includeNightlies: api.getAppParameter('includeNightlies') as boolean || false,
optimize: optimize,
runs: runs,
evmVersion: (evmVersion !== null) && (evmVersion !== 'null') && (evmVersion !== undefined) && (evmVersion !== 'undefined') ? evmVersion : 'default'
}
})
}
(async () => {
if (compileTabLogic && compileTabLogic.compiler) {
const autocompile = await api.getAppParameter('autoCompile') as boolean || false
const hideWarnings = await api.getAppParameter('hideWarnings') as boolean || false
const includeNightlies = await api.getAppParameter('includeNightlies') as boolean || false
setState(prevState => {
const params = api.getCompilerParameters()
const optimize = params.optimize
const runs = params.runs as string
const evmVersion = params.evmVersion
return {
...prevState,
hideWarnings: hideWarnings,
autoCompile: autocompile,
includeNightlies: includeNightlies,
optimize: optimize,
runs: runs,
evmVersion: (evmVersion !== null) && (evmVersion !== 'null') && (evmVersion !== undefined) && (evmVersion !== 'undefined') ? evmVersion : 'default'
}
})
}
})()
}, [compileTabLogic])
useEffect(() => {

Loading…
Cancel
Save