如何调用“组织进口". Visual Studio中的TypeScript功能? [英] How to invoke the "Organize imports" TypeScript feature in Visual Studio?

查看:98
本文介绍了如何调用“组织进口". Visual Studio中的TypeScript功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

TypeScript 2.8中有一项新功能,可让您"组织导入":

There is a new feature in TypeScript 2.8 that lets you "Organize imports": https://blogs.msdn.microsoft.com/typescript/2018/03/27/announcing-typescript-2-8/#organize-imports

基本上,它会执行以下操作:

Basically it does the following:

  • 删除不必要的导入语句
  • 对导入语句进行排序

页面显示可以使用 Shift + Alt + O 键盘快捷键在Visual Studio Code中调用该功能.有人知道如何在Visual Studio(2017)中调用此功能吗?

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)?

更新:

从版本 15.8 开始,Visual Studio 2017通过将未使用的导入变灰来突出显示它们.

From version 15.8 onward Visual Studio 2017 highlights unused imports by greying them out.

推荐答案

此功能现已添加到Visual Studio 2017中.

This feature has now been added to Visual Studio 2017.

可以通过以下方式调用它:

One can invoke it the following ways:

  1. Ctrl + R ,然后按 Ctrl + G .
  2. 右键单击代码窗口,然后在上下文菜单中单击Organize Imports.
  1. Pressing Ctrl+R followed by Ctrl+G.
  2. Right-click in the code window and clickOrganize Imports in the context menu.

这篇关于如何调用“组织进口". Visual Studio中的TypeScript功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆