Skip to content

Commit 812050c

Browse files
authored
Merge pull request #16 from sidmishraw/issue-15
Enhanced the intrinsic parameters by adding in content-root-path, repo-root-path, and absfilepath
2 parents 010cd23 + f3724c4 commit 812050c

File tree

6 files changed

+2420
-576
lines changed

6 files changed

+2420
-576
lines changed

README.md

+26
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,24 @@ Additionally, the default configuration for the header templates is:
105105
"${headerEnd}"
106106
]
107107
}
108+
},
109+
{
110+
"xml": {
111+
"headerBegin": "<!--",
112+
"headerPrefix": "*",
113+
"headerEnd": "-->",
114+
"template": [
115+
"${headerBegin}",
116+
"${headerPrefix} @FileName ${fileName}",
117+
"${headerPrefix} @PathFromRepositoryRoot ${pathFromRepositoryRoot}",
118+
"${headerPrefix} @AbsPath ${absFilePath}",
119+
"${headerPrefix} @RepositoryRootPath ${repositoryRootPath}",
120+
"${headerPrefix} @Created ${author} ${createdDate}",
121+
"${headerPrefix} @Modified ${author} ${lastModifiedDate}",
122+
"${headerPrefix} @Description ${description}",
123+
"${headerEnd}"
124+
]
125+
}
108126
}
109127
]
110128
```
@@ -132,6 +150,7 @@ Defaults to:
132150

133151
```javascript
134152
'[ ]*\\@last\\-modified\\s*.?\\s+((\\d{4}-\\d{2}-\\d{2})T(\\d{2}:\\d{2}:\\d{2}\\.\\d{3})Z([\\+\\-]?\\d{2}:\\d{2}))\\n*';
153+
135154
```
136155

137156
> Note: This configuration is dependent on the `topper.lastModified` and `topper.dateFormat` values, please make sure that both are in sync, otherwise Topper will not be able to capture the last modified field in the header and update the timestamp.
@@ -142,6 +161,7 @@ Defaults to:
142161

143162
```javascript
144163
'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]Z';
164+
145165
```
146166

147167
> Note: Please make sure that the last date modified regex is also in sync to the changes made to date format, otherwise Topper will not be able to automatically update the last modified timestamp in the header.
@@ -166,6 +186,12 @@ Topper has the following intrinsic template parameters. The values of these para
166186

167187
- `fileVersion` - The VSCode maintained file version.
168188

189+
- `pathFromRepositoryRoot` - The path of the file from the current workspace (or project) root. For example, if you're working on file `/project/dir1/file1.xml` then this will give `dir1/file1.xml`. This is a relative path from your workspace's root.
190+
191+
- `absFilePath` - This is the absolute path of the file obtained by querying the underlying OS Filesystem.
192+
193+
- `repositoryRootPath` - This is the root path of the workspace (or repository or project).
194+
169195
## Defining a custom keyboard shortcut
170196

171197
To define a custom keyboard shortcut do the following:

0 commit comments

Comments
 (0)