raycast / extensions

Everything you need to extend Raycast.
https://developers.raycast.com
MIT License
5.03k stars 2.76k forks source link

[File Tree Generator] Configurable Indentation #13207

Open BorisAnthony opened 1 week ago

BorisAnthony commented 1 week ago

Extension

https://www.raycast.com/csharp/file-tree-generator

Description

Currently, the output returns indentations of 4 characters: whatever combination of bar, up+right, vert+right is needed as well as 2 spaces or "left" bars.

This results in perfectly fine "trees" but some users may prefer something a little bit more horizontally compact. The new configuration option would provide this to such users.

Behind the scenes, this would be achieved by reducing the number of spaces and "left" bars from 2 to 1.

For example, from file-tree-generator/src/line-strings.ts :

    CHILD: "├── ",
    LAST_CHILD: "└── ",
    DIRECTORY: "│   ",
    EMPTY: "    ",

instead, the strings could be:

    CHILD: "├─ ",
    LAST_CHILD: "└─ ",
    DIRECTORY: "│  ",
    EMPTY: "   ",

The difference in output would look like this: Default (4 spaces)

root
├── level1
│   ├── level11
│   └── level12
├── level2
└── level3

Can be reduced to: 3 spaces

root
├─ level1
│  ├─ level11
│  └─ level12
├─ level2
└─ level3

Who will benefit from this feature?

Anyone who would prefer a more compact tree.

Anything else?

The easy—but non-intuitive from a UX perspective—way to implement this would be to simply add "3 space alternatives" in the "Charset" options. e.g.:

Charset:
- UTF-8 Default Indent
- UTF-8 Narrow Indent
- ASCII Default Indent
- ASCII Narrow Indent

Proper way would be to

  1. Figure out the UI language and affordances and add them as part of the UI. e.g.: Set indentation depth: Wide (default) / Narrow
  2. a) Reflect the possibilities in the const LINE_STRINGS or
  3. b) Generate the LINE_STRINGS based on the selected configuration (maybe overkill…)
raycastbot commented 1 week ago

Thank you for opening this issue!

🔔 @noidwasavailable you might want to have a look.

💡 Author and Contributors commands The author and contributors of `csharp/file-tree-generator` can trigger bot actions by commenting: - `@raycastbot close this issue` Closes the issue. - `@raycastbot rename this issue to "Awesome new title"` Renames the issue. - `@raycastbot reopen this issue` Reopens the issue. - `@raycastbot assign me` Assigns yourself to the issue. - `@raycastbot good first issue` Adds the "Good first issue" label to the issue. - `@raycastbot keep this issue open` Make sure the issue won't go stale and will be kept open by the bot.