Skip to content

Commit

Permalink
chore: fix wording and editor command group
Browse files Browse the repository at this point in the history
  • Loading branch information
aprilandjan committed Mar 7, 2020
1 parent 6cf553d commit e6f7a57
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how

### Feature

- Add `Revert Tree Strings to Text` command in `Command Palette`.
- Add `Revert Tree String to Text` command in `Command Palette`.

## [1.0.1] - 2019-01-23

Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
[![Download Count](https://img.shields.io/visual-studio-marketplace/d/aprilandjan.ascii-tree-generator)](https://marketplace.visualstudio.com/items?itemName=aprilandjan.ascii-tree-generator)
[![Download Count](https://img.shields.io/visual-studio-marketplace/i/aprilandjan.ascii-tree-generator)](https://marketplace.visualstudio.com/items?itemName=aprilandjan.ascii-tree-generator)

A VS Code extension to generate ascii tree of directories or format selected text to tree strings.
A VS Code extension to generate ascii tree of directories or format selected text to tree string.

## Usage

This extension provides convenient way to generate ascii tree strings for directory in workspace explorer. Besides, you can select text in editor and format it to tree strings easily.
This extension provides convenient way to generate ascii tree string for directory in workspace explorer. Besides, you can select text in editor and format it to tree string easily.

### Format Text to Tree Strings
### Format Text to Tree String

Write simple tree lines in certain syntax (see example below), select these lines, right-click on text and click `Format Text to Tree Strings` menu:
Write simple tree lines in certain syntax (see example below), select these lines, right-click on text and click `Format Text to Tree String` menu:

![Format Text to Tree Strings](./images/text.gif)
![Format Text to Tree String](./images/text.gif)

The following kinds of line syntax is supported to correctly format to tree strings:
The following kinds of line syntax is supported to correctly format to tree string:

- lines started with `indent(space or tab)` characters:

Expand Down Expand Up @@ -53,13 +53,13 @@ They should be formatted to:
```

**Note**: In most cases, you can just simply undo the formatting operation using the vscode editor `undo` ability. The default shortcut is <kbd>cmd</kbd>+<kbd>Z</kbd>. Besides,
You can open the VS Code `Command Palette` and execute `Revert Tree Strings to Text` to revert tree strings back to hash-style texts, in case that your undo history is lost for some reason.
You can open the VS Code `Command Palette` and execute `Revert Tree String to Text` to revert tree string back to hash-style texts, in case that your undo history is lost for some reason.

### Generate Tree Strings for Directory
### Generate Tree String for Directory

Right-click on `Explorer` directories, click `Generate Tree Strings for Directory` menu:
Right-click on `Explorer` directories, click `Generate Tree String for Directory` menu:

![Generate Tree Strings for Directory](./images/directory.gif)
![Generate Tree String for Directory](./images/directory.gif)

**Note**: This process of walking through files is asynchronous. So if you include some heavy-nested folders, `node_modules` for example, the result will be slow to show.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
"editor/context": [
{
"command": "extension.asciiTreeGeneratorFromText",
"group": "1_modification",
"group": "asciiTreeGenerator@1",
"when": "editorHasSelection"
}
]
Expand Down
2 changes: 1 addition & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export function activate(context: vscode.ExtensionContext) {
registerCommand('extension.asciiTreeGeneratorFromText', async (resource: any) => {
const editor = vscode.window.activeTextEditor;
if (!editor || editor.selection.isEmpty) {
vscode.window.showWarningMessage('No text selected. Please select text in editor before generating Tree Strings!');
vscode.window.showWarningMessage('No text selected. Please select text in editor before generating Tree String!');
return;
}
// find and select lines where current selection range locates
Expand Down
2 changes: 1 addition & 1 deletion src/lib/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function createTreeString (start: string, fill: string, size: number = 3) {
return result + ' ';
}

/** generate tree strings */
/** generate tree string */
export function generate (items: IFileTreeItem[], options: IFormatOptions = {}) {
const {
eol = getUserEOL(),
Expand Down
2 changes: 1 addition & 1 deletion src/lib/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export interface IVsCodeConfig {
export interface IFormatOptions {
/** fill left with same minimal space */
fillLeft?: boolean;
/** root text added to the formatted tree strings */
/** root text added to the formatted tree string */
root?: string;
/** tree charset settings */
charset?: ICharset;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/text.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { IFileTreeItem } from "./interface";

/** get line array. these lines are trimLeft with their common beginning substrings. */
/** get line array. these lines are trimLeft with their common beginning substring. */
function getLines (text: string = '') {
// split selected text into separate lines
// empty lines are ignored
Expand Down
2 changes: 1 addition & 1 deletion src/test/extension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ suite('Extension Tests', function () {
// assert.equal(-1, [1, 2, 3].indexOf(5));
// assert.equal(-1, [1, 2, 3].indexOf(0));
// });
test('revert tree strings to text', function () {
test('revert tree string to text', function () {
const rootText = fs.readFileSync(path.join(__dirname, '../../fixtures/root.txt'), 'utf8');
const rootReverted = fs.readFileSync(path.join(__dirname, '../../fixtures/root-reverted.txt'), 'utf8');
const reverted = revertTreeString(rootText);
Expand Down

0 comments on commit e6f7a57

Please sign in to comment.