@@ -197,8 +197,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
197197
198198 useEffect ( ( ) => {
199199 compileTabLogic . setUseFileConfiguration ( state . useFileConfiguration )
200- if ( state . useFileConfiguration && workspaceName ) {
201- // compileTabLogic.setConfigFilePath(configFilePath)
200+ if ( state . useFileConfiguration ) {
202201 createNewConfigFile ( )
203202 }
204203 } , [ state . useFileConfiguration ] )
@@ -223,12 +222,14 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
223222 const remixConfig = await api . readFile ( remixConfigPath )
224223 const remixConfigContent = JSON . parse ( remixConfig )
225224
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+ }
230232 }
231- await api . writeFile ( remixConfigPath , JSON . stringify ( { ...remixConfigContent , 'solidity-compiler' : compilerConfig } , null , 2 ) )
232233 } else {
233234 const config = JSON . parse ( configFileContent )
234235
@@ -433,18 +434,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
433434 const currentFile = api . currentFile
434435
435436 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 ( )
448438 _setCompilerVersionFromPragma ( currentFile )
449439 let externalCompType
450440 if ( hhCompilation ) externalCompType = 'hardhat'
0 commit comments