use currentFile

pull/5370/head
yann300 3 years ago
parent 1c866004bc
commit 3f9f4cd73b
  1. 6
      libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx
  2. 2
      libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts

@ -57,7 +57,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
_updateVersionSelector(selectedVersion) _updateVersionSelector(selectedVersion)
} }
}) })
const currentFileName = api.getAppParameter('currentFile') as string const currentFileName = api.currentFile
currentFile(currentFileName) currentFile(currentFileName)
listenToEvents(compileTabLogic, api)(dispatch) listenToEvents(compileTabLogic, api)(dispatch)
@ -229,7 +229,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
} }
const isSolFileSelected = (currentFile: string = '') => { const isSolFileSelected = (currentFile: string = '') => {
if (!currentFile) currentFile = api.getAppParameter('currentFile') as string if (!currentFile) currentFile = api.currentFile
if (!currentFile) return false if (!currentFile) return false
const extention = currentFile.substr(currentFile.length - 3, currentFile.length) const extention = currentFile.substr(currentFile.length - 3, currentFile.length)
return extention.toLowerCase() === 'sol' || extention.toLowerCase() === 'yul' return extention.toLowerCase() === 'sol' || extention.toLowerCase() === 'yul'
@ -298,7 +298,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
} }
const compile = () => { const compile = () => {
const currentFile = api.getAppParameter('currentFile') as string const currentFile = api.currentFile
if (!isSolFileSelected()) return if (!isSolFileSelected()) return

@ -123,7 +123,7 @@ export class CompileTabLogic {
// TODO readd saving current file // TODO readd saving current file
this.api.saveCurrentFile() this.api.saveCurrentFile()
this.event.emit('removeAnnotations') this.event.emit('removeAnnotations')
var currentFile = this.api.getAppParameter('currentFile') var currentFile = this.api.currentFile
return this.compileFile(currentFile) return this.compileFile(currentFile)
} catch (err) { } catch (err) {
console.error(err) console.error(err)

Loading…
Cancel
Save