Reputation: 12255
I have some path references set up in tsconfig.json and would like to use those when auto-importing a new reference to a file. Right now, if I have a paths reference like:
"paths": {
"tools/*": [ "../Frontend.Tools/*" ]
}
When I hit Ctrl+space
on a ConfigurationModel
reference Visual Studio will do auto imports like
import { ConfigurationModel } from '../../../Frontend.Tools/configuration';
but what I want is
import { ConfigurationModel } from 'tools/configuration';
How can i make this happen?
Upvotes: 1
Views: 653
Reputation: 12255
There is a setting in Options > Text Editor > JavaScript/TypeScript > Formatting > General
Module Specifier Preference
The top option did what I wanted:
Prefers using a non-relative import only if one is available that has fewer path segments than a relative import
Upvotes: 1