Skip to content

Shell Script here document syntax highlighting fails to recognize the end delimiter in some cases #209422

@vbrozik

Description

@vbrozik

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.87.2 (user setup)
  • OS Version: Windows_NT x64 10.0.22621

Steps to Reproduce:

  1. Open a new text file Ctrl+N (no need to save it).
  2. Paste a problematic example content like the following one:
#!/bin/sh

cat <<- E+OF
here document
E+OF

# Normal highlighting should resume here but in VS Code it does not.
  1. Once the word defining the here document delimiter contains a character like + or = (probably there are additional problematic characters), the redirection operator is the variant with removing of leading tabs <<- and there is a space between the operator and the word then VS Code does not recognize the end of the here document delimited by the line with the delimiter (here E+OF).

Example of incorrect highlighting - the comment (and possible following lines) is highlighted as if it was part of the here document:

Example of incorrect highlighting

These slight modifications are highlighted correctly:

#!/bin/sh

cat <<- E-OF
here document
E-OF

# Normal highlighting resumes if "+" is replaced by "-".
#!/bin/sh

cat <<-E+OF
here document
E+OF

# Normal highlighting resumes if there is no space between the redirection operator and the word.

Note: I have encountered this bug because I normally use +++EOF+++ as a delimiter.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions