Skip to content

Commit

Permalink
Added support for Zalgo
Browse files Browse the repository at this point in the history
  • Loading branch information
Nate Drake committed Aug 9, 2018
1 parent cbca3b1 commit 292fe6f
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 9 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
22 changes: 22 additions & 0 deletions extension.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const vscode = require('vscode');
const flip = require('flip');
const zalgo = require('zalgolize');

function activate(context) {

Expand All @@ -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;

Expand Down
23 changes: 22 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -16,14 +16,19 @@
"Other"
],
"activationEvents": [
"onCommand:extension.flipIt"
"onCommand:extension.flipIt",
"onCommand:extension.zalgoIt"
],
"main": "./extension",
"contributes": {
"commands": [
{
"command": "extension.flipIt",
"title": "Flip It"
},
{
"command": "extension.zalgoIt",
"title": "Zalgo It"
}
]
},
Expand All @@ -39,6 +44,7 @@
"@types/mocha": "^2.2.42"
},
"dependencies": {
"flip": "^1.0.0"
"flip": "1.0.0",
"zalgolize": "1.2.4"
}
}
Binary file added zalgoall.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 292fe6f

Please sign in to comment.