当前位置:首页 > 云服务器 > 正文内容

VScode 的 code snippet 中可以使用的一些变量(时间,日期等),Silvester123的博客 - 皇冠云,vscode获取时间

来源于网络1个月前 (05-26)云服务器0
香港256IP千兆站群服务器BGP专线240元起! 华为云香港物理机精品线路全面上线![特价] 企业级CN2 GIA双程专线高速回国 T3机房 香港美国韩国海外独立物理服务器特价热销中!

参考链接

The following variables can be used:

TM_SELECTED_TEXT The currently selected text or the empty stringTM_CURRENT_LINE The contents of the current lineTM_CURRENT_WORD The contents of the word under cursor or the empty stringTM_LINE_INDEX The zero-index based line numberTM_LINE_NUMBER The one-index based line numberTM_FILENAME The filename of the current documentTM_FILENAME_BASE The filename of the current document without its extensionsTM_DIRECTORY The directory of the current documentTM_FILEPATH The full file path of the current documentCLIPBOARD The contents of your clipboardWORKSPACE_NAME The name of the opened workspace or folder

For inserting the current date and time:

CURRENT_YEAR The current yearCURRENT_YEAR_SHORT The current year’s last two digitsCURRENT_MONTH The month as two digits (example ‘02’)CURRENT_MONTH_NAME The full name of the month (example ‘July’)CURRENT_MONTH_NAME_SHORT The short name of the month (example ‘Jul’)CURRENT_DATE The day of the monthCURRENT_DAY_NAME The name of day (example ‘Monday’)CURRENT_DAY_NAME_SHORT The short name of the day (example ‘Mon’)CURRENT_HOUR The current hour in 24-hour clock formatCURRENT_MINUTE The current minute CURRENT_SECOND The current second

For inserting line or block comments, honoring the current language:

BLOCK_COMMENT_START Example output: in PHP /* or in HTML <!–BLOCK_COMMENT_END Example output: in PHP */ or in HTML -->LINE_COMMENT Example output: in PHP // or in HTML <!-- -->

举例如下:

"c_header": {"prefix": "c_header","body": ["/**"," * Copyright  2019 Silvester. All rights reserved."," * "," * @author: Silvester"," * @date: $CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE "," */","#include <stdio.h>","#include <stdlib.h>","#include <string.h>","","int main() {","    /****** your code ******/","    $0","    return 0;","}"]// "description": "Log output to console"}

输出效果:

/** * Copyright  2019 Silvester. All rights reserved. *  * @author: Silvester * @date: 2019-05-20  */#include <stdio.h>#include <stdlib.h>#include <string.h>int main() {    /****** your code ******/        return 0;}

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/Silvester123/article/details/90376904

宝塔服务器面板,一键全能部署及管理,送你3188元礼包,点我领取

扫描二维码推送至手机访问。

版权声明:文章来源于互联网公开页面遵守互联网分享协议,若涉及侵权请联系客服处理。

本文链接:https://www.idchg.com/info/201103/

分享给朋友:

发表评论

访客

看不清,换一张

◎欢迎参与讨论,请在这里发表您的看法和观点。