I'm import
ing various items from a file in vscode. The module exists, but seems to be missing some of the items. I can see the module definitely exists on the filesystem, and vscode even shows me the file name:
I'd like to open the file directly from where it's imported, using the same logic VScode itself uses to import the module. I would have thought right clicking would allow me to do this ('Go to implementation') sounds like it would open the file, but it doesn't do anything.
Obviously I could open a shell and start code
pointing to that file, but that's a workaround rather than an actual solution.
How do I open a file being imported in vscode?
There are multiple ways.
I like the last shortcut. It's easy and reachable.
There is a chance that the module you are viewing is a commonJS module. You could create or add the following settings in .jsonconfig
file.
Set/add entry "module": "CommonJS" or set "module": "Node16"
{
"compilerOptions": {
"baseUrl": "src",
"module": "Node16"
},
"include": [
"src"
, "public/src" ]
}
OR
{
"compilerOptions": {
"baseUrl": "src",
"module": "CommonJS"
},
"include": [
"src"
, "public/src" ]
}
Hope this helps
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.