-
Notifications
You must be signed in to change notification settings - Fork 0
/
extension.js
40 lines (29 loc) · 1 KB
/
extension.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const vscode = require('vscode');
/**
* @param {vscode.ExtensionContext} context
*/
async function activate(context) {
vscode.window.showInformationMessage("Extension Activated");
console.log('"imageapi" is now active!');
let disposable = vscode.commands.registerCommand('imageapi.helloWorld', async function () {
vscode.window.showInformationMessage('Hello World');
});
let abandon = vscode.commands.registerCommand("imageapi.abandon", async function () {
const searchQuery = await vscode.window.showInputBox({
placeHolder: "Enter Text"
});
if(searchQuery == ''){
return vscode.window.showErrorMessage('You must input text for this to work');
}
const text = searchQuery.replace(" ", "+")
vscode.window.showInformationMessage("Image Saved!");
vscode.env.openExternal(`https://memegenapi.herokuapp.com/api/abandon/?text=${text}`);
});
context.subscriptions.push(disposable);
context.subscriptions.push(abandon);
}
function deactivate() {}
module.exports = {
activate,
deactivate
}