简体   繁体   English

如何手动更改文件夹在 Visual Studio Code Explorer 中的列出顺序?

[英]How can I manually change the order that folders are listed in Visual Studio Code Explorer?

I would like to manually change the order that folders are listed, in VSCode.我想手动更改在 VSCode 中列出文件夹的顺序。 For example, I want to order the sub-folders in my ./components folder like this:例如,我想像这样订购./components文件夹中的子文件夹:

EXPLORER探索者

  • components成分
    • layout布局
    • ui用户界面
    • utils实用程序
    • other-folder其他文件夹
    • another-folder另一个文件夹

The bold folders should be on the top, with the rest listed in alphabetical order.粗体文件夹应位于顶部,rest 按字母顺序列出。

By default, VSCode lists folders in alphabetical order.默认情况下,VSCode 按字母顺序列出文件夹。 Is there a way to change that?有没有办法改变它?

YES.是的。 It is possible by using a 'Favorite' extension可以使用“收藏夹”扩展名

Organizing folder and files is possible by extensions which are named favorites .可以通过名为favorites扩展来组织文件夹和文件。 Indeed personal order is possible in one of them, but I don't know if it is the one you would prefer.确实可以在其中之一中进行个人订购,但我不知道它是否是您喜欢的一种。 Here is the overview:这是概述:

Favorites by 'kdcro101' 'kdcro101' 的最爱
https://marketplace.visualstudio.com/items?itemName=kdcro101.favorites https://marketplace.visualstudio.com/items?itemName=kdcro101.favorites

It is the most popular favorites extension as I know.据我所知,它是最受欢迎的收藏夹扩展。

You can add files and folders to the favorite area.您可以将文件和文件夹添加到收藏夹区域。 Special: you can create Favorites Folders to additional organize the folders and files in the favorites.特别:您可以创建Favorites Folders来额外组织Favorites Folders中的文件夹和文件。

It is really intuitive as it has a very good UI.它非常直观,因为它有一个非常好的用户界面。 Favorites are project based organized.收藏夹是基于项目的组织。 So it is really easy to use and I use it myself in big projects.所以它真的很容易使用,我自己在大项目中使用它。

What maybe is a disadvantage to your demands is: favorites are not to organize in your personal order.可能对您的要求不利的是:收藏夹不是按照您的个人顺序组织的。 Only traditional az|za is possible.只有传统的az|za是可能的。 But as you just add selected files/folders to the favorites there is a really good reduced overview and files can be accessed fast.但是,当您只是将选定的文件/文件夹添加到收藏夹时,可以减少概览并且可以快速访问文件。

Favorites Manager by 'Oleg Shilo' 'Oleg Shilo' 的收藏夹管理器
https://marketplace.visualstudio.com/items?itemName=oleg-shilo.favorites https://marketplace.visualstudio.com/items?itemName=oleg-shilo.favorites

It is a relative new extension.这是一个相对较新的扩展。 With this extension it indeed is possible to organize favorite items (folder/files) to your personal demands.使用此扩展程序确实可以根据您的个人需求组织最喜欢的项目(文件夹/文件)。

The extension is global organized.扩展是全局组织的。 That means that all favorites can be accessed in every project.这意味着可以在每个项目中访问所有收藏夹。 But organizing folders/files specific to single projects is able in separated lists for every project.但是,可以在每个项目的单独列表中组织特定于单个项目的文件夹/文件。 Organizing such a list is best possible text base and very intuitive this way ... as GUI/UI could be (little) better at all.组织这样的列表是最好的文本基础,并且非常直观……因为 GUI/UI 可能(一点)更好。

Note: if you add folder to the favorites you should activate Show Folder Files in the settings.注意:如果您将文件夹添加到收藏夹,您应该在设置中激活Show Folder Files This is deactivated by default as there is noticed a hint to a 'bug' for VS Code.这在默认情况下处于停用状态,因为注意到 VS Code 的“错误”提示。 But to me it worked yet.但对我来说它仍然有效。 If not activated VS Code opens every folder in 'project folder view'.如果未激活,VS Code 将在“项目文件夹视图”中打开每个文件夹。


As I think that are the two extension which match your demands best you should have a look to...因为我认为这是最符合您需求的两个扩展,您应该看看......

Favorites panel by 'Sabitov Vladimir' 'Sabitov Vladimir' 的收藏夹面板
https://marketplace.visualstudio.com/items?itemName=sabitovvt.favorites-panel https://marketplace.visualstudio.com/items?itemName=sabitovvt.favorites-panel

Additional to folders and files you are able to add a lot more: applications, urls, vs code commands.除了文件夹和文件之外,您还可以添加更多:应用程序、网址、vs 代码命令。

I used it sometimes but as the settings are complex you need to do it in the settings.json direct.我有时会使用它,但由于设置很复杂,您需要直接在settings.json中进行settings.json At the end it has been too much work to maintain it but when it is used it is an unbelievable win of speed working in projects.最后,维护它的工作太多了,但是当它被使用时,它是项目中速度工作的令人难以置信的胜利。

favorites by 'Howard.Zuo' 'Howard.Zuo' 的最爱
https://marketplace.visualstudio.com/items?itemName=howardzuo.vscode-favorites https://marketplace.visualstudio.com/items?itemName=howardzuo.vscode-favorites

It is a very simple extension which works very similar as 'Favorites** by kdcro101', - just without favorite groups ... what make it really simple, intuitive and fast to use it.这是一个非常简单的扩展,其工作方式与 kdcro101 的“收藏夹**”非常相似,只是没有最喜欢的组……是什么让它变得非常简单、直观和快速使用。 So it is nearly as popular as the other one.所以它几乎和另一个一样受欢迎。 To me the missing of the favorite groups makes it very restrictive to larger projects.对我来说,缺少最喜欢的组使得它对大型项目的限制很大。 But it is a really nice and fast solution if projects are limitated which feels really good when using it.但如果项目受到限制,它是一个非常好的和快速的解决方案,使用它时感觉非常好。

According to VSC doc " User and Workspace Settings " the only options for display order of files and folders in settings.json are:根据 VSC 文档“用户和工作区设置”, settings.json中文件和文件夹显示顺序的唯一选项是:

  // Controls sorting order of files and folders in the explorer.
  //  - default: Files and folders are sorted by their names, in alphabetical order. Folders are displayed before files.
  //  - mixed: Files and folders are sorted by their names, in alphabetical order. Files are interwoven with folders.
  //  - filesFirst: Files and folders are sorted by their names, in alphabetical order. Files are displayed before folders.
  //  - type: Files and folders are sorted by their extensions, in alphabetical order. Folders are displayed before files.
  //  - modified: Files and folders are sorted by last modified date, in descending order. Folders are displayed before files.
  "explorer.sortOrder": "default",

Perhaps there are VSC extensions out there which can help you, eg Parallel Folders by Alex Crome, didn't try that one myself yet.也许有 VSC 扩展可以帮助您,例如 Alex Crome 的Parallel Folders ,我自己还没有尝试过。

You can save your current workspace to *.code-workspace file and manually change the order.您可以将当前工作空间保存到*.code-workspace文件并手动更改顺序。

VS 代码文件设置 VS Code 工作区文件夹设置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM