VS2019利⽤Macro函数注释添加姓名和⽇期1.添加 Macros for Visual Studio 扩展
2. 添加 Macro 脚本
Method Note 中的代码如下():
var date = new Date();
var year = Year();
var month = Month() + 1;
var day = Date();
var hours = Hours();
var minutes = Minutes();
month = month < 10 ? ("0" + month) : ("" + month);
day = day < 10 ? ("0" + day) : ("" + day);
hours = hours < 10 ? ("0" + hours) : ("" + hours);
minutes = minutes < 10 ? ("0" + minutes) : ("" + minutes);
var doc = dte.ActiveDocument;
doc.Selection.Text = "///";
doc.Selection.LineDown();
doc.Selection.EndOfLine();
doc.Selection.NewLine();
doc.Selection.Text = "<remark>";
doc.Selection.NewLine();
doc.Selection.LineUp();
doc.Selection.EndOfLine();
doc.Selection.NewLine();
doc.Selection.Text = "<para/>Author : AnDequan";
doc.Selection.NewLine();
doc.Selection.Text = "<para/>Date : " + year + "-" + month + "-" + day + " " + hours + ":" + minutes;
3.添加 快捷键 ,本⼈⽤的 Ctrl M,1
4.效果演⽰:television缩写
在 Class 或者 函数 上 使⽤快捷键 Ctrl M,1 即可
同理做了⼀个单⾏注释如下图:
caesar# 附录:
MethodNote.js
var day = Date();
var hours = Hours();
var minutes = Minutes();
soylentif (month == 1) month = 13;
商店英语
if (month == 2) month = 14;
var week = (day + 2 * month + 3 * (month + 1) / 5 + year + year / 4 - year / 100 + year / 400) % 7 + 1; week = parInt(week);
var xingqi = "";
if (week == 1) { xingqi = "星期⽇"; }美女与野兽动画片中文
el if (week == 2) { xingqi = "星期⼀"; }
el if (week == 3) { xingqi = "星期⼆"; }
el if (week == 4) { xingqi = "星期三"; }
el if (week == 5) { xingqi = "星期四"; }
el if (week == 6) { xingqi = "星期五"; }
el if (week == 7) { xingqi = "星期六"; }
month = month < 10 ? ("0" + month) : ("" + month);
day = day < 10 ? ("0" + day) : ("" + day);
hours = hours < 10 ? ("0" + hours) : ("" + hours);
minutes = minutes < 10 ? ("0" + minutes) : ("" + minutes);
var time = year + "-" + month + "-" + day + " " + hours + ":" + minutes;
var justDay = year + "-" + month + "-" + day;
var doc = dte.ActiveDocument;
doc.Selection.Text = "///";
doc.Selection.LineDown();
doc.Selection.EndOfLine();
doc.Selection.NewLine();
北京教育培训网doc.Selection.Text = "<remark>";
doc.Selection.NewLine();
doc.Selection.LineUp();
doc.Selection.EndOfLine();
doc.Selection.NewLine();
doc.Selection.Text = "<para/>Author : An";
doc.Selection.NewLine();
doc.Selection.Text = "<para/>Date : " + time + " " + xingqi;
physical therapy
doc.Selection.LineUp();
doc.Selection.LineUp();
doc.Selection.LineUp();
doc.Selection.LineUp();
SingleLineNote.js
var day = Date();
var hours = Hours();
var minutes = Minutes();
if (month == 1) month = 13;
if (month == 2) month = 14;
var week = (day + 2 * month + 3 * (month + 1) / 5 + year + year / 4 - year / 100 + year / 400) % 7 + 1; week = parInt(week);
piggvar xingqi = "";
if (week == 1) { xingqi = "星期⽇"; }
congratulationel if (week == 2) { xingqi = "星期⼀"; }
el if (week == 3) { xingqi = "星期⼆"; }
el if (week == 4) { xingqi = "星期三"; }
el if (week == 5) { xingqi = "星期四"; }
el if (week == 6) { xingqi = "星期五"; }
el if (week == 7) { xingqi = "星期六"; }
month = month < 10 ? ("0" + month) : ("" + month);
day = day < 10 ? ("0" + day) : ("" + day);
hours = hours < 10 ? ("0" + hours) : ("" + hours);
minutes = minutes < 10 ? ("0" + minutes) : ("" + minutes);
var time = year + "-" + month + "-" + day + " " + hours + ":" + minutes;
var justDay = year + "-" + month + "-" + day;
var doc = dte.ActiveDocument;
doc.Selection.Text = "// [ ] An " + time + " " + xingqi + "";
doc.Selection.CharLeft(fal, 24);
doc.Selection.CharLeft();
doc.Selection.Text = "";
confoundeddoc.Selection.CharLeft();
doc.Selection.Text = "";