Merge pull request #2948 from ethereum/fix_handleTypeScriptDependenciesOf

fix handleTypeScriptDependenciesOf
pull/2854/head^2
bunsenstraat 2 years ago committed by GitHub
commit 608c77b6f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      apps/remix-ide/src/app/editor/editor.js
  2. 2
      apps/remix-ide/src/app/files/fileManager.ts

@ -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`

@ -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)
}

Loading…
Cancel
Save