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: expose date information as available variable(s) when creating snippets. #41631

Closed
davidpaulhunt opened this issue Jan 15, 2018 · 2 comments · Fixed by #41653
Assignees
Labels
feature-request Request for new features or functionality help wanted Issues identified as good community contribution opportunities on-testplan release-notes Release notes issues snippets
Milestone

Comments

@davidpaulhunt
Copy link

davidpaulhunt commented Jan 15, 2018

Edit: Sorry if this is a terrible issue...

The current list of variables available when writing a snippet can be found here.

Existing variables expose great contextual information - such as current file, directory, line number, word, etc. Development happens so fast that information can become outdated, so knowing when some custom snippets were inserted could be useful. For example, when creating files or adding comments.

My current use case is a snippet that inserts copyright headers.

The key binding ctrl+cmd_c inserts the header:

/**
 * MyClass.ts
 * MyProjectName
 *
 * Created by David Hunt.
 * Copyright © Our Company Name, LLC. All rights reserved.
 */

It would help to include the date:

/**
 ...
 * Created by David Hunt on 1/15/18.
 ...

and could also apply to updates or comments:

/**
 * See stackoverflow issue: someurl.
 * Added 1/15/18.
 */

Doing so could mean a simple variable like TM_CURRENT_DATE, but that may not work for non-US users who's date format is different i/e not month/day/year. Perhaps exposing the variables separately such as TM_CURRENT_YEAR, etc or localization can help?

I'd like to know if there is any interest in this. I know an extension could do this but it seems like overkill, but that could depend on potential use cases.

Thanks for any feedback.

@jrieken
Copy link
Member

jrieken commented Jan 15, 2018

Hm, this is dupe of many requests we have gotten around this but made a valid point. Adding variables for year, month, day and hour, minute, second makes sense. That will allow anyone to compose it's own date. So, yeah feel free to drop a PR

@jrieken jrieken added the help wanted Issues identified as good community contribution opportunities label Jan 15, 2018
@davidpaulhunt
Copy link
Author

@jrieken Good to hear.

@usernamehw Thanks for the PR!

@jrieken jrieken added this to the January 2018 milestone Jan 26, 2018
@jrieken jrieken added feature-request Request for new features or functionality on-testplan release-notes Release notes issues labels Jan 26, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Mar 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality help wanted Issues identified as good community contribution opportunities on-testplan release-notes Release notes issues snippets
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants