Merge pull request #2958 from ethereum/configchanges

react to config changes
pull/2959/head
bunsenstraat 2 years ago committed by GitHub
commit 131c669fd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      apps/remix-ide-e2e/src/tests/editorAutoComplete.test.ts
  2. 3
      apps/remix-ide/src/app/plugins/config.ts
  3. 17
      apps/remix-ide/src/app/plugins/parser/code-parser.tsx
  4. 3
      apps/remix-ide/src/app/tabs/settings-tab.tsx
  5. 1
      apps/remix-ide/src/config.js

@ -112,7 +112,7 @@ module.exports = {
return actions. return actions.
sendKeys(' someaddress;') sendKeys(' someaddress;')
.sendKeys(this.Keys.ENTER) .sendKeys(this.Keys.ENTER)
}).pause(2000) }).pause(4000)
.perform(function () { .perform(function () {
const actions = this.actions({ async: true }); const actions = this.actions({ async: true });
return actions. return actions.

@ -6,7 +6,8 @@ const profile = {
name: 'config', name: 'config',
displayName: 'Config', displayName: 'Config',
description: 'Config', description: 'Config',
methods: ['getAppParameter', 'setAppParameter'] methods: ['getAppParameter', 'setAppParameter'],
events: ['configChanged']
} }
export class ConfigPlugin extends Plugin { export class ConfigPlugin extends Plugin {

@ -147,8 +147,25 @@ export class CodeParser extends Plugin {
this.compilerService.compiler.loadVersion(true, `${url}?t=${Date.now()}`) this.compilerService.compiler.loadVersion(true, `${url}?t=${Date.now()}`)
}) })
this.on('config', 'configChanged', async (config) => {
await this.reload()
})
this.on('settings', 'configChanged', async (config) => {
await this.reload()
})
await this.compilerService.init() await this.compilerService.init()
this.on('solidity', 'compilerLoaded', async () => {
await this.reload()
})
}
async reload(){
await this.call('editor', 'discardLineTexts')
await this.call('fileDecorator', 'clearFileDecorators')
await this.call('editor', 'clearErrorMarkers', [this.currentFile])
await this.handleChangeEvents()
} }
/** /**

@ -32,6 +32,9 @@ module.exports = class SettingsTab extends ViewPlugin {
constructor (config, editor) { constructor (config, editor) {
super(profile) super(profile)
this.config = config this.config = config
this.config.events.on('configChanged', (changedConfig) => {
this.emit('configChanged', changedConfig)
})
this.editor = editor this.editor = editor
this._deps = { this._deps = {
themeModule: Registry.getInstance().get('themeModule').api themeModule: Registry.getInstance().get('themeModule').api

@ -30,6 +30,7 @@ function Config (storage) {
this.items[key] = content this.items[key] = content
try { try {
storage.set(CONFIG_FILE, JSON.stringify(this.items)) storage.set(CONFIG_FILE, JSON.stringify(this.items))
this.events.emit('configChanged', { key, content })
this.events.emit(key + '_changed', content) this.events.emit(key + '_changed', content)
} catch (exception) { } catch (exception) {
/* Do nothing. */ /* Do nothing. */

Loading…
Cancel
Save