Change:
I'm happy to see the new date-based snippet variables in v1.20.0. I would love to see some additional ones since I wanted to use this for generating journal templates. Something like this: CURRENTDAYNAME: Monday, Tuesday, ... CURRENTDAYNAMESHORT: Mon, Tue, ... CURRENTMONTHNAME: January, February, ... CURRENTMONTHNAMESHORT: Jan, Feb, ... Thank you.
A little more tricky because you might want to consider localisation settings...

Discussion:
'use strict'; <ins> import * as nls from 'vs/nls'; </ins> import { basename, dirname } from 'vs/base/common/paths'; import { ITextModel } from 'vs/editor/common/model'; import { Selection } from 'vs/editor/common/core/selection';

'CURRENT_HOUR': true, 'CURRENT_MINUTE': true, 'CURRENT_SECOND': true, <ins> 'CURRENT_DAY_NAME': true, 'CURRENT_DAY_NAME_SHORT': true, 'CURRENT_MONTH_NAME': true, 'CURRENT_MONTH_NAME_SHORT': true, </ins> 'SELECTION': true, 'CLIPBOARD': true, 'TM_SELECTED_TEXT': true,

export class TimeBasedVariableResolver implements VariableResolver { <ins> private static readonly dayNames = [nls.localize('Sunday', "Sunday"), nls.localize('Monday', "Monday"), nls.localize('Tuesday', "Tuesday"), nls.localize('Wednesday', "Wednesday"), nls.localize('Thursday', "Thursday"), nls.localize('Friday', "Friday"), nls.localize('Saturday', "Saturday")]; private static readonly dayNamesShort = [nls.localize('SundayShort', "Sun"), nls.localize('MondayShort', "Mon"), nls.localize('TuesdayShort', "Tue"), nls.localize('WednesdayShort', "Wed"), nls.localize('ThursdayShort', "Thu"), nls.localize('FridayShort', "Fri"), nls.localize('SaturdayShort', "Sat")]; private static readonly monthNames = [nls.localize('January', "January"), nls.localize('February', "February"), nls.localize('March', "March"), nls.localize('April', "April"), nls.localize('May', "May"), nls.localize('June', "June"), nls.localize('July', "July"), nls.localize('August', "August"), nls.localize('September', "September"), nls.localize('October', "October"), nls.localize('November', "November"), nls.localize('December', "December")]; private static readonly monthNamesShort = [nls.localize('JanuaryShort', "Jan"), nls.localize('FebruaryShort', "Feb"), nls.localize('MarchShort', "Mar"), nls.localize('AprilShort', "Apr"), nls.localize('MayShort', "May"), nls.localize('JuneShort', "Jun"), nls.localize('JulyShort', "Jul"), nls.localize('AugustShort', "Aug"), nls.localize('SeptemberShort', "Sep"), nls.localize('OctoberShort', "Oct"), nls.localize('NovemberShort', "Nov"), nls.localize('DecemberShort', "Dec")]; </ins> resolve(variable: Variable): string { const { name } = variable;

return pad(new Date().getMinutes().valueOf(), 2); } else if (name === 'CURRENT_SECOND') { return pad(new Date().getSeconds().valueOf(), 2); <ins> } else if (name === 'CURRENT_DAY_NAME') { return TimeBasedVariableResolver.dayNames[new Date().getDay()]; } else if (name === 'CURRENT_DAY_NAME_SHORT') { return TimeBasedVariableResolver.dayNamesShort[new Date().getDay()]; } else if (name === 'CURRENT_MONTH_NAME') { return TimeBasedVariableResolver.monthNames[new Date().getMonth()]; } else if (name === 'CURRENT_MONTH_NAME_SHORT') { return TimeBasedVariableResolver.monthNamesShort[new Date().getMonth()]; </ins> } return undefined;

assert.equal(variable.resolve(resolver), true, `${varName} failed to resolve`); } <del> test('Add time variables for snippets #41631', function () { </del> <ins> test('Add time variables for snippets #41631, #43140', function () { </ins> const resolver = new TimeBasedVariableResolver;

assertVariableResolve3(resolver, 'CURRENT_HOUR'); assertVariableResolve3(resolver, 'CURRENT_MINUTE'); assertVariableResolve3(resolver, 'CURRENT_SECOND'); <ins> assertVariableResolve3(resolver, 'CURRENT_DAY_NAME'); assertVariableResolve3(resolver, 'CURRENT_DAY_NAME_SHORT'); assertVariableResolve3(resolver, 'CURRENT_MONTH_NAME'); assertVariableResolve3(resolver, 'CURRENT_MONTH_NAME_SHORT'); </ins> }); });