mirror of
https://github.com/nyanotech/recombobulator
synced 2025-12-16 11:30:21 -08:00
add a uuid generator
This commit is contained in:
parent
e27cdeb837
commit
3834536089
28
package.json
28
package.json
@ -22,40 +22,50 @@
|
||||
}
|
||||
},
|
||||
"activationEvents": [
|
||||
"onCommand:recombobulator.generate-uuid",
|
||||
"onCommand:recombobulator.base64",
|
||||
"onCommand:recombobulator.rot13",
|
||||
"onCommand:recombobulator.unbase64"
|
||||
"onCommand:recombobulator.unbase64",
|
||||
"onCommand:recombobulator.rot13"
|
||||
],
|
||||
"contributes": {
|
||||
"commands": [
|
||||
{
|
||||
"command": "recombobulator.generate-uuid",
|
||||
"category": "Recombobulator",
|
||||
"title": "generate uuid"
|
||||
},
|
||||
{
|
||||
"command": "recombobulator.base64",
|
||||
"category": "Recombobulator",
|
||||
"title": "base64 encode"
|
||||
},
|
||||
{
|
||||
"command": "recombobulator.rot13",
|
||||
"category": "Recombobulator",
|
||||
"title": "rot13"
|
||||
},
|
||||
{
|
||||
"command": "recombobulator.unbase64",
|
||||
"category": "Recombobulator",
|
||||
"title": "base64 decode"
|
||||
},
|
||||
{
|
||||
"command": "recombobulator.rot13",
|
||||
"category": "Recombobulator",
|
||||
"title": "rot13"
|
||||
}
|
||||
],
|
||||
"menus": {
|
||||
"commandPalette": [
|
||||
{
|
||||
"command": "recombobulator.generate-uuid",
|
||||
"when": "editorFocus"
|
||||
},
|
||||
{
|
||||
"command": "recombobulator.base64",
|
||||
"when": "editorHasSelection"
|
||||
},
|
||||
{
|
||||
"command": "recombobulator.rot13",
|
||||
"command": "recombobulator.unbase64",
|
||||
"when": "editorHasSelection"
|
||||
},
|
||||
{
|
||||
"command": "recombobulator.unbase64",
|
||||
"command": "recombobulator.rot13",
|
||||
"when": "editorHasSelection"
|
||||
}
|
||||
]
|
||||
|
||||
@ -1,5 +1,10 @@
|
||||
import * as crypto from "crypto";
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
function generateUUID(a: string) {
|
||||
return crypto.randomUUID();
|
||||
}
|
||||
|
||||
function base64(a: string) {
|
||||
return Buffer.from(a).toString('base64'); // TODO - handle different character encodings
|
||||
}
|
||||
@ -33,6 +38,9 @@ function applyEdit(transform: Function) {
|
||||
export function activate(context: vscode.ExtensionContext) {
|
||||
console.log('Recombobulator is activated!');
|
||||
|
||||
context.subscriptions.push(vscode.commands.registerCommand('recombobulator.generate-uuid', () => {
|
||||
applyEdit(generateUUID);
|
||||
}));
|
||||
context.subscriptions.push(vscode.commands.registerCommand('recombobulator.base64', () => {
|
||||
applyEdit(base64);
|
||||
}));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user