Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support custom formats #32

Open
szszoke opened this issue May 27, 2020 · 7 comments · May be fixed by #89
Open

Support custom formats #32

szszoke opened this issue May 27, 2020 · 7 comments · May be fixed by #89

Comments

@szszoke
Copy link

szszoke commented May 27, 2020

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__\")"
  ]
}
@heaths
Copy link
Owner

heaths commented May 27, 2020

I've actually been considering a change - hopefully without breaking existing versions (would definitely be a new major version) - that could accommodate this, but instead of just custom formats it would be an array of all formats, to which custom formats could be added or even replace standard formats (empty/undefined array would default to the default list today).

@szszoke
Copy link
Author

szszoke commented May 27, 2020

This sounds really good!

@Miles-Davies-HORIBA
Copy link

This would be really useful for writing WiX code. We like to use all uppercase GUID to be compliant with Windows Installer guidelines (I know WiX will convert but 3.x has issues with GUIDs not containing hyphens it seems)

@heaths
Copy link
Owner

heaths commented Jun 3, 2021

There's already an option to use uppercase GUIDs. WiX - on which I was one of the early devs - was one of the reasons I made this, though I recommend using auto-GUID'ing as much as possible - works when you have an obvious automatic key path or specify a key path in a directory that is calculable at build time. You'll get a stable, consistent GUID and if you ever change directory paths it'll change like it should. You don't want shared components spanning different directories. See https://devblogs.microsoft.com/setup which used to be my blog. There are all kinds of problems that will occur in different scenarios if you share component GUIDs across different file or registry paths.

@Miles-Davies-HORIBA
Copy link

Miles-Davies-HORIBA commented Jun 3, 2021 via email

@merlinz01
Copy link
Contributor

If you want to insert custom formats, version 1.9.0 now supports more specific customizations for the insertGuid.pasteAutomatically format, including newline characters and individual sections of a GUID.

@heaths
Copy link
Owner

heaths commented Feb 9, 2024

And you'll be able to define an array of all desirable formats with PR #89. I've been wanting to do this for a while, and @merlinz01's recent changes in PR #85 pushed me to start on that. I'll have a migration path and will eventually remove those three options. For now, they'll just be deprecated and will only show up if you've overridden them, but my plan is to migrate user's settings at the time the extension is activated the first time.

I'm contemplating doing that in a preview release first and maybe adding a once-an-upgrade notification system to ask those who "dare" to try the preview to get feedback. My only concern is that it will then be harder to easily switch formats; however, certainly more versatile e.g., want to group upper- and lowercase common variants?

{
  "insertGuid.formats": [
    "{d}",
    "{b}",
    "{D}",
    "{B}",
  ]
}

@heaths heaths linked a pull request Feb 9, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants