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

Feature Request: Generate GUID for each cursor #13

Closed
lomholdt opened this issue May 22, 2018 · 18 comments
Closed

Feature Request: Generate GUID for each cursor #13

lomholdt opened this issue May 22, 2018 · 18 comments

Comments

@lomholdt
Copy link

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.

@lomholdt lomholdt changed the title Feature Request Feature Request: Generate GUID for each cursor May 22, 2018
@heaths
Copy link
Owner

heaths commented May 22, 2018

Feel free, and thanks!

@IanIsFluent
Copy link

Yeah, I wanted something that behaved the same as: https://github.com/SublimeText/GenerateUUID - which has that feature! I guess the UI would need to change to list the formats with an EXAMPLE rather than a particular GUID in the command window.

@heaths
Copy link
Owner

heaths commented Sep 1, 2018

If either of you want to review the changes (also had to "modernize" my old extension project), I can go ahead and get a new version built and published. Manual testing looks good, so I'll go ahead and publish in a few days regardless, but a third-party review would be desirable.

@heaths
Copy link
Owner

heaths commented Sep 1, 2018

BTW, this adds a new command "Insert many GUIDs" but with no keyboard binding. You could always rebind if you want that to be default. If you'd prefer, I could update the documentation about how someone could do that if they are not familiar.

@lomholdt
Copy link
Author

lomholdt commented Sep 2, 2018

I will have a look tomorrow! This is awesome!

@IanIsFluent
Copy link

I don't know about anyone else - but I will never want to copy one to my clipboard again once you add this. So for me, making this the default (w/keybinding) would obviously be better. But perhaps I'm unusual 😅

@heaths
Copy link
Owner

heaths commented Sep 4, 2018

I'll at least update the README about changing keybindings. I'd rather avoid a breaking change, but considering other options. Perhaps Alt+Ctrl+{? I admit this would've been better in the first place when I added multi-selection support; though, I guess that support hasn't been out that long (this is where anonymous telemetry comes in handy). As I've been thinking about it, I don't see much point in inserting the same GUID at multiple places. Sure, there are cases, but probably fewer than inserting unique GUIDs. Hmm...

@heaths
Copy link
Owner

heaths commented Sep 4, 2018

Another option is that I could make this a preference with a single command, and after the update to this version prompt if you want to make it the default. One could always change it in preferences then, or I could even make a new command to easily toggle the default.

@IanIsFluent
Copy link

I wonder if it's even worth creating a new extension, with that as the focus?

@heaths
Copy link
Owner

heaths commented Sep 5, 2018

That would be chaotic, IMO. There's already several extensions that generate GUIDs - albeit like the very utility that shipped with VS that my extension aimed to replace and improve. Why add another? And since 1 line is a subset of multiple, it would still do the exact same thing as this one. What I'd prefer is a more NPM-like approach to VSCode extensions, like I opened at microsoft/vscode#37162.

I'm actually considering just changing this new behavior to be the default. I'll make a decision by tomorrow. There's several options, but I'm not sure keeping backward compatibility with a recent change most people probably don't even know about (wasn't really advertised) is worth it.

@heaths
Copy link
Owner

heaths commented Sep 5, 2018

Checking on this history of the multi-select, I see this was indeed to replace a single GUID in multiple places, as called out in issue #9. So instead, I'll bind this to Alt+Ctrl+{, which serves two purposes.

  1. Allows you quick access to insert 1 or more GUIDs.
  2. Fixes issue Insert GUID shortcut is the same as the fold shortcut #12, so people could even unbind the current keyboard shortcut while retaining the ability to insert 1 or more GUIDs.

@heaths heaths closed this as completed in #14 Sep 5, 2018
heaths added a commit that referenced this issue Sep 5, 2018
* Add support to insert multiple unique GUIDs

Fixes #13

* Bump version to 1.4 and fix PR comments
@heaths
Copy link
Owner

heaths commented Sep 5, 2018

New version is up: https://marketplace.visualstudio.com/items?itemName=heaths.vscode-guid

@IanIsFluent
Copy link

IanIsFluent commented Sep 6, 2018

That's an amazing turn around speed! Only small remaining problem for me is that when I press ctrl+shift+alt+[, I get the command palette appear with a guid in it - I'd love to either not have that step at all 👍 - or, if there has to be another step there, have it be more clear that it will be inserting many different GUIDs 👍

@heaths
Copy link
Owner

heaths commented Sep 6, 2018

The quick pick list is numbered so you can quickly and easily hot the number you want. I've been very careful about making sure the defaults remain the same so the numbers will always be the same unless you change the default options. Given that, muscle memory should be fast enough to not differentiate that I'll insert multiple different GUIDs. After all, that is the command you invoked.

@heaths
Copy link
Owner

heaths commented Sep 6, 2018

FWIW, I did previously consider adding an option to default the format and should the quick pick, but as soon as you need a different format you'll have to change options just to do it. If that's really what you want I can add it but you'll need to opt in. Given the structure of the code now, it would probably be the numeric identifier given the options you have configured.

@IanIsFluent
Copy link

IanIsFluent commented Sep 6, 2018

Cool re: numbers, I just pressed 'enter' to insert the default - which is probably all most people need - but sure, more options is good.

The thing was when I first used it via ctrl+shift+alt+[ I couldn't tell that the command was different to inserting the same one every time, because it showed me an actual GUID (55b4fd35-d36e...), rather than Insert multiple guids in the form: xxxxxxxx-xxxx-xxxx-..., which is what I expected to see.

image

@heaths
Copy link
Owner

heaths commented Sep 6, 2018

Alt+Ctrl+{ (aka Alt+Ctrl+Shift+[) is bound to "Insert many GUIDs". To have found that keybinding you would have to have seen the command.

Also, people do need different formats. I'm not sure into what format you're using the first item, but in most authoring I work - and even the reason I created this in the first place, for WiX authoring - the second format is the only valid format. One cannot assume what people need, and needs vary.

Default formats 3 and 4 were to provide the same functionality of the old Insert GUID utility that shipped as a tool with Visual Studio, which I also use quite a bit in native coding (most often COM, which also makes heavy use of GUIDs).

And because I want to maintain backward compatibility because users do develop muscle memory, that is why format 5 was added at the end despite being more similar to 1 and 2.

@IanIsFluent
Copy link

IanIsFluent commented Sep 7, 2018

Sure, having more options is better - especially with a good default - which it is. My only remaining quibble was around the content of that box - I think it would be clearer if you didn't use a specific GUID - or made it clearer with some text that it was an example? Either Many Guids in the form: ... or an obvious template - like xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants