Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shell script syntax highlighting fails with indented EOT HereDoc #97

Open
alexr00 opened this issue Jul 29, 2024 · 2 comments
Open

Shell script syntax highlighting fails with indented EOT HereDoc #97

alexr00 opened this issue Jul 29, 2024 · 2 comments

Comments

@alexr00
Copy link

alexr00 commented Jul 29, 2024

The code with a problem is:

#!/bin/sh
foo=$(cat <<'    EOT'
        A HereDoc
    EOT
)
echo "$foo"

It looks like:

Image

The scopes at the beginning of the EOT line include this no-indent scope:

string.quoted.heredoc.no-indent.EOT
meta.argument.shell
meta.statement.command.shell
meta.statement.shell
meta.scope.subshell
meta.expression.assignment.shell
source.shell

Image

It should look like:

Image

Originally from @sandy-fairsupply in microsoft/vscode#223443

@sandy-fairsupply
Copy link

Small correction:

It should look like:

screenshot showing how it should look with the closing EOT marker indented and coloured correctly

Note that the closing EOT marker is preceded by four spaces to match the opening marker.

@RedCMD
Copy link

RedCMD commented Aug 27, 2024

image
should be easy fix
either place \\s* before \\3 or capture the [ \\t]*+ and replace \\3 with \\3?\\4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants