Skip to content

refactor: move coloring logic into coloring.rs, tighten visibility#342

Closed
Copilot wants to merge 43 commits intomasterfrom
copilot/add-todos-for-main-pr
Closed

refactor: move coloring logic into coloring.rs, tighten visibility#342
Copilot wants to merge 43 commits intomasterfrom
copilot/add-todos-for-main-pr

Conversation

Copy link
Contributor

Copilot AI commented Mar 7, 2026

Closes #343.

Sub-PR targeting copilot/add-color-flag-and-mapping (#339). Resolves the five TODO items left open in that PR.

Changes

src/visualizer/coloring.rs

  • Added Coloring::colored_slice — combines both TODO blocks from methods.rs into a single method that accepts a path-components iterator, has_children, and a TreeHorizontalSlice<String>, returning MaybeColoredTreeHorizontalSlice<'a>
  • Coloring::node_color: pub(super) → private (only called by colored_slice)
  • Color::ansi_prefix: pub(super) → private
  • AnsiPrefix: pub(super) structstruct
  • ColoredTreeHorizontalSlice fields: pub(super) → private (struct constructed exclusively inside colored_slice)
  • Removed all three TODO comments

src/visualizer/methods.rs

  • Replaced the two TODO blocks (14 lines) with a match self.coloring that delegates to coloring.colored_slice(...)
  • Dropped unused imports: ColoredTreeHorizontalSlice, pipe_trait::Pipe (replaced pipe_as_ref(once) with std::iter::once)
// Before: two separate TODO-marked blocks
let colored = self.coloring.and_then(|coloring| { /* build path, call node_color */ });
let tree = match colored { Some((color, ls_colors)) => Colorful(...), None => Colorless(...) };

// After: single delegating call
let tree = match self.coloring {
    Some(coloring) => coloring.colored_slice(path_components, has_children, slice),
    None => MaybeColoredTreeHorizontalSlice::Colorless(tree_horizontal_slice),
};

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 26 commits March 7, 2026 21:38
Co-authored-by: KSXGitHub <11488886+KSXGitHub@users.noreply.github.com>
…ify rendering

Co-authored-by: KSXGitHub <11488886+KSXGitHub@users.noreply.github.com>
…, update docs

Co-authored-by: KSXGitHub <11488886+KSXGitHub@users.noreply.github.com>
… remove redundant attributes

Co-authored-by: KSXGitHub <11488886+KSXGitHub@users.noreply.github.com>
…structure TreeHorizontalSlice

Co-authored-by: KSXGitHub <11488886+KSXGitHub@users.noreply.github.com>
…ucturing

Co-authored-by: KSXGitHub <11488886+KSXGitHub@users.noreply.github.com>
…ice/aligned_plain_slice

Co-authored-by: KSXGitHub <11488886+KSXGitHub@users.noreply.github.com>
…loredTreeHorizontalSlice

Co-authored-by: KSXGitHub <11488886+KSXGitHub@users.noreply.github.com>
…re coloring, move color logic to App::run

Co-authored-by: KSXGitHub <11488886+KSXGitHub@users.noreply.github.com>
…erse-kinds workspace, fix tests

Co-authored-by: KSXGitHub <11488886+KSXGitHub@users.noreply.github.com>
Co-authored-by: KSXGitHub <11488886+KSXGitHub@users.noreply.github.com>
Co-authored-by: KSXGitHub <11488886+KSXGitHub@users.noreply.github.com>
…_COLORS

Co-authored-by: KSXGitHub <11488886+KSXGitHub@users.noreply.github.com>
… lint

Co-authored-by: KSXGitHub <11488886+KSXGitHub@users.noreply.github.com>
…ollision

Co-authored-by: KSXGitHub <11488886+KSXGitHub@users.noreply.github.com>
Co-authored-by: KSXGitHub <11488886+KSXGitHub@users.noreply.github.com>
… ansi_prefixes to ls_colors, update doc comment, make lscolors optional under color feature

Co-authored-by: KSXGitHub <11488886+KSXGitHub@users.noreply.github.com>
…endency

Co-authored-by: KSXGitHub <11488886+KSXGitHub@users.noreply.github.com>
Co-authored-by: KSXGitHub <11488886+KSXGitHub@users.noreply.github.com>
Copilot AI changed the title [WIP] Add TODO items for the main PR refactor: move coloring logic into coloring.rs, tighten visibility Mar 7, 2026
@KSXGitHub
Copy link
Owner

Superseded by #343.

@KSXGitHub KSXGitHub closed this Mar 7, 2026
@KSXGitHub KSXGitHub deleted the copilot/add-todos-for-main-pr branch March 7, 2026 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants