From 69e3fd7cc03058be2998083a2afc9d1e819574aa Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 27 Sep 2022 11:37:19 +0200 Subject: [PATCH] fix handleTypeScriptDependenciesOf --- apps/remix-ide/src/app/editor/editor.js | 3 +-- apps/remix-ide/src/app/files/fileManager.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/remix-ide/src/app/editor/editor.js b/apps/remix-ide/src/app/editor/editor.js index 99e921d63b..23601242f3 100644 --- a/apps/remix-ide/src/app/editor/editor.js +++ b/apps/remix-ide/src/app/editor/editor.js @@ -5,7 +5,6 @@ import { EditorUI } from '@remix-ui/editor' // eslint-disable-line import { Plugin } from '@remixproject/engine' import * as packageJson from '../../../../../package.json' import { PluginViewWrapper } from '@remix-ui/helper' -import { exists } from 'fs' const EventManager = require('../../lib/events') @@ -199,7 +198,7 @@ class Editor extends Plugin { return ext && this.modes[ext] ? this.modes[ext] : this.modes.txt } - async handleTypeScriptDependenciesOf (path, content, readFile) { + async handleTypeScriptDependenciesOf (path, content, readFile, exists) { if (path.endsWith('.ts')) { // extract the import, resolve their content // and add the imported files to Monaco through the `addModel` diff --git a/apps/remix-ide/src/app/files/fileManager.ts b/apps/remix-ide/src/app/files/fileManager.ts index 49135860bf..847d6f3f02 100644 --- a/apps/remix-ide/src/app/files/fileManager.ts +++ b/apps/remix-ide/src/app/files/fileManager.ts @@ -635,7 +635,7 @@ class FileManager extends Plugin { try { // This make sure dependencies are loaded in the editor context. // This ensure monaco is aware of deps artifacts, so it can provide basic features like "go to" symbols. - await this.editor.handleTypeScriptDependenciesOf(file, content, path => this.readFile(path)) + await this.editor.handleTypeScriptDependenciesOf(file, content, path => this.readFile(path), path => this.exists(path)) } catch (e) { console.log('unable to handle TypeScript dependencies of', file) }