使用Visual Studio Code在批量上删除AngularJS项目中未使用的进口



我的任务是清洁我们的angularjs项目以删除未使用的导入和变量。我使用VS代码,通过Typescript Hero Extension,我可以一次执行一个文件。但是,是否有一种方法可以修复项目中的所有打字稿?

对于Visual Studio代码,您只需打开您的偏好设置,然后将以下内容添加到您的settings.json

"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
  "source.organizeImports": true
}

您也可以在每种语言上启用/禁用使用以下setting.json

"editor.formatOnSave": true,
"[typescript]": {
    "editor.codeActionsOnSave": {
        "source.organizeImports": true
    }
},

此新功能自去年4月于2018年发行。希望这会有所帮助!

最新更新