Insert GUID

A simple command extension for Visual Studio Code to insert globally unique identifiers (GUIDs) into the Code text editor in a variety of formats.

This provides the same useful formats as Create GUID that ships with Visual Studio, but without specific language syntaxes for some formats and without unwanted line feeds. Currently, formats supported include:
- Simple string:
11d4dc2e-375a-4b89-9ad4-aa30105385aa
- Registry string:
{11d4dc2e-375a-4b89-9ad4-aa30105385aa}
- C structure:
static const struct GUID __NAME__ = {0x11d4dc2e, 0x375a, 0x4b89, {0x9a, 0xd4, 0xaa, 0x30, 0x10, 0x53, 0x85, 0xaa}};
- C macro:
DEFINE_GUID(__NAME__, {x11d4dc2e, 0x375a, 0x4b89, 0x9a, 0xd4, 0xaa, 0x30, 0x10, 0x53, 0x85, 0xaa);
- Unformatted string:
11d4dc2e375a4b899ad4aa30105385aa
- C structure only:
{0x11d4dc2e, 0x375a, 0x4b89, {0x9a, 0xd4, 0xaa, 0x30, 0x10, 0x53, 0x85, 0xaa}}
The token __NAME__ is easy to replace by double clicking to select every character, unlike <<name>> used in the Create GUID tool.
Installation
You can easily search for and install extensions directly within Code.
- Open the command palette: Ctrl+Shift+P (Cmd+Shift+P on Mac)
- Type: Install Extension
- Type: Insert GUID
- Press Enter or click the download button to install
Code also makes it easy to update extensions:
- Open the command palette: Ctrl+Shift+P
- Type: Show Outdated Extensions
- Press Enter or click the download button to install updates
Using
Whenever you want to insert a new GUID at the cursor or replace the currently selected text:
- Open the command palette: Ctrl+Shift+P (Cmd+Shift+P on Mac)
- Type: Insert GUID
- Press Enter and select the desired format by typing the number or using the arrow keys.
You can also skip right to step 3 using the default keyboard binding, Ctrl+Shift+[. This is more easily remembered as Ctrl+{ as with the curly brace used in the registry string format, or as Cmd+{ on the Mac.
Options
You can set different configuration options to control the format of GUIDs that can be inserted.
- insertGuid.showLowercase: Show lowercase GUIDs (with and without braces) when presenting possible GUID formats to insert. The default is
true .
- insertGuid.showUppercase: Show uppercase GUIDs (with and without braces) when presenting possible GUID formats to insert. The default is
false .
- insertGuid.showCodeSnippets: Show code snippets for C++ when presenting possible GUID formats to insert. The default is
true .
- insertGuid.pasteAutomatically: When not empty, paste the GUID in a specified format without showing selection menu. The default is "".
License
The extension and source are licensed under the MIT license.
| |