TypeScript 2.8 中有一个新功能,可以让您“组织进口":
https://devblogs.microsoft.com/typescript/announcing-typescript-2-8-2/#organize-imports https://devblogs.microsoft.com/typescript/announcing-typescript-2-8-2/#organize-imports
基本上它执行以下操作:
The page shows that the feature can be invoked in Visual Studio Code with the Shift+Alt+O keyboard shortcut. Does anybody know how this feature can be invoked in Visual Studio (2017)?
UPDATE:
从版本15.8以后的 Visual Studio 2017 通过将未使用的导入变灰来突出显示它们。
Visual Studio Code 在去年 4 月发布了一项新功能,该功能可以组织进口保存时。您可以尝试更新当前的settings.json
进行以下更改:
"editor.formatOnSave": true,
"[typescript]": {
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
}
希望这对您有所帮助并祝您好运!
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)