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": [
|
"activationEvents": [
|
||||||
|
"onCommand:recombobulator.generate-uuid",
|
||||||
"onCommand:recombobulator.base64",
|
"onCommand:recombobulator.base64",
|
||||||
"onCommand:recombobulator.rot13",
|
"onCommand:recombobulator.unbase64",
|
||||||
"onCommand:recombobulator.unbase64"
|
"onCommand:recombobulator.rot13"
|
||||||
],
|
],
|
||||||
"contributes": {
|
"contributes": {
|
||||||
"commands": [
|
"commands": [
|
||||||
|
{
|
||||||
|
"command": "recombobulator.generate-uuid",
|
||||||
|
"category": "Recombobulator",
|
||||||
|
"title": "generate uuid"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"command": "recombobulator.base64",
|
"command": "recombobulator.base64",
|
||||||
"category": "Recombobulator",
|
"category": "Recombobulator",
|
||||||
"title": "base64 encode"
|
"title": "base64 encode"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"command": "recombobulator.rot13",
|
|
||||||
"category": "Recombobulator",
|
|
||||||
"title": "rot13"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"command": "recombobulator.unbase64",
|
"command": "recombobulator.unbase64",
|
||||||
"category": "Recombobulator",
|
"category": "Recombobulator",
|
||||||
"title": "base64 decode"
|
"title": "base64 decode"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "recombobulator.rot13",
|
||||||
|
"category": "Recombobulator",
|
||||||
|
"title": "rot13"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"menus": {
|
"menus": {
|
||||||
"commandPalette": [
|
"commandPalette": [
|
||||||
|
{
|
||||||
|
"command": "recombobulator.generate-uuid",
|
||||||
|
"when": "editorFocus"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"command": "recombobulator.base64",
|
"command": "recombobulator.base64",
|
||||||
"when": "editorHasSelection"
|
"when": "editorHasSelection"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "recombobulator.rot13",
|
"command": "recombobulator.unbase64",
|
||||||
"when": "editorHasSelection"
|
"when": "editorHasSelection"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "recombobulator.unbase64",
|
"command": "recombobulator.rot13",
|
||||||
"when": "editorHasSelection"
|
"when": "editorHasSelection"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@ -1,5 +1,10 @@
|
|||||||
|
import * as crypto from "crypto";
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
|
|
||||||
|
function generateUUID(a: string) {
|
||||||
|
return crypto.randomUUID();
|
||||||
|
}
|
||||||
|
|
||||||
function base64(a: string) {
|
function base64(a: string) {
|
||||||
return Buffer.from(a).toString('base64'); // TODO - handle different character encodings
|
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) {
|
export function activate(context: vscode.ExtensionContext) {
|
||||||
console.log('Recombobulator is activated!');
|
console.log('Recombobulator is activated!');
|
||||||
|
|
||||||
|
context.subscriptions.push(vscode.commands.registerCommand('recombobulator.generate-uuid', () => {
|
||||||
|
applyEdit(generateUUID);
|
||||||
|
}));
|
||||||
context.subscriptions.push(vscode.commands.registerCommand('recombobulator.base64', () => {
|
context.subscriptions.push(vscode.commands.registerCommand('recombobulator.base64', () => {
|
||||||
applyEdit(base64);
|
applyEdit(base64);
|
||||||
}));
|
}));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user