Skip to content

Feature request: expose date information as available variable(s) when creating snippets. #41631

@davidpaulhunt

Description

@davidpaulhunt

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.

Metadata

Metadata

Assignees

Labels

feature-requestRequest for new features or functionalityhelp wantedIssues identified as good community contribution opportunitieson-testplanrelease-notesRelease notes issuessnippets

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions