Skip to content

Commit

Permalink
Merge pull request microsoft#7924 from microsoft/user-snippets
Browse files Browse the repository at this point in the history
Fix snippets command
  • Loading branch information
ntrogh authored Jan 8, 2025
2 parents 4c4d87c + 1f9930b commit 655d4d5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions docs/editor/userdefinedsnippets.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ If you find an extension you want to use, install it, then restart VS Code and t

## Create your own snippets

You can easily define your own snippets without any extension. To create or edit your own snippets, select **Configure User Snippets** under **File** > **Preferences**, and then select the language (by [language identifier](/docs/languages/identifiers.md)) for which the snippets should appear, or the **New Global Snippets file** option if they should appear for all languages. VS Code manages the creation and refreshing of the underlying snippets file(s) for you.
You can easily define your own snippets without any extension. To create or edit your own snippets, select **Configure Snippets** under **File** > **Preferences**, and then select the language (by [language identifier](/docs/languages/identifiers.md)) for which the snippets should appear, or the **New Global Snippets file** option if they should appear for all languages. VS Code manages the creation and refreshing of the underlying snippets file(s) for you.

![snippet dropdown](images/userdefinedsnippets/snippet-dropdown.png)

Expand Down Expand Up @@ -88,15 +88,15 @@ Every snippet is scoped to one, several, or all ("global") languages based on wh
1. a **language** snippet file
2. a **global** snippet file

Single-language user-defined snippets are defined in a specific language's snippet file (for example `javascript.json`), which you can access by language identifier through **Snippets: Configure User Snippets**. A snippet is only accessible when editing the language for which it is defined.
Single-language user-defined snippets are defined in a specific language's snippet file (for example `javascript.json`), which you can access by language identifier through **Snippets: Configure Snippets**. A snippet is only accessible when editing the language for which it is defined.

Multi-language and global user-defined snippets are all defined in "global" snippet files (JSON with the file suffix `.code-snippets`), which is also accessible through **Snippets: Configure User Snippets**. In a global snippets file, a snippet definition may have an additional `scope` property that takes one or more [language identifiers](/docs/languages/identifiers.md), which makes the snippet available only for those specified languages. If no `scope` property is given, then the global snippet is available in **all** languages.
Multi-language and global user-defined snippets are all defined in "global" snippet files (JSON with the file suffix `.code-snippets`), which is also accessible through **Snippets: Configure Snippets**. In a global snippets file, a snippet definition may have an additional `scope` property that takes one or more [language identifiers](/docs/languages/identifiers.md), which makes the snippet available only for those specified languages. If no `scope` property is given, then the global snippet is available in **all** languages.

Most user-defined snippets are scoped to a single language, and so are defined in a language-specific snippet file.

### Project snippet scope

You can also have a global snippets file (JSON with file suffix `.code-snippets`) scoped to your project. Project-folder snippets are created with the **New Snippets file for '<folder-name>'...** option in the **Snippets: Configure User Snippets** dropdown menu and are located at the root of the project in a `.vscode` folder. Project snippet files are useful for sharing snippets with all users working in that project. Project-folder snippets are similar to global snippets and can be scoped to specific languages through the `scope` property.
You can also have a global snippets file (JSON with file suffix `.code-snippets`) scoped to your project. Project-folder snippets are created with the **New Snippets file for '<folder-name>'...** option in the **Snippets: Configure Snippets** dropdown menu and are located at the root of the project in a `.vscode` folder. Project snippet files are useful for sharing snippets with all users working in that project. Project-folder snippets are similar to global snippets and can be scoped to specific languages through the `scope` property.

## Snippet syntax

Expand Down
2 changes: 1 addition & 1 deletion docs/getstarted/tips-and-tricks.md
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ See IntelliSense for your `package.json` file.

### Create custom snippets

**File** > **Preferences** > **Configure User Snippets**, select the language, and create a snippet.
**File** > **Preferences** > **Configure Snippets**, select the language, and create a snippet.

```json
"create component": {
Expand Down
2 changes: 1 addition & 1 deletion docs/python/tutorial-flask.md
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ You can run the app at this point, but because you haven't made use of the base
Because the three pages you create in the next section extend `layout.html`, it saves time to create a **code snippet** to initialize a new template file with the appropriate reference to the base template. A code snippet provides a consistent piece of code from a single source, which avoids errors that can creep in when using copy-paste from existing code.
1. In VS Code, select **File** > **Preferences** > **Configure User Snippets**.
1. In VS Code, select **File** > **Preferences** > **Configure Snippets**.
1. In the list that appears, select **html**. The option may appear as "html.json" in the **Existing Snippets** section of the list if you've created snippets previously.
Expand Down

0 comments on commit 655d4d5

Please sign in to comment.