简体   繁体   中英

How to jump to imported JavaScript file in IntelliJ/WebStorm

Within a WebWorker JavaScript file the following are some imports for scripts in the same local directory:

importScripts("base64.js")
importScripts("cider_utils-no-exports.js")

I had expected to be able to jump to them by putting cursor within one of the filenames and hitting CMD-B . But that gave only a warning "Cannot find declaration to go to":

在此处输入图像描述

I also tried "Goto file" But that brings up a dialog with an unrelated search. So what is the way to jump to the script?

This would require treating this method in a special way (like it's done for require() calls, for example). This feature is not currently supported, please vote for WEB-13048 if you miss it.

For now, I can only suggest injecting File reference language into function argument, like

// language=file-reference
  importScripts('foo.js');

this should help

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM