Describe the bug
Fast-syntax-highlighting correctly colors command-line arguments when a command is written on a single line, but fails to apply syntax highlighting when the same command is split across multiple lines using backslashes (\).
Environment
- Shell: zsh 5.9 (x86_64-apple-darwin25.0)
- Plugin: fast-syntax-highlighting (zdharma-continuum)
- OS: Apple macOS 26.2
- Terminal: iTerm2 3.6.6
Steps to reproduce
- Write a Python command with multiple arguments in a single line:
python -m src.cli --building_name "Building" --building_address "New York, 1st Ave" --region "New Jersey" --tht -3.1 --zht 214 --text -28 --tint 20 --humidity 55 --wall_type "External heated wall" --wall_layers wall_structure_example.json --wall_area 100 --thermal_homogeneity 0.85 --report_format pdf --report_filename example_survey_plan_2
Observed: Arguments like --building_name, --region, --tht, etc., are correctly highlighted.
- Write the same command split across multiple lines with backslashes:
python -m src.cli \
--building_name "Building" \
--building_address "New York, 1st Ave" \
--region "New Jersey" \
--tht -3.1 \
--zht 214 \
--text -28 \
--tint 20 \
--humidity 55 \
--wall_type "External heated wall" \
--wall_layers wall_structure_example.json \
--wall_area 100 \
--thermal_homogeneity 0.85 \
--report_format pdf \
--report_filename example_survey_plan_2
Observed: Highlighting is either missing or inconsistent after the first line.
Actual Behavior
- The first line (
python -m src.cli \) is highlighted correctly.
- Subsequent lines lose highlighting, appearing as plain text or with incorrect tokenization.
- This makes it harder to visually parse long commands, especially in scripts or when preparing complex CLI invocations.
Expected behavior
Expected Behavior
The syntax highlighting should be consistent whether the command is on one line or split across multiple lines. All flags (--option), strings ("value"), numbers, and file paths should be colored appropriately.
Screenshots and recordings
- Single-line command (correctly highlighted):
- Multi-line command (highlighting broken):
Operating System & Version
darwin25.0 | apple | x86_64 | x86_64 | x86_64 i386
Zsh version
5.9
Terminal emulator
xterm-256color
If using WSL on Windows, which version of WSL
None
Additional context
Possible Cause
The highlighter likely tokenizes commands line-by-line without considering line continuation characters (\). When a line ends with \, the following line should be treated as part of the same command for highlighting purposes.
Suggested Fix
Update the highlighting logic to:
- Detect backslash (
\) at the end of a line.
- Merge subsequent lines into a single logical command for tokenization and highlighting.
- Apply the same syntax rules to the concatenated content as would be applied to a single-line command.
Additional Notes
This issue affects readability and usability when writing or reviewing long commands, especially in shell scripts, documentation, or CLI examples. Fixing this would improve the developer experience for users who prefer or need to break long commands into multiple lines.
Describe the bug
Fast-syntax-highlighting correctly colors command-line arguments when a command is written on a single line, but fails to apply syntax highlighting when the same command is split across multiple lines using backslashes (
\).Environment
Steps to reproduce
Observed: Arguments like
--building_name,--region,--tht, etc., are correctly highlighted.Observed: Highlighting is either missing or inconsistent after the first line.
Actual Behavior
python -m src.cli \) is highlighted correctly.Expected behavior
Expected Behavior
The syntax highlighting should be consistent whether the command is on one line or split across multiple lines. All flags (
--option), strings ("value"), numbers, and file paths should be colored appropriately.Screenshots and recordings
Operating System & Version
darwin25.0 | apple | x86_64 | x86_64 | x86_64 i386
Zsh version
5.9
Terminal emulator
xterm-256color
If using WSL on Windows, which version of WSL
None
Additional context
Possible Cause
The highlighter likely tokenizes commands line-by-line without considering line continuation characters (
\). When a line ends with\, the following line should be treated as part of the same command for highlighting purposes.Suggested Fix
Update the highlighting logic to:
\) at the end of a line.Additional Notes
This issue affects readability and usability when writing or reviewing long commands, especially in shell scripts, documentation, or CLI examples. Fixing this would improve the developer experience for users who prefer or need to break long commands into multiple lines.