Skip to content

Commit 8d814e7

Browse files
committed
config state
1 parent bfd2770 commit 8d814e7

File tree

6 files changed

+265
-495
lines changed

6 files changed

+265
-495
lines changed

apps/remix-ide/src/app/plugins/parser/code-parser.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,11 @@ export class CodeParser extends Plugin {
167167
await this.handleChangeEvents()
168168
})
169169

170+
this.on('solidity', 'compilerQueryParamsUpdated', async (file) => {
171+
await this.call('editor', 'discardLineTexts')
172+
await this.handleChangeEvents()
173+
})
174+
170175
this.on('filePanel', 'setWorkspace', async () => {
171176
await this.call('fileDecorator', 'clearFileDecorators')
172177
await this.importService.updateDirectoryCacheTimeStamp()

apps/remix-ide/src/app/plugins/parser/services/code-parser-compiler.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ export default class CodeParserCompiler {
134134
this.plugin.currentFile = await this.plugin.call('fileManager', 'file')
135135
if (this.plugin.currentFile && this.plugin.currentFile.endsWith('.sol')) {
136136
const state = await this.plugin.call('solidity', 'getCompilerState')
137+
console.log('state', state)
137138
this.compiler.set('optimize', state.optimize)
138139
this.compiler.set('evmVersion', state.evmVersion)
139140
this.compiler.set('language', state.language)

apps/remix-ide/src/app/tabs/compile-tab.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const profile = {
2121
documentation: 'https://remix-ide.readthedocs.io/en/latest/compile.html',
2222
version: packageJson.version,
2323
maintainedBy: 'Remix',
24-
methods: ['getCompilationResult', 'compile', 'compileWithParameters', 'setCompilerConfig', 'compileFile', 'getCompilerState', 'getCompilerQueryParameters', 'getCompiler']
24+
methods: ['getCompilationResult', 'compile', 'compileWithParameters', 'setCompilerConfig', 'compileFile', 'getCompilerState', 'getCompilerConfig', 'getCompilerQueryParameters', 'getCompiler']
2525
}
2626

2727
// EditorApi:
@@ -112,6 +112,10 @@ export default class CompileTab extends CompilerApiMixin(ViewPlugin) { // implem
112112
}
113113
}
114114

115+
async getCompilerConfig () {
116+
return await super.getCompilerConfig()
117+
}
118+
115119
compile (fileName) {
116120
if (!isNative(this.currentRequest.from)) this.call('notification', 'toast', compileToastMsg(this.currentRequest.from, fileName))
117121
super.compile(fileName)
@@ -148,22 +152,31 @@ export default class CompileTab extends CompilerApiMixin(ViewPlugin) { // implem
148152

149153
getCompilerQueryParameters () {
150154
const params = this.queryParams.get()
155+
console.log('getCompilerQueryParameters', params)
151156
params.evmVersion = params.evmVersion === 'null' || params.evmVersion === 'undefined' ? null : params.evmVersion
152157
params.optimize = (params.optimize === 'false' || params.optimize === null || params.optimize === undefined) ? false : params.optimize
153158
params.optimize = params.optimize === 'true' ? true : params.optimize
154159
return params
155160
}
156161

157162
setCompilerQueryParameters (params) {
163+
console.log('setCompilerQueryParameters', params)
158164
this.queryParams.update(params)
165+
try{
166+
this.emit('compilerQueryParamsUpdated')
167+
} catch (e) {}
159168
}
160169

161170
async getAppParameter (name) {
162171
return await this.call('config', 'getAppParameter', name)
163172
}
164173

165174
async setAppParameter (name, value) {
175+
console.log('setAppParameter', name, value)
166176
await this.call('config', 'setAppParameter', name, value)
177+
try{
178+
this.emit('compilerQueryParamsUpdated')
179+
} catch (e) {}
167180
}
168181
}
169182

libs/remix-solidity/src/compiler/compiler.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ export class Compiler {
101101
*/
102102

103103
compile(files: Source, target: string): void {
104+
console.log('Compiling', this.state)
104105
this.state.target = target
105106
this.state.compilationStartTime = new Date().getTime()
106107
this.event.trigger('compilationStarted', [])

libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ export class CompileTabLogic {
7373
this.configFilePath = path
7474
}
7575

76+
getConfigFilePath () {
77+
return this.configFilePath
78+
}
79+
7680
setRuns (runs) {
7781
this.runs = runs
7882
this.api.setCompilerQueryParameters({ runs: this.runs })
@@ -86,6 +90,7 @@ export class CompileTabLogic {
8690
}
8791

8892
getCompilerState () {
93+
console.log('getCompilerState', this.compiler.state)
8994
return this.compiler.state
9095
}
9196

0 commit comments

Comments
 (0)