pull/1860/head
filip mertens 3 years ago committed by yann300
parent 67cc1bb11a
commit 5653c2e290
  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. 12
      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) const param = params[name] ? params[name] : config.get(name)
if (param === 'true') return true if (param === 'true') return true
if (param === 'false') return false if (param === 'false') return false
console.log(param)
return param return param
} }
setAppParameter (name: string, value: any) { setAppParameter (name: string, value: any) {
console.log('setAppParameter', name, value)
const config = Registry.getInstance().get('config').api const config = Registry.getInstance().get('config').api
config.set(name, value) config.set(name, value)
} }

@ -144,12 +144,12 @@ class CompileTab extends CompilerApiMixin(ViewPlugin) { // implements ICompilerA
this.queryParams.update(params) this.queryParams.update(params)
} }
getAppParameter (name) { async getAppParameter (name) {
return this.call('config', 'getAppParameter', name) return await this.call('config', 'getAppParameter', name)
} }
setAppParameter (name, value) { async setAppParameter (name, value) {
this.call('config', '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) this.on('themeModule', 'themeChanged', this.data.eventHandlers.onThemeChanged)
// Run the compiler instead of trying to save the website // 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 // ctrl+s or command+s
if ((e.metaKey || e.ctrlKey) && e.keyCode === 83 && this.currentFile !== '') { if ((e.metaKey || e.ctrlKey) && e.keyCode === 83 && this.currentFile !== '') {
e.preventDefault() 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) window.document.addEventListener('keydown', this.data.eventHandlers.onKeyDown)

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

Loading…
Cancel
Save