Skip to content

Commit

Permalink
feat: adds logger
Browse files Browse the repository at this point in the history
  • Loading branch information
Ken Howard committed Nov 21, 2018
1 parent de05bd8 commit 4db0d27
Show file tree
Hide file tree
Showing 8 changed files with 5,615 additions and 698 deletions.
5 changes: 5 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
testMatch: ['**/__tests__/**/(*.)+(spec|test).ts?(x)']
};
5,821 changes: 5,224 additions & 597 deletions package-lock.json

Large diffs are not rendered by default.

163 changes: 84 additions & 79 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,81 +1,86 @@
{
"name": "vscode-gist",
"displayName": "Gist Extension",
"description": "Create, open and edit Gists",
"version": "1.2.1",
"publisher": "kenhowardpdx",
"repository": "https://github.com/kenhowardpdx/vscode-gist",
"engines": {
"vscode": "^1.28.0"
},
"categories": [
"Other"
],
"activationEvents": [
"onCommand:extension.openCodeBlock",
"onCommand:extension.openFavoriteCodeBlock",
"onCommand:extension.createCodeBlock",
"onCommand:extension.openCodeBlockInBrowser",
"onCommand:extension.deleteCodeBlock",
"onCommand:extension.removeFileFromCodeBlock",
"onCommand:extension.addToCodeBlock",
"onCommand:extension.changeCodeBlockDescription",
"onCommand:extension.insertCode"
],
"main": "./out/extension",
"contributes": {
"commands": [
{
"command": "extension.openCodeBlock",
"title": "GIST: Open Block"
},
{
"command": "extension.openFavoriteCodeBlock",
"title": "GIST: Open Favorite Block"
},
{
"command": "extension.createCodeBlock",
"title": "GIST: Create New Block"
},
{
"command": "extension.openCodeBlockInBrowser",
"title": "GIST: Open Block In Browser"
},
{
"command": "extension.deleteCodeBlock",
"title": "GIST: Delete Block"
},
{
"command": "extension.removeFileFromCodeBlock",
"title": "GIST: Remove From Block"
},
{
"command": "extension.addToCodeBlock",
"title": "GIST: Add To Block"
},
{
"command": "extension.changeCodeBlockDescription",
"title": "GIST: Change Block Description"
},
{
"command": "extension.insertCode",
"title": "GIST: Insert Code Into Current File"
}
]
},
"scripts": {
"compile": "tsc -p ./",
"lint": "tslint -p ./",
"postinstall": "node ./node_modules/vscode/bin/install",
"test": "npm run compile && node ./node_modules/vscode/bin/test",
"vscode:prepublish": "npm run compile",
"watch": "tsc -watch -p ./"
},
"devDependencies": {
"typescript": "^3.1.6",
"vscode": "^1.1.21",
"tslint": "^5.11.0",
"@types/node": "^8.10.25",
"@types/mocha": "^2.2.42"
}
"name": "vscode-gist",
"displayName": "Gist Extension",
"description": "Create, open and edit Gists",
"version": "1.2.1",
"publisher": "kenhowardpdx",
"repository": "https://github.com/kenhowardpdx/vscode-gist",
"engines": {
"vscode": "^1.28.0"
},
"categories": [
"Other"
],
"activationEvents": [
"onCommand:extension.openCodeBlock",
"onCommand:extension.openFavoriteCodeBlock",
"onCommand:extension.createCodeBlock",
"onCommand:extension.openCodeBlockInBrowser",
"onCommand:extension.deleteCodeBlock",
"onCommand:extension.removeFileFromCodeBlock",
"onCommand:extension.addToCodeBlock",
"onCommand:extension.changeCodeBlockDescription",
"onCommand:extension.insertCode"
],
"main": "./out/extension",
"contributes": {
"commands": [
{
"command": "extension.openCodeBlock",
"title": "GIST: Open Block"
},
{
"command": "extension.openFavoriteCodeBlock",
"title": "GIST: Open Favorite Block"
},
{
"command": "extension.createCodeBlock",
"title": "GIST: Create New Block"
},
{
"command": "extension.openCodeBlockInBrowser",
"title": "GIST: Open Block In Browser"
},
{
"command": "extension.deleteCodeBlock",
"title": "GIST: Delete Block"
},
{
"command": "extension.removeFileFromCodeBlock",
"title": "GIST: Remove From Block"
},
{
"command": "extension.addToCodeBlock",
"title": "GIST: Add To Block"
},
{
"command": "extension.changeCodeBlockDescription",
"title": "GIST: Change Block Description"
},
{
"command": "extension.insertCode",
"title": "GIST: Insert Code Into Current File"
}
]
},
"scripts": {
"compile": "tsc -p ./",
"lint": "tslint -p ./",
"postinstall": "node ./node_modules/vscode/bin/install",
"test:unit": "jest",
"test:integration": "npm run compile && node ./node_modules/vscode/bin/test",
"test": "npm run test:unit && npm run test:integration",
"vscode:prepublish": "npm run compile",
"watch": "tsc -watch -p ./"
},
"devDependencies": {
"@types/jest": "^23.3.9",
"@types/mocha": "^2.2.42",
"@types/node": "^8.10.25",
"jest": "^23.6.0",
"ts-jest": "^23.10.4",
"tslint": "^5.11.0",
"typescript": "^3.1.6",
"vscode": "^1.1.21"
}
}
78 changes: 57 additions & 21 deletions src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,69 @@
'use strict';
// The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
import * as vscode from 'vscode';

// this method is called when your extension is activated
// your extension is activated the very first time the command is executed
export function activate(context: vscode.ExtensionContext): void {
// 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
// tslint:disable-next-line:no-console
console.log('Congratulations, your extension "vscode-gist" is now active!');
import { Levels, Logger } from './logger';

// 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
const disposable = vscode.commands.registerCommand(
'extension.sayHello',
() => {
// The code you place here will be executed every time your command is executed
export function activate(_: vscode.ExtensionContext): void {
const logger = new Logger(Levels.DEBUG);

// Display a message box to the user
vscode.window.showInformationMessage('Hello World!');
logger.debug('extension activated');
vscode.commands.registerCommand(
'extension.openCodeBlock',
(): void => {
// intentionally left blank
}
);
vscode.commands.registerCommand(
'extension.openFavoriteCodeBlock',
(): void => {
// intentionally left blank
}
);
vscode.commands.registerCommand(
'extension.createCodeBlock',
(): void => {
// intentionally left blank
}
);
vscode.commands.registerCommand(
'extension.openCodeBlockInBrowser',
(): void => {
// intentionally left blank
}
);
vscode.commands.registerCommand(
'extension.deleteCodeBlock',
(): void => {
// intentionally left blank
}
);
vscode.commands.registerCommand(
'extension.removeFileFromCodeBlock',
(): void => {
// intentionally left blank
}
);
vscode.commands.registerCommand(
'extension.addToCodeBlock',
(): void => {
// intentionally left blank
}
);
vscode.commands.registerCommand(
'extension.changeCodeBlockDescription',
(): void => {
// intentionally left blank
}
);
vscode.commands.registerCommand(
'extension.insertCode',
(): void => {
// intentionally left blank
}
);

context.subscriptions.push(disposable);
// context.subscriptions.push(disposable);
}

// this method is called when your extension is deactivated
export function deactivate(): void {
// intentionally left blank
}

0 comments on commit 4db0d27

Please sign in to comment.