Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VSCODE Javascript ----how to Implicit import library

I want to hide "import" when referencing the library, that is, local/global import, and use the contents of the library normally Can it be achieved, or is it already achieved?

I use these codes in a plug-in loader, so I don’t need to import it. It’s just a tool for prompting to view annotations.

I am using VSCODE and its built-in JavaScript

example:

import { mc } from "./Libary/Game/Player";

mc.runcmd('kill u m')

want to use:

mc.runcmd('kill u m')

And you can also see comments and function types, etc.

like image 576
moxicat Avatar asked Aug 10 '26 13:08

moxicat


1 Answers

I don't think this is achievable at the moment nor do I think it should be, because:

  1. The imports are related to how modules in javascript language works

  2. It may cause a lot of problems.

for example, imagine that you have two games like Game1 and Game2 which both of them has a mc method:

import { mc } from "./Libary/Game1/Player";
import { mc } from "./Libary/Game2/Player";

How should VScode decide what to import here?

but when you're using normal javascript imports it's just a matter of changing name imports like this:

import { mc as mc1 } from "./Libary/Game1/Player";
import { mc as mc2 } from "./Libary/Game2/Player";
like image 149
Taghi Khavari Avatar answered Aug 12 '26 08:08

Taghi Khavari



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!