Skip to content
This repository has been archived by the owner on Apr 1, 2020. It is now read-only.

Fix CURRENT_MONTH Snippet variable. #2530

Merged
merged 2 commits into from
Sep 1, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions browser/src/Services/Snippets/SnippetVariableResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,31 @@ export class SnippetVariableResolver implements VariableResolver {
const filePath = this._buffer && this._buffer.filePath ? this._buffer.filePath : ""

this._variableToValue = {
TM_LINE_INDEX: line.toString(),
TM_LINE_NUMBER: (line + 1).toString(),
TM_FILENAME: path.basename(filePath),
TM_DIRECTORY: path.dirname(filePath),
TM_FILEPATH: filePath,
TM_FILENAME_BASE: path.basename(filePath, path.extname(filePath)),
CURRENT_YEAR: currentDate.getFullYear().toString(),
CURRENT_MONTH: currentDate.getMonth().toString(),
CURRENT_YEAR_SHORT: currentDate
.getFullYear()
.toString()
.slice(-2),
CURRENT_MONTH: (currentDate.getMonth() + 1).toString(),
CURRENT_DATE: currentDate.getDate().toString(),
CURRENT_HOUR: currentDate.getHours().toString(),
CURRENT_MINUTE: currentDate.getMinutes().toString(),
CURRENT_SECOND: currentDate.getSeconds().toString(),
CURRENT_DAY_NAME: currentDate.toLocaleString("en-US", { weekday: "long" }),
CURRENT_DAY_NAME_SHORT: currentDate.toLocaleString("en-US", { weekday: "short" }),
CURRENT_MONTH_NAME: currentDate.toLocaleString("en-US", { month: "long" }),
CURRENT_MONTH_NAME_SHORT: currentDate.toLocaleString("en-US", { month: "short" }),
// SELECTION: "",
// CLIPBOARD: "",
// TM_SELECTED_TEXT: "",
// TM_CURRENT_LINE: "",
// TM_CURRENT_WORD: "",
TM_LINE_INDEX: line.toString(),
TM_LINE_NUMBER: (line + 1).toString(),
TM_FILENAME: path.basename(filePath),
TM_FILENAME_BASE: path.basename(filePath, path.extname(filePath)),
TM_DIRECTORY: path.dirname(filePath),
TM_FILEPATH: filePath,
}
}

Expand Down