mirror of
https://github.com/nushell/nushell.git
synced 2025-08-22 13:11:08 +02:00
Fixes #12965. # Description The syntax highlighter currently can't tell the difference between external command calls and _alias_ calls to external commands. This leads to unexpected behavior when `highlight_resolved_externals` is enabled. Specifically, when this option is enabled, alias calls aliasing external commands are highlighted according to `color_config.shape_external_resolved` if and only if a command exists in the PATH directories whose name happens to be the same as the name of the alias. The syntax highlighter also can't tell the difference between internal command calls and alias calls aliasing internal commands, but this just results in these alias calls being highlighted like normal internal command calls, which isn't too unexpected. It is ambiguous what the correct behavior should be. The three options I can think of are: 1. Treat all alias calls (both aliasing internal and external commands) as a new shape, like `shape_alias`, and highlight accordingly. 2. Highlight all alias calls like internal command calls, including those aliasing external commands. 3. Highlight alias calls aliasing external commands according to how the aliased command would have been highlighted. I personally like 3. and it was easy to implement (unless I missed something), so that's what this PR does right now. I'll be happy to implement a different solution if appropriate. Discussion welcome :) # User-Facing Changes All changes are in syntax highlighting only. Behavior _before_ this PR:  Behavior _after_ this PR:  # Tests + Formatting I didn't write any tests because I couldn't find any existing tests for syntax highlighting.