Skip to content

Commit

Permalink
v1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Robin committed Jun 13, 2020
1 parent 432eaa5 commit 5b0211f
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Fix eslint configuration
- Add prettier configuration
- Update documentation
- Support: TypeScript React, Dart, Bat, Powershell

**v1.0.10**

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ This extension inserts an header in a new file or an existing file.
- Jade
- XML
- Python
- TypeScript React
- Dart
- Bat
- Powershell

## Table of contents

Expand Down
10 changes: 10 additions & 0 deletions src/headerFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ exports.extCategory = {
sql: readHeader(' * '),
swift: readHeader(' * '),
typescript: readHeader(' * '),
typescriptreact: readHeader(' * '),
makefile: readHeader('# '),
dockerfile: readHeader('# '),
coffeescript: readHeader('# '),
Expand All @@ -32,12 +33,17 @@ exports.extCategory = {
jade: readHeader('<!--'),
xml: readHeader('<!--'),
python: readHeader('# '),
dart: readHeader(' * '),
bat: readHeader('::'),
powershell: readHeader('<#'),
};

exports.templates = {
' * ': popHeader('star'),
'# ': popHeader('hashtag'),
'<!--': popHeader('html'),
'::': popHeader('semi'),
'<#': popHeader('power'),
};

const settings = {
Expand All @@ -47,6 +53,10 @@ const settings = {
'##\r\n# @author {author} <{email}>\r\n# @file Description\r\n# @desc Created on {createTime}\r\n# @copyright {copyrights}\r\n#\r\n',
html:
'<!--\r\n @author {author} <{email}>\r\n @file Description\r\n @desc Created on {createTime}\r\n @copyright {copyrights}\r\n -->\r\n',
semi:
'::\r\n:: @author {author} <{email}>\r\n:: @file Description\r\n:: @desc Created on {createTime}\r\n:: @copyright {copyrights}\r\n::\r\n',
power:
'<#\r\n # @author {author} <{email}>\r\n # @file Description\r\n # @desc Created on {createTime}\r\n # @copyright {copyrights}\r\n#>\r\n',
};

/**
Expand Down
5 changes: 5 additions & 0 deletions src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ exports.parseHeader = (fileName, type) => {
function replaceHeader(lines, symbol, config) {
return new Promise((resolve, reject) => {
const editor = vscode.editor || vscode.window.activeTextEditor;

if (!lines) {
return reject();
}

for (let x = 0; x < lines.length; x++) {
const res = lines[x].match(/[ *#]+@author/g);
if (res !== null) {
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ function activate() {
if (editor) {
const document = editor.document;
const language = document.languageId;
console.log(`Language used: ${language}`);
dictionary[language](config, document.fileName);
}
});
Expand Down

0 comments on commit 5b0211f

Please sign in to comment.