Replies: 2 comments 8 replies
-
There's no way to do this currently. We could add support, either via a config option or using the Lua API, but the reason it's not currently supported is that the import all function is pretty dumb. If you add multiple missing imports from the same file, they'll each get a separate import statement: // starting point
const user: User = { name: "Jose" };
const role: Role = "manager"; // current behavior after importing all
import { Role, User } from "types/user.types";
const user: User = { name: "Jose" };
const role: Role = "manager"; // behavior without sorting imports after importing all
import { User } from "types/user.types";
import { Role } from "types/user.types";
const user: User = { name: "Jose" };
const role: Role = "manager"; This is pretty annoying, since (to my knowledge) there's no way to automatically merge these statements without running an |
Beta Was this translation helpful? Give feedback.
-
Well, recently typescript-language-server added support for it: typescript-language-server/typescript-language-server#318, but not supported yet in this plugin: #100. I think |
Beta Was this translation helpful? Give feedback.
-
Hello everyone,
I work in a big project and usually edit files that already contain many imports.
Import all missing and import current are great tools that I use all the time but they force a sort of the imports that doesn't benefit me as it will create changes in the file that were not intended. Suddenly a couple line change turn into a dozen changes because the imports get shuffle.
Is there a way to import all and import current without sorting the existing import? I checked the readme and options but I didn't see an option.
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions