diff --git a/README.md b/README.md index 9e4ee87..8d199d5 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,21 @@ # flipit README -This extension will [flip](https://github.com/jergason/flipjs) the currently selected text or the whole editor if there is no selection and display then output in a new editor. +This extension will [flip](https://github.com/jergason/flipjs) or [zalgoize](https://github.com/clux/zalgolize) the currently selected text or the whole editor if there is no selection and display the output in a new editor. ## Features -Describe specific features of your extension including screenshots of your extension in action. Image paths are relative to this README file. - -For example if there is an image subfolder under your extension project workspace: - ![Flip Selection](flipitselection.gif) ![Flip All](flipitall.gif) +![Zalgo All](zalgoall.gif) + ## Release Notes +### 1.0.1 + +Add Zalgo support + ### 1.0.0 Initial release of flipit diff --git a/extension.js b/extension.js index 33fafc6..01dec0f 100644 --- a/extension.js +++ b/extension.js @@ -1,5 +1,6 @@ const vscode = require('vscode'); const flip = require('flip'); +const zalgo = require('zalgolize'); function activate(context) { @@ -25,6 +26,27 @@ function activate(context) { }); context.subscriptions.push(disposable); + + disposable = vscode.commands.registerCommand('extension.zalgoIt', function () { + + let editor = vscode.window.activeTextEditor; + if (!editor) { + return; + } + + let selection = editor.selection; + let textToZalgo = editor.document.getText(selection.isEmpty ? undefined : selection); + if( !textToZalgo) { + return; + } + + let zalgoed = zalgo(textToZalgo); + vscode.workspace.openTextDocument({ + content: zalgoed + }).then((doc) => { + vscode.window.showTextDocument(doc); + }); + }); } exports.activate = activate; diff --git a/package-lock.json b/package-lock.json index 56a9ffe..9dfd5fc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "flipit", - "version": "0.0.1", + "version": "1.0.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -2663,6 +2663,11 @@ "punycode": "1.4.1" } }, + "trials": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/trials/-/trials-1.0.0.tgz", + "integrity": "sha1-ip+6KajXypcV6/TdtSoCgvaKgfw=" + }, "tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", @@ -2901,6 +2906,22 @@ "requires": { "buffer-crc32": "0.2.13" } + }, + "zalgolize": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/zalgolize/-/zalgolize-1.2.4.tgz", + "integrity": "sha1-r1QkPJ4E6mjNOPcFHxCsS0RF9fY=", + "requires": { + "minimist": "1.2.0", + "trials": "1.0.0" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" + } + } } } } diff --git a/package.json b/package.json index 7247aa6..b608adb 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "flipit", "displayName": "flipit", "description": "Flip active editor contents (or current selection) upside-down", - "version": "1.0.0", + "version": "1.0.1", "publisher": "ndrake", "repository": { "type": "git", @@ -16,7 +16,8 @@ "Other" ], "activationEvents": [ - "onCommand:extension.flipIt" + "onCommand:extension.flipIt", + "onCommand:extension.zalgoIt" ], "main": "./extension", "contributes": { @@ -24,6 +25,10 @@ { "command": "extension.flipIt", "title": "Flip It" + }, + { + "command": "extension.zalgoIt", + "title": "Zalgo It" } ] }, @@ -39,6 +44,7 @@ "@types/mocha": "^2.2.42" }, "dependencies": { - "flip": "^1.0.0" + "flip": "1.0.0", + "zalgolize": "1.2.4" } } diff --git a/zalgoall.gif b/zalgoall.gif new file mode 100644 index 0000000..e6b911c Binary files /dev/null and b/zalgoall.gif differ