Shell script syntax highlighting fails with indented EOT HereDoc #223443
Labels
grammar
Syntax highlighting grammar
upstream-issue-linked
This is an upstream issue that has been reported upstream
Type: Bug
POSIX shell scripts that use an indented EOT marker break syntax highlighting for the remainder of the file. In the following shell script:
)
andecho "$foo"
appear to be part of the HereDoc, but they should not be(
is marked as an error (unmatched), but it should not be.Screenshot showing the incorrect highlighting:
In both Bash and Dash, the script runs without error and outputs
A HereDoc\n
as expected.Related issue: #77675. That issue was closed by PR #169118, which adopted a different grammar. Technically this issue is a duplicate, but the original problem was not fixed; indeed @jeff-hykin said "#77675 (code example at top of this issue) is not [fixed]".
Note that in POSIX, Bash's indented HereDoc syntax
<<-'EOT'
in not available.VS Code version: Code 1.91.1 (Universal) (f1e16e1, 2024-07-09T22:07:54.982Z)
OS version: Darwin arm64 23.5.0
Modes:
System Info
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
A/B Experiments
The text was updated successfully, but these errors were encountered: