Udostępnij za pośrednictwem


Code Snippet Picker

The Visual Studio Code Editor provides a Code Snippet Picker that allows you, in a few mouse clicks, to insert ready-made blocks of code into the active document.

The procedure to display the Code Snippet Picker varies according to the language you are using.

  • Visual Basic - Right-click at the desired location in the Code Editor to display the Shortcut menu, and select Insert Snippet.

  • Visual C# - Right-click at the desired location in the Code Editor to display the Shortcut menu, and click Insert Snippet or Surround With.

  • Visual C++ - The Code Snippet Picker is not available.

  • Visual F# - The Code Snippet Picker is not available.

  • JScript -- Right-click at the desired location in the Code Editor to display the Shortcut menu, and click Insert Snippet or Surround With.

  • XML - Right-click at the desired location in the Code Editor to display the Shortcut menu, and click Insert Snippet or Surround With.

  • HTML - Right-click at the desired location in the Code Editor to display the Shortcut menu, and click Insert Snippet or Surround With.

  • SQL - Right-click at the desired location in the Code Editor to display the Shortcut menu, and click Insert Snippet.

In most Visual Studio development languages, you can use the Code Snippets Manager to add folders to the Folder List that the Code Snippet Picker scans for XML snippet files. You can also create your own snippets to add to the list. For more information, see Creating Code Snippets.

  • Item Name
    An editable text field that displays the name of the item selected in the Item List. To perform an incremental search for the item you want, begin typing its name in this field. Continue adding letters until the desired item is selected in the Item List.

  • Item List
    A list of code snippets available for insertion, or a list of folders containing code snippets. To insert a snippet or expand a folder, select the item you want and press Enter.

See Also

Tasks

How to: Modify Existing Snippets

How to: Debug Code in the Editor

How to: Use Surround-with Code Snippets

Reference

Code Snippets Manager

Concepts

Visual Basic IntelliSense Code Snippets

Editor Convenience Commands and Features

Other Resources

How to: Insert Snippets Into Your Code

Setting Bookmarks in Code