Skip to content

Commit

Permalink
Code cleanup and renamed extension activation command to topper.addTo…
Browse files Browse the repository at this point in the history
…pHeader.
  • Loading branch information
sidmishraw committed Jan 15, 2018
1 parent 3c2f3cf commit 225a845
Show file tree
Hide file tree
Showing 6 changed files with 246 additions and 249 deletions.
9 changes: 7 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,20 @@
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceRoot}" ],
"args": [
"--extensionDevelopmentPath=${workspaceRoot}"
],
"stopOnEntry": false
},
{
"name": "Launch Tests",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceRoot}", "--extensionTestsPath=${workspaceRoot}/test" ],
"args": [
"--extensionDevelopmentPath=${workspaceRoot}",
"--extensionTestsPath=${workspaceRoot}/test"
],
"stopOnEntry": false
}
]
Expand Down
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Place your settings in this file to overwrite default and user settings.
{
"cSpell.words": [
"loginfo"
]
}
44 changes: 19 additions & 25 deletions extension.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,30 @@
// The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
var vscode = require('vscode');
var vscode = require("vscode");

// topper specific import
const Topper = require("./topper.js");

// this method is called when your extension is activated
// your extension is activated the very first time the command is executed
/**
* Invoked when the extension is activated.
* @param {any} context
*/
function activate(context) {

// Use the console to output diagnostic information (console.log) and errors (console.error)
// This line of code will only be executed once when your extension is activated
console.log('Congratulations, your extension "topper" is now active!');

// The command has been defined in the package.json file
// Now provide the implementation of the command with registerCommand
// The commandId parameter must match the command field in package.json
var addTopHeader = vscode.commands.registerCommand('extension.addTopHeader', function () {

// the code below is executed every time the command `topper.addTopHeader` is executed
console.log("Topper is going to add header to the active file!");

Topper.topper.addTopHeader();

console.log("Your header has been successfully added to the file!");
});

context.subscriptions.push(addTopHeader);
console.log('Congratulations, your extension "topper" is now active!');
var addTopHeader = vscode.commands.registerCommand("topper.addTopHeader", function() {
console.log("Topper is going to add header to the active file!");
Topper.topper.addTopHeader();
console.log("Your header has been successfully added to the file!");
});
context.subscriptions.push(addTopHeader);
}

// this method is called when your extension is deactivated
function deactivate() { }
/**
* Invoked when the extension is deactivated.
*/
function deactivate() {
console.log("Topper has been deactivated.");
}

exports.activate = activate;
exports.deactivate = deactivate;
exports.deactivate = deactivate;
216 changes: 104 additions & 112 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,119 +1,111 @@
{
"name": "topper",
"displayName": "topper",
"description": "A fileheader utility",
"version": "0.0.2",
"publisher": "sidmishraw",
"engines": {
"vscode": "^1.13.0"
},
"categories": [
"Snippets",
"Other"
"name": "topper",
"displayName": "topper",
"description": "A fileheader utility",
"version": "0.0.2",
"publisher": "sidmishraw",
"engines": {
"vscode": "^1.13.0"
},
"categories": ["Snippets", "Other"],
"activationEvents": ["onCommand:topper.addTopHeader"],
"main": "./extension",
"contributes": {
"commands": [
{
"command": "topper.addTopHeader",
"title": "Topper: Add header"
}
],
"activationEvents": [
"onCommand:extension.addTopHeader"
],
"main": "./extension",
"contributes": {
"commands": [
"configuration": {
"type": "object",
"title": "Topper configuration",
"properties": {
"topper.customTemplateParameters": {
"type": "array",
"description":
"Configures template parameters. These parameters can be used in the header templates as placeholders.",
"default": [
{
"personalProfile": {
"author": "bulbasaur",
"website": "bulbasaur.github.bitbucket.yababbdadado.com",
"copyright": "None \n None",
"license": "None",
"email": "ivysaur.bulbasaur@venosaur.com"
}
},
{
"command": "extension.addTopHeader",
"title": "Topper: Add header"
"officeProfile": {
"author": "John Doe",
"department": "Product Development",
"email": "john.doe@doejohn.com"
}
}
],
"configuration": {
"type": "object",
"title": "Topper configuration",
"properties": {
"topper.customTemplateParameters": {
"type": "array",
"description": "Configures template parameters. These parameters can be used in the header templates as placeholders.",
"default": [
{
"personalProfile": {
"author": "bulbasaur",
"website": "bulbasaur.github.bitbucket.yababbdadado.com",
"copyright": "None \n None",
"license": "None",
"email": "ivysaur.bulbasaur@venosaur.com"
}
},
{
"officeProfile": {
"author": "John Doe",
"department": "Product Development",
"email": "john.doe@doejohn.com"
}
}
]
},
"topper.headerTemplates": {
"type": "array",
"description": "Configure the templates for the headers depending on the languageId inferred by the editor. The list of language Ids can be found here: https://code.visualstudio.com/docs/languages/identifiers. \nIf the file's languageId is not configured here, it defaults to the `defaultCStyled` header template. \nPlease do not delete this template. Copy it over when configuring this section. \nNote: Please keep the `defaultCStyled` as the first element in the list of all the header templates. \nFor more information, refer to the Readme.md.",
"default": [
{
"defaultCStyled": {
"headerBegin": "/**",
"headerPrefix": "*",
"headerEnd": "*/",
"template": [
"${headerBegin}",
"${headerPrefix} ${fileName}",
"${headerPrefix} @author ${author}",
"${headerPrefix} @description ${description}",
"${headerPrefix} @created ${createdDate}",
"${headerPrefix} @copyright ${copyright}",
"${headerPrefix} @last-modified ${lastModifiedDate}",
"${headerEnd}"
]
}
},
{
"python": {
"headerBegin": "#",
"headerPrefix": "#",
"headerEnd": "#",
"template": [
"${headerBegin}",
"${headerPrefix} ${fileName}",
"${headerPrefix} @author ${author}",
"${headerPrefix} @description ${description}",
"${headerPrefix} @created ${createdDate}",
"${headerPrefix} @last-modified ${lastModifiedDate}",
"${headerEnd}"
]
}
}
]
}
]
},
"topper.headerTemplates": {
"type": "array",
"description":
"Configure the templates for the headers depending on the languageId inferred by the editor. The list of language Ids can be found here: https://code.visualstudio.com/docs/languages/identifiers. \nIf the file's languageId is not configured here, it defaults to the `defaultCStyled` header template. \nPlease do not delete this template. Copy it over when configuring this section. \nNote: Please keep the `defaultCStyled` as the first element in the list of all the header templates. \nFor more information, refer to the Readme.md.",
"default": [
{
"defaultCStyled": {
"headerBegin": "/**",
"headerPrefix": "*",
"headerEnd": "*/",
"template": [
"${headerBegin}",
"${headerPrefix} ${fileName}",
"${headerPrefix} @author ${author}",
"${headerPrefix} @description ${description}",
"${headerPrefix} @created ${createdDate}",
"${headerPrefix} @copyright ${copyright}",
"${headerPrefix} @last-modified ${lastModifiedDate}",
"${headerEnd}"
]
}
},
{
"python": {
"headerBegin": "#",
"headerPrefix": "#",
"headerEnd": "#",
"template": [
"${headerBegin}",
"${headerPrefix} ${fileName}",
"${headerPrefix} @author ${author}",
"${headerPrefix} @description ${description}",
"${headerPrefix} @created ${createdDate}",
"${headerPrefix} @last-modified ${lastModifiedDate}",
"${headerEnd}"
]
}
}
]
}
},
"scripts": {
"postinstall": "node ./node_modules/vscode/bin/install",
"test": "node ./node_modules/vscode/bin/test"
},
"devDependencies": {
"typescript": "^2.0.3",
"vscode": "^1.0.0",
"mocha": "^2.3.3",
"eslint": "^3.6.0",
"@types/node": "^6.0.40",
"@types/mocha": "^2.2.32"
},
"keywords": [
"file header",
"fileheader",
"template",
"code template"
],
"repository": {
"type": "git",
"url": "https://github.com/sidmishraw/topper.git"
},
"bugs": {
"url": "https://github.com/sidmishraw/topper/issues",
"email": "sidmishraw@hotmail.com"
}
}
}
},
"scripts": {
"postinstall": "node ./node_modules/vscode/bin/install",
"test": "node ./node_modules/vscode/bin/test"
},
"devDependencies": {
"typescript": "^2.0.3",
"vscode": "^1.0.0",
"mocha": "^2.3.3",
"eslint": "^3.6.0",
"@types/node": "^6.0.40",
"@types/mocha": "^2.2.32"
},
"keywords": ["file header", "fileheader", "template", "code template"],
"repository": {
"type": "git",
"url": "https://github.com/sidmishraw/topper.git"
},
"bugs": {
"url": "https://github.com/sidmishraw/topper/issues",
"email": "sidmishraw@hotmail.com"
}
}
9 changes: 9 additions & 0 deletions test1
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/**
* test1
* @author Sidharth Mishra
* @description
* @created Sun Jan 14 2018 17:25:32 GMT-0800 (PST)
* @copyright 2017 Sidharth Mishra
* @last-modified Sun Jan 14 2018 17:25:32 GMT-0800 (PST)
*/

/**
* test1
* @author bulbasaur
Expand Down
Loading

0 comments on commit 225a845

Please sign in to comment.