@@ -29,7 +29,7 @@ const profile = {
29
29
// - methods: ['getCompilationResult']
30
30
31
31
export default class CompileTab extends CompilerApiMixin ( ViewPlugin ) { // implements ICompilerApi
32
- constructor ( config , fileManager ) {
32
+ constructor ( config , fileManager ) {
33
33
super ( profile )
34
34
this . fileManager = fileManager
35
35
this . config = config
@@ -42,55 +42,55 @@ export default class CompileTab extends CompilerApiMixin(ViewPlugin) { // implem
42
42
this . el . setAttribute ( 'id' , 'compileTabView' )
43
43
}
44
44
45
- renderComponent ( ) {
45
+ renderComponent ( ) {
46
46
// empty method, is a state update needed?
47
47
}
48
48
49
- onCurrentFileChanged ( ) {
49
+ onCurrentFileChanged ( ) {
50
50
this . renderComponent ( )
51
51
}
52
52
53
53
// onResetResults () {
54
54
// this.renderComponent()
55
55
// }
56
56
57
- onSetWorkspace ( ) {
57
+ onSetWorkspace ( ) {
58
58
this . renderComponent ( )
59
59
}
60
60
61
- onFileRemoved ( ) {
61
+ onFileRemoved ( ) {
62
62
this . renderComponent ( )
63
63
}
64
64
65
- onNoFileSelected ( ) {
65
+ onNoFileSelected ( ) {
66
66
this . renderComponent ( )
67
67
}
68
68
69
- onFileClosed ( ) {
69
+ onFileClosed ( ) {
70
70
this . renderComponent ( )
71
71
}
72
72
73
- onCompilationFinished ( ) {
73
+ onCompilationFinished ( ) {
74
74
this . renderComponent ( )
75
75
}
76
76
77
- render ( ) {
78
- return < div id = 'compileTabView' > < SolidityCompiler api = { this } /> </ div >
77
+ render ( ) {
78
+ return < div id = 'compileTabView' > < SolidityCompiler api = { this } /> </ div >
79
79
}
80
80
81
- async compileWithParameters ( compilationTargets , settings ) {
81
+ async compileWithParameters ( compilationTargets , settings ) {
82
82
return await super . compileWithParameters ( compilationTargets , settings )
83
83
}
84
84
85
- getCompilationResult ( ) {
85
+ getCompilationResult ( ) {
86
86
return super . getCompilationResult ( )
87
87
}
88
88
89
- getFileManagerMode ( ) {
89
+ getFileManagerMode ( ) {
90
90
return this . fileManager . mode
91
91
}
92
92
93
- isDesktop ( ) {
93
+ isDesktop ( ) {
94
94
return Registry . getInstance ( ) . get ( 'platform' ) . api . isDesktop ( )
95
95
}
96
96
@@ -99,7 +99,7 @@ export default class CompileTab extends CompilerApiMixin(ViewPlugin) { // implem
99
99
* This function is used by remix-plugin compiler API.
100
100
* @param {object } settings {evmVersion, optimize, runs, version, language}
101
101
*/
102
- async setCompilerConfig ( settings ) {
102
+ async setCompilerConfig ( settings ) {
103
103
super . setCompilerConfig ( settings )
104
104
this . renderComponent ( )
105
105
// @todo (#2875) should use loading compiler return value to check whether the compiler is loaded instead of "setInterval"
@@ -108,24 +108,24 @@ export default class CompileTab extends CompilerApiMixin(ViewPlugin) { // implem
108
108
pluginInfo = await this . call ( 'udapp' , 'showPluginDetails' )
109
109
110
110
if ( this . currentRequest . from === 'udapp' ) {
111
- this . call ( 'notification' , 'toast' , compilerConfigChangedToastMsg ( ( pluginInfo ? pluginInfo . displayName : this . currentRequest . from ) , value ) )
111
+ this . call ( 'notification' , 'toast' , compilerConfigChangedToastMsg ( ( pluginInfo ? pluginInfo . displayName : this . currentRequest . from ) , value ) )
112
112
}
113
113
}
114
114
115
- async getCompilerConfig ( ) {
115
+ async getCompilerConfig ( ) {
116
116
return await super . getCompilerConfig ( )
117
117
}
118
118
119
- compile ( fileName ) {
119
+ compile ( fileName ) {
120
120
if ( ! isNative ( this . currentRequest . from ) ) this . call ( 'notification' , 'toast' , compileToastMsg ( this . currentRequest . from , fileName ) )
121
121
super . compile ( fileName )
122
122
}
123
123
124
- compileFile ( event ) {
124
+ compileFile ( event ) {
125
125
return super . compileFile ( event )
126
126
}
127
127
128
- async onActivation ( ) {
128
+ async onActivation ( ) {
129
129
super . onActivation ( )
130
130
this . on ( 'filePanel' , 'workspaceInitializationCompleted' , ( ) => {
131
131
this . call ( 'filePanel' , 'registerContextMenuItem' , {
@@ -138,6 +138,16 @@ export default class CompileTab extends CompilerApiMixin(ViewPlugin) { // implem
138
138
pattern : [ ] ,
139
139
group : 6
140
140
} )
141
+ this . on ( 'fileManager' , 'fileSaved' , async ( file ) => {
142
+ if ( await this . getAppParameter ( 'configFilePath' ) === file ) {
143
+ this . emit ( 'configFileChanged' , file )
144
+ }
145
+ } )
146
+ this . on ( 'fileManager' , 'fileAdded' , async ( file ) => {
147
+ if ( await this . getAppParameter ( 'configFilePath' ) === file ) {
148
+ this . emit ( 'configFileChanged' , file )
149
+ }
150
+ } )
141
151
} )
142
152
try {
143
153
this . currentFile = await this . call ( 'fileManager' , 'file' )
@@ -146,11 +156,11 @@ export default class CompileTab extends CompilerApiMixin(ViewPlugin) { // implem
146
156
}
147
157
}
148
158
149
- getCompiler ( ) {
159
+ getCompiler ( ) {
150
160
return this . compileTabLogic . compiler
151
161
}
152
162
153
- getCompilerQueryParameters ( ) {
163
+ getCompilerQueryParameters ( ) {
154
164
const params = this . queryParams . get ( )
155
165
console . log ( 'getCompilerQueryParameters' , params )
156
166
params . evmVersion = params . evmVersion === 'null' || params . evmVersion === 'undefined' ? null : params . evmVersion
@@ -159,24 +169,28 @@ export default class CompileTab extends CompilerApiMixin(ViewPlugin) { // implem
159
169
return params
160
170
}
161
171
162
- setCompilerQueryParameters ( params ) {
172
+ setCompilerQueryParameters ( params ) {
163
173
console . log ( 'setCompilerQueryParameters' , params )
164
174
this . queryParams . update ( params )
165
- try {
175
+ try {
166
176
this . emit ( 'compilerQueryParamsUpdated' )
167
- } catch ( e ) { }
177
+ } catch ( e ) {
178
+ // do nothing
179
+ }
168
180
}
169
181
170
- async getAppParameter ( name ) {
182
+ async getAppParameter ( name ) {
171
183
return await this . call ( 'config' , 'getAppParameter' , name )
172
184
}
173
185
174
- async setAppParameter ( name , value ) {
186
+ async setAppParameter ( name , value ) {
175
187
console . log ( 'setAppParameter' , name , value )
176
188
await this . call ( 'config' , 'setAppParameter' , name , value )
177
- try {
178
- this . emit ( 'compilerQueryParamsUpdated' )
179
- } catch ( e ) { }
189
+ try {
190
+ this . emit ( 'compilerAppParamsUpdated' )
191
+ } catch ( e ) {
192
+ // do nothing
193
+ }
180
194
}
181
195
}
182
196
0 commit comments