This commit is contained in:
Sean McBreen 2015-11-06 13:13:57 -08:00
Родитель 2119780596
Коммит 4483fc838f
3 изменённых файлов: 27 добавлений и 28 удалений

Просмотреть файл

@ -1,31 +1,30 @@
# README
# Functionality
This is an example of how to extend [VS Code](http://code.visualstudio.com/Docs/Extensions).
This is an example of how to extend [VS Code] with some useful text manipulation tools. These include:
It covers off the following core concepts:
* Activating your code when a Markdown file is loaded
* Working with QuickOpen to create the menu (and sub menu)
* Binding a function to a keystroke [Alt+T] and `command` - which opens up the menu
* Leveraging external Node modules
* [figlet](https://www.npmjs.com/package/figlet) = ASCII art,
* [underscore.string](https://www.npmjs.com/package/underscore.string) = string processing
* Grabbing the selected content from the text editor, processing it and replacing it
* Adding metadata to the `project.json` so the extension looks OK in the gallery
* Common casing operations e.g. toUpper, ToLower, Reverse and more
* HTML encoding and Decoding
* ASCII Art
# Keybinding 'Alt+T' - Text Tools
Also available as `command` by pressing `F1` the typing `Text Functions`.
# Install
Hit `Alt+T` to get some text replacement tools e.g.
Open up VS Code and hit `F1` and type `ext` select install and type `spell` hit enter and reload window to enable.
* toUpper
* toLower
* Reverse
* HTML Encode
* ..
![install and work](images/spell-install.gif)
![Tools](images/Commands.gif)
If you select ASCII Art you will get a secondary menu where you can choose the font.
# Update a selection
# Versions
* 0.1.0 - Added ASCII Art and refactored code base to 50% of size
The extension is activated when you load up a `Markdown` file and you open up a menu of commands by pressing `Alt+T`. Multi selection is supported for all commands. If you select ASCII Art you will get a secondary menu where you can choose the font.
```
BOO
```
# Known Issues
Here are a few common issues.
* The selection zone post edit can be mis-mapped.

Просмотреть файл

@ -27,7 +27,7 @@ function toUpper(e: TextEditor, d: TextDocument, sel: Selection[]) {
let txt: string = d.getText(new Range(sel[x].start, sel[x].end));
edit.replace(sel[x], txt.toUpperCase());
});
e.updateSelection(sel);
//e.updateSelection(sel);
}
}
@ -39,7 +39,7 @@ function toLower(e: TextEditor, d: TextDocument, sel: Selection[]) {
let txt: string = d.getText(new Range(sel[x].start, sel[x].end));
edit.replace(sel[x], txt.toLowerCase());
});
e.updateSelection(sel)
//e.updateSelection(sel);
}
}
@ -66,7 +66,7 @@ function processSelection(e: TextEditor, d: TextDocument, sel: Selection[], form
let endPos: Position = new Position(sel[x].start.line + txt.split(/\r\n|\r|\n/).length, sel[x].start.character + txt.length);
let replaceRange: Range = new Range(startPos, endPos);
e.updateSelection(replaceRange);
//e.updateSelection(replaceRange);
});
}
}
@ -128,7 +128,7 @@ function textFunctions() {
});
break;
default:
console.log("hum this should not have happend - no selction")
console.log("hum this should not have happend - no selection")
break;
}
});

Просмотреть файл

@ -24,7 +24,7 @@
"onLanguage:markdown"
],
"engines": {
"vscode": "*"
"vscode": "0.10.x"
},
"main": "./out/extension",
"contributes": {