Skip to content

Commit 3a33e8f

Browse files
refactor: improve configuration names, docs and coding styles (#15)
* Whitespace formatting with TABs instead of spaces * TSLint is now deprecated (use eslint-typescript instead) * Reformat for easier debugging later on * Update property names and descriptions * Upgrade to at least version 1.50.0 of VSCode engine * Rename property names * Reorder properties * Formalize README contents * Simply write MIT instead * Cleaned up strings and removed uncessary argument * Changed to new property names * Cleaned up strings * Updated CHANGELOG.md
1 parent 48264eb commit 3a33e8f

File tree

13 files changed

+858
-721
lines changed

13 files changed

+858
-721
lines changed

.vscode/extensions.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,22 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
55

66
## [Unreleased]
77

8+
## [1.2.5] - 2021-06-24
9+
10+
### Changed
11+
12+
- Reformatted files for easier readability (`Prettier` extension)
13+
- Formalized [README.md](README.md) contents
14+
- Changed property names (should not have spaces in them and was not descriptive to current extension)
15+
16+
### Fixed
17+
18+
- Some bug in VSCode `bin` installation when using yarn
19+
- To fix, change stable releases link from `https://vscode-update.azurewebsites.net/api/releases/stable` to `https://update.code.visualstudio.com/api/releases/stable`
20+
821
## [1.2.4] - 2020-09-11
922

10-
- Remove the introduction (temporarily) for `indent` character usage in Readme since it is buggy (see [#13](https://github.com/aprilandjan/vscode-ascii-tree-generator/issues/13)).
23+
- Remove the introduction (temporarily) for `indent` character usage in [README.md](README.md) since it is buggy (see [#13](https://github.com/aprilandjan/vscode-ascii-tree-generator/issues/13)).
1124

1225
## [1.2.3] - 2020-04-29
1326

README.md

Lines changed: 45 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
1-
# [vscode ascii tree generator](https://marketplace.visualstudio.com/items?itemName=aprilandjan.ascii-tree-generator)
1+
# [VSCode ASCII Tree Generator](https://marketplace.visualstudio.com/items?itemName=aprilandjan.ascii-tree-generator)
22

33
[![Build Status](https://dev.azure.com/merlinye/ascii-tree-generator/_apis/build/status/aprilandjan.ascii-tree-generator?branchName=master)](https://dev.azure.com/merlinye/ascii-tree-generator/_build/latest?definitionId=1?branchName=master)
44
[![Download Count](https://img.shields.io/visual-studio-marketplace/d/aprilandjan.ascii-tree-generator)](https://marketplace.visualstudio.com/items?itemName=aprilandjan.ascii-tree-generator)
55
[![Download Count](https://img.shields.io/visual-studio-marketplace/i/aprilandjan.ascii-tree-generator)](https://marketplace.visualstudio.com/items?itemName=aprilandjan.ascii-tree-generator)
66

7-
A vscode extension to generate ascii tree of directories or format selected text to tree string.
7+
Generate ASCII tree of directories or format selected text into its corresponding "tree string" representation.
88

99
## Usage
1010

11-
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.
11+
Generate ASCII "tree strings" for any directory in the workspace explorer. Aside from that, you can also select pre-formatted text in the explorer and format it to its corresponding "tree string" easily.
1212

13-
### Format Text to Tree String
13+
### Format Selected Text to Tree String
1414

15-
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:
15+
Using the `#` (octothorpe/hash) character, you can specify the depth of the current element. After writing a few lines (see example below), select the targetted pre-formatted lines, right-click on the highlighted text selection, and click `Format to Tree String` menu option. This will replace the selected, pre-formatted text, into its corresponding "tree string" representation.
1616

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

19-
The lines started with `hash(#)` characters can be used to represent the depth of the directory tree. For example:
19+
For clarity, each line of your target tree structure should begin with at least a single `#` (octothorpe/hash) character. At most, each line can only have one more additional `#` than any line above it. This will ensure proper formatting. By placing multiple `#` symbols, it is possible to designate the depth of a certain element.
2020

21-
```
21+
#### Demonstration
22+
23+
**Pre-Formatted Tree String**
24+
25+
```txt
2226
# public
2327
# dist
2428
## index.d.ts
@@ -27,9 +31,9 @@ The lines started with `hash(#)` characters can be used to represent the depth o
2731
## index.ts
2832
```
2933

30-
They should be formatted to:
34+
**Formatted Tree String**
3135

32-
```
36+
```txt
3337
.
3438
├── public
3539
├── dist
@@ -39,42 +43,51 @@ They should be formatted to:
3943
└── index.ts
4044
```
4145

42-
**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,
43-
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.
46+
#### Addendum
47+
48+
In cases where you would like to undo the formatting operation, simply use VSCode's editor `undo` option (`Edit`&rarr;`Undo`). You can optionally use the keybindings for undo as well (<kbd>⌘</kbd>+<kbd>Z</kbd> on Mac or <kbd>CTRL</kbd>+<kbd>Z</kbd> on Windows). However, this option will fail in cases where the `undo` operation is invalid (e.g. text inside downloaded materials).
49+
50+
In all cases, you can revert formatting tree strings back to their preformatted versions by selecting the formatted tree string, heading to the VSCode Command Pallete (<kbd>⌘</kbd>+<kbd>SHIFT</kbd>+<kbd>P</kbd> on Mac or <kbd>CTRL</kbd>+<kbd>SHIFT</kbd>+<kbd>P</kbd> on Windows), and executing `Revert Tree String to Text`. As long as the matching lines up, this should provide back your intended pre-formatted tree string.
4451

4552
### Generate Tree String for Directory
4653

47-
Right-click on `Explorer` directories, click `Generate Tree String for Directory` menu:
54+
In addition to being able to format pre-formatted tree strings, you may also generate tree strings for directories inside your current workspace (directories appearing in `Explorer` tab). To do so, right-click on any directory within the `Explorer` tab and select the `Generate Tree String for Directory` menu option. An example is shown below.
4855

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

51-
**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.
58+
#### Addendum
59+
60+
The walking process through files is performed asynchronously. Therefore, selecting heavily-nested folders (e.g. `node_modules`) will directly affect performance speed.
5261

5362
## Configuration
5463

55-
Each character of the tree can be defined by its ASCII code (or UTF character code in general). The theoretical range for character codes is 0 to 65535. However, not every code will lead to a printable character and may cause formatting problems.
56-
The available parameters are:
64+
Each tree string character can be defined by its ASCII code representation (UTF character code, more generally). As such, the theorectical range for character codes is `0` to `65535` (two bytes). However, and important to note, is that not every character code is printable and/or may cause formatting issues.
5765

58-
| Name | Default Char Code | Default Character | Description |
59-
| -----------------------------| ---- | -------- | --------------- |
60-
| Blank element character code | 32 | '&#32;' | For blanks / spaces |
61-
| Child element character code | 9500 | '&#9500;' | For intermediate child elements |
62-
| Dash element character code | 9472 | '&#9472;' | For horizontal dashes |
63-
| Last element character code | 9492 | '&#9492;' | For the last element of a path |
64-
| Parent element character code | 9474 | '&#9474;' | For vertical parent elements |
65-
| Root element character code | 46 | '&#46;' | For the root element (on top) |
66+
The available parameters are:
6667

68+
| Property (Setting) Name | Default Character Code | Default Character | Description |
69+
| ---------------------------------- | :--------------------: | :----------------: | ---------------------------- |
70+
| `asciiTreeGenerator.rootElement` | `46` | <kbd>&#46;</kbd> | For root elements |
71+
| `asciiTreeGenerator.parentElement` | `9474` | <kbd>&#9474;</kbd> | For vertical parent elements |
72+
| `asciiTreeGenerator.childElement` | `9500` | <kbd>&#9500;</kbd> | For child elements |
73+
| `asciiTreeGenerator.lastElement` | `9492` | <kbd>&#9492;</kbd> | For last elements of paths |
74+
| `asciiTreeGenerator.dashElement` | `9472` | <kbd>&#9472;</kbd> | For horizontal dash elements |
75+
| `asciiTreeGenerator.blankElement` | `32` | <kbd>&#32;</kbd> | For blank / space elements |
6776

6877
### Sample Configurations
6978

70-
| Configuration | Blank | Child | Dash | Last | Parent | Root |
71-
| ----------------- | ---------- | -------------- | -------------- | -------------- | -------------- | -------------- |
72-
| Default | 32 (&#32;) | 9500 (&#9500;) | 9472 (&#9472;) | 9492 (&#9492;) | 9474 (&#9474;) | 46 (&#46;) |
73-
| Double Line | 32 (&#32;) | 9568 (&#9568;) | 9552 (&#9552;) | 9562 (&#9562;) | 9553 (&#9553;) | 9559 (&#9559;) |
74-
| Classic | 32 (&#32;) | 124 (&#124;) | 45 (&#45;) | 43 (&#43;) | 124 (&#124;) | 43 (&#43;) |
75-
| Classic Rounded | 32 (&#32;) | 124 (&#124;) | 45 (&#45;) | 96 (&#96;) | 124 (&#124;) | 46 (&#43;) |
76-
| Exclamation Marks | 32 (&#32;) | 35 (&#35;) | 61 (&#61;) | 42 (&#42;) | 33 (&#33;) | 35 (&#35;) |
79+
Commonly used configurations that you can manually enable by entering the values for each of the aforementioned property names above (perfom these changes inside a `settings.json` file).
80+
81+
| Configuration | Root | Parent | Child | Last | Dash | Blank |
82+
| :---------------: | :-----------------------: | :-----------------------: | :-----------------------: | :-----------------------: | :-----------------------: | :-------------------: |
83+
| Default | `46` <kbd>&#46;</kbd> | `9474` <kbd>&#9474;</kbd> | `9500` <kbd>&#9500;</kbd> | `9492` <kbd>&#9492;</kbd> | `9472` <kbd>&#9472;</kbd> | `32` <kbd>&#32;</kbd> |
84+
| Double Line | `9559` <kbd>&#9559;</kbd> | `9553` <kbd>&#9553;</kbd> | `9568` <kbd>&#9568;</kbd> | `9562` <kbd>&#9562;</kbd> | `9552` <kbd>&#9552;</kbd> | `32` <kbd>&#32;</kbd> |
85+
| Classic | `43` <kbd>&#43;</kbd> | `124` <kbd>&#124;</kbd> | `124` <kbd>&#124;</kbd> | `43` <kbd>&#43;</kbd> | `45` <kbd>&#45;</kbd> | `32` <kbd>&#32;</kbd> |
86+
| Classic Rounded | `43` <kbd>&#43;</kbd> | `124` <kbd>&#124;</kbd> | `124` <kbd>&#124;</kbd> | `96` <kbd>&#96;</kbd> | `45` <kbd>&#45;</kbd> | `32` <kbd>&#32;</kbd> |
87+
| Exclamation Marks | `35` <kbd>&#35;</kbd> | `33` <kbd>&#33;</kbd> | `35` <kbd>&#35;</kbd> | `42` <kbd>&#42;</kbd> | `61` <kbd>&#61;</kbd> | `32` <kbd>&#32;</kbd> |
88+
89+
## Issues and Contribution
7790

78-
## Issues & Contribution
91+
Please feel free to submit any issues or bugs you find with the extension. More generally, please reach out if you have any questions on how to use the extension.
7992

80-
Please feel free to submit issues if you have any questions. Contribution is also welcomed :)
93+
Finally, contribution or ideas are humbly welcomed so please check us out on GitHub :) !

0 commit comments

Comments
 (0)