@@ -197,8 +197,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
197
197
198
198
useEffect ( ( ) => {
199
199
compileTabLogic . setUseFileConfiguration ( state . useFileConfiguration )
200
- if ( state . useFileConfiguration && workspaceName ) {
201
- // compileTabLogic.setConfigFilePath(configFilePath)
200
+ if ( state . useFileConfiguration ) {
202
201
createNewConfigFile ( )
203
202
}
204
203
} , [ state . useFileConfiguration ] )
@@ -223,12 +222,14 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
223
222
const remixConfig = await api . readFile ( remixConfigPath )
224
223
const remixConfigContent = JSON . parse ( remixConfig )
225
224
226
- let compilerConfig = remixConfigContent [ 'solidity-compiler' ]
227
- if ( ! compilerConfig ) compilerConfig = JSON . parse ( configFileContent )
228
- if ( isFoundryProject && ! compilerConfig . settings . remappings ) {
229
- compilerConfig . settings . remappings = [ 'ds-test/=lib/forge-std/lib/ds-test/src/' , 'forge-std/=lib /forge-std/src/' ]
225
+ if ( ! remixConfigContent [ 'solidity-compiler' ] ) {
226
+ const compilerConfig = JSON . parse ( configFileContent )
227
+
228
+ if ( isFoundryProject && ! compilerConfig . settings . remappings ) {
229
+ compilerConfig . settings . remappings = [ 'ds-test/=lib/forge-std/lib/ds-test/src/' , 'forge-std/=lib /forge-std/src/' ]
230
+ await api . writeFile ( remixConfigPath , JSON . stringify ( { ...remixConfigContent , 'solidity-compiler' : compilerConfig } , null , 2 ) )
231
+ }
230
232
}
231
- await api . writeFile ( remixConfigPath , JSON . stringify ( { ...remixConfigContent , 'solidity-compiler' : compilerConfig } , null , 2 ) )
232
233
} else {
233
234
const config = JSON . parse ( configFileContent )
234
235
@@ -433,18 +434,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
433
434
const currentFile = api . currentFile
434
435
435
436
if ( ! isSolFileSelected ( ) ) return
436
- if ( state . useFileConfiguration ) {
437
- const exists = await api . fileExists ( remixConfigPath )
438
-
439
- if ( exists ) {
440
- const remixConfig = await api . readFile ( remixConfigPath )
441
- const remixConfigContent = JSON . parse ( remixConfig )
442
-
443
- if ( ! remixConfigContent [ 'solidity-compiler' ] ) await createNewConfigFile ( )
444
- } else {
445
- await createNewConfigFile ( )
446
- }
447
- }
437
+ if ( state . useFileConfiguration ) await createNewConfigFile ( )
448
438
_setCompilerVersionFromPragma ( currentFile )
449
439
let externalCompType
450
440
if ( hhCompilation ) externalCompType = 'hardhat'
0 commit comments