Skip to content

add(highlight, complete): suggest/complete cd commands in mkdir && cd chains - #12875

Open
ahhyoushh wants to merge 1 commit into
fish-shell:masterfrom
ahhyoushh:master
Open

add(highlight, complete): suggest/complete cd commands in mkdir && cd chains#12875
ahhyoushh wants to merge 1 commit into
fish-shell:masterfrom
ahhyoushh:master

Conversation

@ahhyoushh

Copy link
Copy Markdown

When a user chains mkdir foo && cd foo, the foo argument to cd was previously highlighted as an error (since it doesn't exist on disk at the time of typing), and no autosuggestion or completions were offered.

Specifically:

  • highlight.rs avoids coloring these pending directories as errors, using trailing-slash normalized paths for robust matching.
  • complete.rs correctly offers these pending directories as relative completion candidates and properly deduplicates them.
  • Added extract_mkdir_args_unescaped in parse_util.rs to keep AST parsing DRY and avoid duplicate extraction logic.

This uses strictly on-the-line parsing and does not rely on history.

TODOs

  • If addressing an issue, a commit message mentions Fixes issue #<issue-number>
  • Changes to fish usage are reflected in user documentation/manpages.
  • Tests have been added for regressions fixed
  • User-visible changes noted in CHANGELOG.rst (skipped)

 When a user chains `mkdir foo && cd foo`, the `foo` argument to `cd` was
    previously highlighted as an error (since it doesn't exist on disk at the
    time of typing), and no autosuggestions or completions were offered.

    Specifically:
    - `highlight.rs` avoids coloring these pending directories as errors,
      using trailing-slash normalized paths for robust matching.
    - `complete.rs` correctly offers these pending directories as relative
      completion candidates and properly deduplicates them.
    - Added `extract_mkdir_args_unescaped` in `parse_util.rs` to keep AST
      parsing DRY and avoid duplicate extraction logic.

    This uses strictly on-the-line parsing and does not rely on history.
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.

1 participant