Skip to content
Snippets Groups Projects
Commit c2e5aed7 authored by John Jago's avatar John Jago
Browse files

Try out adding a new command

parent 1744df39
Branches master
No related tags found
No related merge requests found
......@@ -10,14 +10,19 @@
"Other"
],
"activationEvents": [
"onCommand:extension.helloWorld"
"onCommand:extension.helloWorld",
"onCommand:extension.currentTime"
],
"main": "./out/extension.js",
"contributes": {
"commands": [
{
"command": "extension.helloWorld",
"title": "Hello World"
"title": "Hello Earth"
},
{
"command": "extension.currentTime",
"title": "Current Time"
}
]
},
......
......@@ -8,7 +8,8 @@ export function activate(context: vscode.ExtensionContext) {
// 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 "helloworld" is now active!');
console.log(new Date().getFullYear.toString());
// The command has been defined in the package.json file
// Now provide the implementation of the command with registerCommand
......@@ -17,10 +18,20 @@ export function activate(context: vscode.ExtensionContext) {
// The code you place here will be executed every time your command is executed
// Display a message box to the user
vscode.window.showInformationMessage('Hello World!');
vscode.window.showInformationMessage('Hello VS Code!');
});
context.subscriptions.push(disposable);
let time = vscode.commands.registerCommand('extension.currentTime', () => {
let dateNotAString = new Date().getFullYear();
let differentDateString = new Date().getFullYear().toString();
let date: string = new Date().toDateString();
vscode.window.showWarningMessage(date);
vscode.window.showWarningMessage(differentDateString);
})
context.subscriptions.push(time);
}
// this method is called when your extension is deactivated
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment