组织项目中所有文件的导入 [英] Organise imports for all files in project

查看:44
本文介绍了组织项目中所有文件的导入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

VSCode 包含一个用于组织导入的设置,通过操作菜单或在每个文件保存时自动进行.执行此命令会删除所有未使用的导入,并按字母顺序对导入重新排序,并按包导入和本地/相对导入分组.

VSCode includes a setting for organising imports, either via the action menu or automatically on every file save. Executing this command removes any unused imports and reorders imports alphabetically and grouped by package imports followed by local/relative imports.

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

教程此处.

有没有什么方法可以在不单独打开和保存每个文件的情况下将其应用于项目中的所有文件?

Is there any way to apply this to all files in a project without opening and saving each file separately?

推荐答案

我认为有一个扩展程序与您正在寻找的内容类似

I think there is an extension that resembles what you're looking for

https://marketplace.visualstudio.com/items?itemName=bierner.folder-source-actions

您只需按照扩展页面上的说明组织从根文件夹导入的内容.

You just have to organize the imports from the root folder as explained on the extension page.

这篇关于组织项目中所有文件的导入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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