VSCode User Snippet Variables
Links
- How to create a user snippet in VSCode - DEV.to
- Snippet Generator - a tiny React app to create Visual Studio Code , Sublime Text and Atom snippets.
Workspace Variables
The following workspace variables can be used:
TM_SELECTED_TEXTThe currently selected text or the empty string,TM_CURRENT_LINEThe contents of the current line,TM_CURRENT_WORDThe contents of the word under cursor or the empty string,TM_LINE_INDEXThe zero index based line number,TM_LINE_NUMBERThe one index based line number,TM_FILENAMEThe filename of the current document,TM_FILENAME_BASEThe filename of the current document without its extensions,TM_DIRECTORYThe directory of the current document,TM_FILEPATHThe full file path of the current document,CLIPBOARD: The contents of your clipboard,WORKSPACE_NAME: The name of the opened workspace or folder.
The following time related variables can be used:
CURRENT_YEARThe current year,CURRENT_YEAR_SHORTThe current year’s last two digits,CURRENT_MONTHThe month as two digits (example ‘07’),CURRENT_MONTH_NAMEThe full name of the month (example ‘July’),CURRENT_MONTH_NAME_SHORTThe short name of the month (example ‘Jul’),CURRENT_DATEThe day of the month,CURRENT_DAY_NAMEThe name of day (example ‘Monday’),CURRENT_DAY_NAME_SHORTThe short name of the day (example ‘Mon’),CURRENT_HOURThe current hour in 24 hour clock format,CURRENT_MINUTEThe current minute,CURRENT_SECONDThe current second,CURRENT_SECONDS_UNIXThe number of seconds since the Unix epoch.
The following comment variables can be used. They honour the syntax of the document’s language
BLOCK_COMMENT_START: For example, <! in HTML,BLOCK_COMMENT_END: For example , > in HTML,LINE_COMMENT: For example, // in JavaScript.