Skip to content

Added RANDOM, RANDOM_HEX snippet variables#82529

Merged
jrieken merged 1 commit intomicrosoft:masterfrom
Krystofee:added_random_snippet_variable
Oct 16, 2019
Merged

Added RANDOM, RANDOM_HEX snippet variables#82529
jrieken merged 1 commit intomicrosoft:masterfrom
Krystofee:added_random_snippet_variable

Conversation

@Krystofee
Copy link
Contributor

This PR fixes #80297

I've take the issue since there was no activity. I will be happy to write tests, when I'll get approve for this functionality.

Ping @jrieken.

@msftclas
Copy link

msftclas commented Oct 14, 2019

CLA assistant check
All CLA requirements met.

Copy link
Member

@jrieken jrieken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@jrieken jrieken added this to the October 2019 milestone Oct 16, 2019
@jrieken jrieken merged commit 6b0613a into microsoft:master Oct 16, 2019
@SnirBroshi
Copy link
Contributor

SnirBroshi commented Oct 17, 2019

Why is this specifically 6 random characters?
This is very arbitrary and the use cases for exactly 6-digit random decimal or hex numbers other than a hex color are non-existent.

This should be removed @jrieken.

@jrieken
Copy link
Member

jrieken commented Oct 17, 2019

So, what is your suggestion then? Just remove? 5 numbers? 3?

@seognil
Copy link

seognil commented Oct 21, 2019

Wow, thanks for the work
the origin request is from me

I agree with NotWearingPants
the approach is not flexible
but it's enough for my original proposal already

I thought that maybe the 'snippet system' could support inbuilt function rather than const only
or as what I imaged before: parse any custom valid JS statements, so that vscode itself would keep simple

the first case is like `color: #${RANDOM(6, hex)}` or `console.warn('tag-${RANDOM(8, 36)}')`
the customable way is like `console.warn(${Math.random().blahblah()})`

Anyway, thanks for the work~

@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] snippet support RANDOM

5 participants