官术网_书友最值得收藏!

Extension filters

In this topic, we will discuss some commands to filter extensions in VS Code.

View commands to filter extensions

VS Code offers various commands to filter extensions. You can open the Commands context menu by hitting the from the Extensions bar that displays the list of commands to further filter extensions, as shown in the following screenshot:

Figure 2.5 – Context menu showing the different commands for extensions

Each option is self-explanatory and shows extensions based on different options. They allow you to check for extension updates, disable the autoupdating of extensions, install any custom extensions from a VSIX file, or disable all installed extensions.

Extension identifiers

VS Code also provides lot of identifiers that you can type in the Search Extensions textbox and find or filter the extension based on the identifier type. To list all of the identifiers, you can type @ and it will give you options to select from and filter extensions accordingly:

Figure 2.6 – Using extension identifiers

Here are some of the most commonly used ones:

  • @id: If you know the ID of the extension, then you can use the @id:{extension_code} to add the C/C++ extension type, such as @id: ms-vscode.cpptools.
  • @builtin: Shows out-of-the-box extensions that come with VS Code.
  • @sort: Sorts extensions based on their name, ratings, and installs. For example, to sort C++ extensions based on their name, you can type C++ @sort:name. You can also sort them based on their rating or installs by running the C++ @sort:rating and C++ @sort:installs commands respectively.
  • @recommended: Shows recommended extensions.
  • @enabled: Shows a list of enabled extensions.
  • @disabled: Shows a list of disabled extensions.
  • @installed: Shows a list of installed extensions.
  • @tag: Search for extensions with tags. For example, @tag:Microsoft will search for all of the extensions that are tagged with Microsoft.
  • @outdated: Shows a list of outdated extensions.

You can also combine multiple extensions to filter or refine your search for more accurate searching. For example, to search enabled extensions with category formatters, we can type @enabled @category:formatters.

Filtering extensions using categories

Extensions can also be filtered with categories and tags. Categories and tags are used to describe the features of the extension and then you can use the given syntax to filter out extensions based on the categories or tags assigned to them.

To filter extensions based on categories, you can type @category: in the extension bar and filter it out based on the supported categories shown in the following screenshot:

Figure 2.7 – Using the category filter

Similarly, you can also use @tag: to filter out extensions based on their tag. For example, you can filter out the extensions tagged to Microsoft, as shown in the following screenshot:

Figure 2.8 – Using the tag filter

Unlike categories, when searching with @tag:, we won't get any IntelliSense extensions, and you need to search the marketplace in order to know which tags are helpful.

Creating a list for recommended extensions

When working in a team, we sometimes need to share a list of recommended extensions with the other members of the team. There might also be the case where a lead developer adds certain extensions that are essential for a project and wants to share those with the team. One option is to compile the list of extensions and distribute it to the team so they can install them on their own machines. Another way of doing this is to create an extension list and share it with your team.

To create a list of recommended extensions, open the Command Palette by hitting F1 and then type Extensions: Configure Recommended Extensions (Workspace). This command creates a new extensions.json file that will reside in the .vscode folder. You can open this file and add the recommended extensions by adding the following snippet:

{

  "recommendations": [

    "ms-kubernetes-tools.vscode-kubernetes-tools",

    "azuredevspaces.azds"

  ]

}

Here is the list of default paths in which the .vscode folder resides for each platform:

  • Windows: %USERPROFILE%\.vscode\extensions
  • Linux: ~/.vscode/extensions
  • macOS: ~/.vscode/extensions

The default location for extensions can be changed by running the following command:

code --extensions-dir <dir>

The following example sets the default extensions directory to the vscodeextensions folder in the C drive:

code --extensions-dir c:\vscodeextensions

Each extension should be added by providing its extensions code. You can then share this list with any member in your team who can place it under the .vscode folder. Finally, once the VS Code opens, it will show users the recommended extensions, which can be installed right away:

Figure 2.9 – List of recommended extensions

This is one of the best features when we are working as a team. Every team of developers can build their own set of recommended lists of extensions and share with other team members so that they can use it.

主站蜘蛛池模板: 神木县| 咸丰县| 南汇区| 高碑店市| 石屏县| 石城县| 宝兴县| 牡丹江市| 射洪县| 鹤庆县| 星座| 兴和县| 金山区| 吴江市| 安远县| 东源县| 沅陵县| 江门市| 巴塘县| 武宣县| 定陶县| 哈巴河县| 宕昌县| 东乡族自治县| 娄烦县| 体育| 云南省| 敦煌市| 行唐县| 永川市| 萍乡市| 冀州市| 东方市| 壶关县| 那坡县| 临江市| 吕梁市| 合阳县| 喀喇沁旗| 德令哈市| 静海县|