VSCode after the last update now knows how to automatically add imports. However it adds using relative paths - any idea if that is somehow configurable?
From the main menu, go to File > Preferences > Settings, and click on the “Open Settings (JSON)” icon shown below. Add a section, “terminal. integrated.
The easiest way to reset VS Code back to the default settings is to clear your user settings.json file. You can open the settings.json file with the Preferences: Open Settings (JSON) command in the Command Palette (Ctrl+Shift+P).
It is configurable if you are using VS Code 1.24 and TypeScript >= 2.9.
From the release notes,
Preferences for auto imports and generated code
You can now explicitly specify the quote and path styles that VS Code uses for auto imports and other generated JavaScript and TypeScript code.
[...]
The
javascript.preferences.importModuleSpecifier
andtypescript.preferences.importModuleSpecifier
settings specify the type of path to use for imports.Valid values are:
"relative"
to the file location."non-relative"
based on thebaseUrl
configured in yourjsconfig.json
/tsconfig.json
."auto"
to infer the shortest path type.These new preferences require TypeScript 2.9+.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With