Code Monkey home page Code Monkey logo

vscode-guid's Introduction

Insert GUID

Visual Studio Marketplace version

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

Insert GUID

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:

  1. Simple string: 11d4dc2e-375a-4b89-9ad4-aa30105385aa
  2. Registry string: {11d4dc2e-375a-4b89-9ad4-aa30105385aa}
  3. C structure: static const struct GUID __NAME__ = {0x11d4dc2e, 0x375a, 0x4b89, {0x9a, 0xd4, 0xaa, 0x30, 0x10, 0x53, 0x85, 0xaa}};
  4. C macro: DEFINE_GUID(__NAME__, {x11d4dc2e, 0x375a, 0x4b89, 0x9a, 0xd4, 0xaa, 0x30, 0x10, 0x53, 0x85, 0xaa);
  5. Unformatted string: 11d4dc2e375a4b899ad4aa30105385aa
  6. 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.

  1. Open the command palette: Ctrl+Shift+P (Cmd+Shift+P on Mac)
  2. Type: Install Extension
  3. Type: Insert GUID
  4. Press Enter or click the download button to install

Code also makes it easy to update extensions:

  1. Open the command palette: Ctrl+Shift+P
  2. Type: Show Outdated Extensions
  3. 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:

  1. Open the command palette: Ctrl+Shift+P (Cmd+Shift+P on Mac)
  2. Type: Insert GUID
  3. 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.

vscode-guid's People

Contributors

101100 avatar dependabot[bot] avatar heaths avatar psethwick avatar rollie42 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vscode-guid's Issues

Feature Request: Generate GUID for each cursor

An awesome feature would be the ability to hook into multiple cursors and generate a unique GUID for each cursor on the screen ๐Ÿ‘ If you are open for PR's I could have a look at it. Thanks for a nifty extension.

Request: Additional GUID Formats

I would be nice to support the format that fits in C structure definition of GUID with uppercase values.

GUID:
UINT32 Data1;
UINT16 Data2;
UINT16 Data3;
UINT8 Data4[8];

Four hexadecimal values enclosed in braces, where the fourth value is a subset of eight hexadecimal values that is also enclosed in braces: {0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} (X)

Support devcontainers in Windows

Devcontainers in this repo are meant primarily to support GitHub Codespaces; however, since Node.JS is often installed system-wide, it would be beneficial on some machines to support devcontainers on Windows. Primarily, .gitattributes needs to be updated to use eol=lf, and should probably update .editorconfig and .vscode/settings.json as well.

See https://code.visualstudio.com/docs/remote/troubleshooting#_resolving-git-line-ending-issues-in-containers-resulting-in-many-modified-files for more info.

Without this, npm run compile fails, specifically the compile:res task.

Feature request: C++-struct-formatted GUID without the type/macros

For modern C++, initializer lists are a handy way to put GUIDs in code, e.g. for a raw GUID:

GUID myGUID {0xfee9d1ce, 0x5baa, 0x4159, {0x91, 0x2e, 0x5f, 0xad, 0x39, 0x3f, 0x0e, 0x5c}

or when using C++/WinRT (e.g. when using the Windows App SDK):

winrt::guid myGUID {0xfee9d1ce, 0x5baa, 0x4159, {0x91, 0x2e, 0x5f, 0xad, 0x39, 0x3f, 0x0e, 0x5c};

This is essentially the same as option 3, just with everything up to the { deleted/replaced:

static const struct GUID __NAME__ = {0xfee9d1ce, 0x5baa, 0x4159, {0x91, 0x2e, 0x5f, 0xad, 0x39, 0x3f, 0x0e, 0x5c}};

I suggest adding an option that's the right hand side of #3's assignment for the most flexibility

Update README and CHANGELOG for 1.6.0

Create a 1.6.1 that updates the README and CHANGELOG, with the only entry for the CHANGELOG for 1.6.1 being that I did that. ๐Ÿคฆโ€โ™‚๏ธ

Insert GUID in all selections

Hi,

It would be great if extension could replace all selected GUIDs instead of only first one.

Current behaviour:
When chosen insert GUID and had multiple selections, GUID is inserted only in place of first selection.

Wished behaviour:
When had multiple selections, GUID should insert in all of them.

This is desirable when had multiple same GUID, which i want to replace by new one.
Example workflow: select one GUID, CTRL+D multiple times to select more and then insert GUID.

Only Uppercase GUID

I can't get only uppercase GUIDs when setting
insertGuid.showLowercase = false and insertGuid.showUppercase = true

Support custom formats

Hello.

It would be nice if I could set up a custom format so that I can insert something like this directly:

Guid.Parse("2470d04f-d482-4964-ac15-443a54a620f0")

This could be defined in settings as a list of strings with a placeholder that will be replaced via the GUID.

{
  "customFormats": [
    "Guid.Parse(\"__GENERATED_GUID__\")"
  ]
}

Include option to insert GUID in uppercase

Would you accept a PR to add an option to include the GUID in uppercase? I would do that for both the bare and brace formats, so the menu would be:

6b9937c1-f090-4a33-bdd6-f5e6ef54c41b
6B9937C1-F090-4A33-BDD6-F5E6EF54C41B
{6b9937c1-f090-4a33-bdd6-f5e6ef54c41b}
{6B9937C1-F090-4A33-BDD6-F5E6EF54C41B}
static const struct GUID __NAME__ = {0x6b9937c1, 0xf090, 0x4a33, {0xbd, 0xd6, 0xf5, 0xe6, 0xef...
DEFINE_GUID(__NAME__, 0x6b9937c1, 0xf090, 0x4a33, 0xbd, 0xd6, 0xf5, 0xe6, 0xef, 0x54, 0xc4, 0x1b);

Migrate to GitHub Actions

Reduce external dependencies and migrate to GitHub Actions. Be sure to update the badge, which hopefully won't expire like it does for Azure Pipelines.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.