Skip to content

fix(parser, highlighter): more consistent and accurate parsing/highlighting for erroneous pipe tokens.#17932

Draft
blindFS wants to merge 7 commits intonushell:mainfrom
blindFS:fix_lexer
Draft

fix(parser, highlighter): more consistent and accurate parsing/highlighting for erroneous pipe tokens.#17932
blindFS wants to merge 7 commits intonushell:mainfrom
blindFS:fix_lexer

Conversation

@blindFS
Copy link
Copy Markdown
Contributor

@blindFS blindFS commented Mar 30, 2026

Closes #17916
Closes #17951

A hack following this.

Release notes summary - What our users need to know

Fixed a bug of inconsistent parsing results for code snippets with 2>, out>|, o>|, 2> or 2>&1 in them.

Tasks after submitting

N/A

blindFS and others added 5 commits March 28, 2026 23:11
-----

Co-authored-by: pickx <4918121+pickx@users.noreply.github.com>
@github-actions github-actions bot added the A:parser Issues related to parsing label Mar 30, 2026
@blindFS blindFS marked this pull request as draft April 1, 2026 01:51
@fdncred
Copy link
Copy Markdown
Contributor

fdncred commented Apr 1, 2026

is there any way to make these garbage/red at the same time e.g. when you finish typing it? On the incorrect ones, when I type another space and a character it turns red.

2> (correct)

image

out>| (incorrect)

image

o>| (incorrect)

image

2>&1 (incorrect)

image

@blindFS
Copy link
Copy Markdown
Contributor Author

blindFS commented Apr 1, 2026

@fdncred, that's a different issue, I'm afraid. Just like ps | or ast -f 'ps |', the pipe is just not there, because it is assigned to the 2nd pipeline element, not the first one, which is absent at that moment...

I didn't dig deep into that, but my hunch is that another dirty span hack might not be the best solution for that matter.

@blindFS blindFS closed this Apr 1, 2026
@blindFS blindFS deleted the fix_lexer branch April 1, 2026 13:30
@blindFS blindFS restored the fix_lexer branch April 1, 2026 14:23
@blindFS blindFS reopened this Apr 1, 2026
@blindFS
Copy link
Copy Markdown
Contributor Author

blindFS commented Apr 2, 2026

@fdncred, I'll mark this PR as ready for review. But we can hold on to the merging in case someone would come up with a better solution.

@blindFS blindFS marked this pull request as ready for review April 2, 2026 01:13
@fdncred
Copy link
Copy Markdown
Contributor

fdncred commented Apr 2, 2026

@blindFS ok. Ping me when you're ready.

@blindFS blindFS marked this pull request as draft April 3, 2026 06:58
WindSoilder pushed a commit that referenced this pull request Apr 20, 2026
Fixes #17957

This could potentially be dangerous! I have no idea whether there're
features implemented based on this bug/feature.

This has a hard conflict with #17932, and is better addressed before
that.

## Release notes summary - What our users need to know

Fixed a bug of lossy parsing of incomplete pipelines end with `|`, which
is noticeable via REPL highlighting.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A:parser Issues related to parsing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duplication of redirection pipes in ast -f No error highlighting when calling external program

2 participants