Merge branch 'master' into terminallog

pull/5370/head
Aniket 3 years ago committed by GitHub
commit 6c277036b7
  1. 2
      apps/remix-ide/src/app/files/fileManager.ts
  2. 17
      apps/remix-ide/src/app/files/remixDProvider.js

@ -752,7 +752,7 @@ class FileManager extends Plugin {
if (provider) {
try{
const content = await provider.get(currentFile)
this.editor.setText(content)
if(content) this.editor.setText(content)
}catch(error){
console.log(error)
}

@ -98,20 +98,19 @@ module.exports = class RemixDProvider extends FileProvider {
})
}
get (path, cb) {
async get (path, cb) {
if (!this._isReady) return cb && cb('provider not ready')
var unprefixedpath = this.removePrefix(path)
this._appManager.call('remixd', 'get', { path: unprefixedpath })
.then((file) => {
try{
const file = await this._appManager.call('remixd', 'get', { path: unprefixedpath })
this.filesContent[path] = file.content
if (file.readonly) { this._readOnlyFiles[path] = 1 }
cb(null, file.content)
}).catch((error) => {
if(cb) cb(null, file.content)
return file.content
} catch(error) {
if (error) console.log(error)
// display the last known content.
// TODO should perhaps better warn the user that the file is not synced.
return cb(null, this.filesContent[path])
})
if(cb) return cb(null, this.filesContent[path])
}
}
async set (path, content, cb) {

Loading…
Cancel
Save