Skip to content

Indent guide #7

@rhysd

Description

@rhysd

Consider to add indent guide to the result snippets. Since snippets usually include indents and sometimes the indent level is deep, it would be helpful to know the level.

    ┊   match self.regions.first().copied() {
    ┊   ┊   Some((s, e)) if o == s && o < e => RegionBoundary::Start,
    ┊   ┊   Some((_, e)) if o == e => {
    ┊   ┊   ┊   // When the next region is adjcent, skip changing highlight
    ┊   ┊   ┊   match self.regions.get(1) {
    ┊   ┊   ┊   ┊   Some((s, _)) if o == *s => RegionBoundary::NotFound,
    ┊   ┊   ┊   ┊   _ => RegionBoundary::End,
    ┊   ┊   ┊   }
    ┊   ┊   }
    ┊   ┊   _ => RegionBoundary::NotFound,
    ┊   }
  • Character: (U+250A)
  • Color: gutter
  • Option: --no-indent-guide (indent guide is enabled by default)

Note that this feature is automatically disabled by --ascii-lines.

Challenges:

  • How to calculate indent width?
    • Width would be calculated at making chunks from grep matches.
  • How to handle tab character?
  • How to propagate the calculated indent width to a printer?

I should to confirm that the guides are not so noisy in outputs before implementing this by crafting an example output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions