Using OS user name / git user name inside code snippets
See original GitHub issueI’d like to add the following code snippet and share it with the whole team:
{
"Comment todo": {
"prefix": "//",
"body": [
"// TODO (${MY_NAME}) [${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE}]: $1"
]
}
}
This should produce // TODO (Alexander Kachkaev) [2018-12-07]: ...
on my computer and // TODO (John Smith) [2018-12-07]: ...
on John Smith’s.
Looking at VSCode snippet docs and VSCode variable reference does not suggest that there is any variable like MY_NAME
. Could it be added? The value can either be taken from the OS user name or from the git user name. Similarly, there could be a variable for the current user’s email address (possibly taken from the git config).
WDYT?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:22
- Comments:7
Top Results From Across the Web
git config - How to know the git username and email saved ...
The command git config --list will list the settings. There you should also find user.name and user.email .
Read more >How to Set Git Username and Password in GitBash?
This is how you set git username and password in git bash. To check the inputs, type the below command as depicted:
Read more >gitcredentials Documentation - Git
Git will sometimes need credentials from the user in order to perform operations; for example, it may need to ask for a username...
Read more >Storing username and password in Git - Unix Stack Exchange
If you want the config to be specific of a website (e.g. only for github.com, but not gitlab), you have to use git...
Read more >How to Configure Git Username and Email Address - Linuxize
Git allows you to set a global and per-project username and email address. You can set or change your git identity using the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If environment variables could be inserted into snippets, there would at least be a work around. Feels like it shouldn’t be a difficult update?
i’d also like to use git user values (specifically author / email) to include those in my changelog snippet. if not possible/wanted with git, at least let use store those values in vscode settings and use those.
but in the long run, support for extension settings values would be neat anyways. like ${git:username} or ${myext:sourcedir}
everything else i need is already in place and that’s so awesome =)