You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+65-20Lines changed: 65 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,16 +3,17 @@
3
3
This extension allow you to insert timestamp, copyright or any information to your file like comment below
4
4
5
5
/*
6
-
* Created on Tue Feb 18 2020
6
+
* Created on Tue Feb 18 2025
7
7
*
8
-
* Copyright (c) 2020 - Your Company
8
+
* Copyright (c) 2025 - Your Company
9
9
*/
10
10
11
11
## Features
12
12
13
-
- insert defined parameter like `date`, `time`, `datetime`, `day`, `month`, `month3`, `year`, `hour`, `minute`, `second`, `company`, `filename`
14
-
- insert your own parameter and template
15
-
- define multiple templates
13
+
- insert defined variable like `date`, `time`, `datetime`, `day`, `month`, `month3`, `year`, `hour`, `minute`, `second`, `company`, `filename`, `workspacename`, `username`
14
+
- insert your own variable and template
15
+
- create variable from shell command output (experimental)
16
+
- create multiple templates
16
17
17
18
## Install
18
19
@@ -26,14 +27,18 @@ Execute it from `Command Pallete` (menu View - Command Pallete...) then type com
26
27
27
28
1.`FileHeaderComment: Insert Default Template at Cursor`
28
29
2.`FileHeaderComment: Select from Available Templates`
30
+
3.`FileHeaderCOmment: Print All Variables`
29
31
30
-
The second command will show your available templates defined in Settings
32
+
These commands can also be accessed from the context menu.
31
33
32
-
If you want to set your own parameter and template (set from menu Preferences - User Settings), you can read explanation below
34
+
The second command will display the available templates defined in Settings.
35
+
You can see all available variables using command number 3.
36
+
37
+
If you want to set your own variables and templates (set from the Preferences - User Settings menu), you can read the explanation below
33
38
34
39
This is default configuration
35
40
36
-
```
41
+
```json
37
42
"fileHeaderComment.parameter":{
38
43
"*":{
39
44
"commentbegin": "/*",
@@ -53,21 +58,48 @@ This is default configuration
53
58
}
54
59
```
55
60
56
-
Define all custom variables/paramenters in asterisk `*` like
61
+
Define all custom variables/parameters in asterisk `*` like
57
62
63
+
```json
64
+
"fileHeaderComment.parameter":{
65
+
"*":{
66
+
"company": "Your Company"
67
+
"myvar1": "My Variable 1",
68
+
"myvar2": "My Variable 2"
69
+
}
70
+
}
58
71
```
72
+
73
+
You can create/override variables for specific file language, ie python
74
+
75
+
```json
59
76
"fileHeaderComment.parameter":{
60
77
"*":{
61
78
"company": "Your Company"
62
79
"myvar1": "My Variable 1",
63
80
"myvar2": "My Variable 2"
81
+
},
82
+
"python": {
83
+
"commentbegin": "\"\"\"",
84
+
"commentend": "\"\"\"",
85
+
"commentprefix": ""
64
86
}
65
87
}
66
88
```
67
89
68
-
Use your variable in template like (asterisk `*` will be default template)
90
+
(Experimental) You can get shell command output as a variable like
69
91
92
+
```json
93
+
"fileHeaderComment.parameter: {
94
+
"myvar3": "cmd(ls -alh)"
95
+
}"
70
96
```
97
+
my_command inside `cmd(my_command)` i.e. `ls -alh` in the example above will be executed in the current file directory. It only captures the last line output of 255 characters.
98
+
99
+
100
+
Use your variable in template like (asterisk `*` will be default template)
101
+
102
+
```json
71
103
"fileHeaderComment.template":{
72
104
"*":[
73
105
"${commentbegin}",
@@ -81,7 +113,7 @@ Use your variable in template like (asterisk `*` will be default template)
81
113
```
82
114
You can define multiple templates, for instance template for MIT License
83
115
84
-
```
116
+
```json
85
117
"fileHeaderComment.parameter":{
86
118
"*":{
87
119
"author": "Your Name",
@@ -117,33 +149,47 @@ You can define multiple templates, for instance template for MIT License
117
149
```
118
150
You can use your `mit` template above by calling it through `Command Pallete` and choose `FileHeaderComment: Select from Available Templates`.
119
151
120
-
You can use parameters below in your template
152
+
You can use variables below in your template
121
153
154
+
-`company` : print "Your Company"
122
155
-`date` : print current date
123
-
-`time` : print current time
124
156
-`time24h` : print current time in 24 hour format
125
157
-`datetime`: print current date + time
126
158
-`datetime24h` : print current date + time in 24 hour format
127
-
-`company` : print "Your Company"
128
159
-`day`: print day of the month
129
-
-`month`: print current month
130
-
-`month3`: first-3 letters of the month, e.g "Mar"
131
-
-`year`: print current year
160
+
-`filename`: print filename,
132
161
-`hour`: print current hour (24h)
133
162
-`minute`: print current minute
163
+
-`month`: print current month
164
+
-`month3`: first-3 letters of the month, e.g "Mar"
165
+
-`now`: same as datetime
166
+
-`now24h`: same as datetime24h
134
167
-`second`: print current second
135
-
-`filename`: print filename
168
+
-`time` : print current time
169
+
-`time24h`: print current time in 24 hour format
170
+
-`username`: user name
171
+
-`weeknumber` : print week number,
172
+
-`workspacename`: workspace name,
173
+
-`year`: print current year
174
+
-`yearshort`: print 2 digit of current year
136
175
137
176
138
177
139
178
## Release Notes
140
179
### 0.0.6
180
+
- variable for specific file language
141
181
- add month3 (thanks to @kfsone)
182
+
- add workspacename (thanks to @ljahier)
183
+
- add username (thanks to @mosayyeb-ebrahimi)
184
+
- add context menu (thanks to @bwilliams-sequence)
185
+
- custom variable from shell command output
186
+
142
187
### 0.0.5
143
188
- fixing python comment style (thanks to @ronak1009)
189
+
144
190
### 0.0.4
145
191
- support yaml, shellscript language (thanks to @waddyvic)
0 commit comments