don't throw errors on opening tabs for non existing files

bunsenstraat-patch-2
filip mertens 3 years ago
parent 51ef3e526d
commit 9dc90c6a16
  1. 20
      apps/remix-ide/src/app/panels/tab-proxy.js

@ -54,7 +54,7 @@ export class TabProxy extends Plugin {
workspace ? this.removeTab(workspace + '/' + name) : this.removeTab(this.fileManager.mode + '/' + name) workspace ? this.removeTab(workspace + '/' + name) : this.removeTab(this.fileManager.mode + '/' + name)
}) })
fileManager.events.on('currentFileChanged', (file) => { fileManager.events.on('currentFileChanged', async (file) => {
const workspace = this.fileManager.currentWorkspace() const workspace = this.fileManager.currentWorkspace()
if (workspace) { if (workspace) {
@ -64,9 +64,12 @@ export class TabProxy extends Plugin {
this._view.filetabs.activateTab(workspacePath) this._view.filetabs.activateTab(workspacePath)
return return
} }
this.addTab(workspacePath, '', () => { this.addTab(workspacePath, '', async () => {
this.fileManager.open(file) try {
this.event.emit('openFile', file) await this.fileManager.open(file)
this.event.emit('openFile', file)
} catch (e) {
}
}, },
() => { () => {
this.fileManager.closeFile(file) this.fileManager.closeFile(file)
@ -79,9 +82,12 @@ export class TabProxy extends Plugin {
this._view.filetabs.activateTab(path) this._view.filetabs.activateTab(path)
return return
} }
this.addTab(path, '', () => { this.addTab(path, '', async () => {
this.fileManager.open(file) try {
this.event.emit('openFile', file) await this.fileManager.open(file)
this.event.emit('openFile', file)
} catch (e) {
}
}, },
() => { () => {
this.fileManager.closeFile(file) this.fileManager.closeFile(file)

Loading…
Cancel
Save