microsoft / microsoft/vscode-containers

[Feature request] support syntax highlighting in heredoc RUN instructions

Open
#108 5 comments 14 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

language-server
Dominant language
TypeScript
Stars
139
Forks
87
Avg merge
9h 15m
Merged PRs (30d)
9

Description

The gist

When using the RUN instruction with the heredoc notation, that section should use the appropriate syntax highlighting for the language used.

An example of how it looks like now for a shell (Bash) script:


How the same code is highlighted in a shell file, and how I would like it to look in the Dockerfile:


Description

Basically, I’m asking for something similar to how Markdown files in VS Code are highlighted. Normally the file has Markdown highlighting, but for code blocks, those sections are highlighted for a different syntax (e.g. shell syntax if the code block starts with ```bash).

The extension should look at the SHELL instruction, the RUN instruction arguments, and the shebang for determining the correct highlighting for the RUN block. For example, the extension should properly highlight the Python code in all of the three examples below:

Example 1:

SHELL ["/usr/bin/python3", "-c"]
RUN <<EOF
def hello():
  print("hello world")
EOF

Example 2:

RUN /usr/bin/python3 <<EOF
def hello():
  print("hello world")
EOF

Example 3:

RUN <<EOF
#! /usr/bin/python3
def hello():
  print("hello world")
EOF

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Use the three Python heredoc examples in the issue as the initial cases to investigate, including SHELL, RUN command, and shebang detection. Done means Dockerfile RUN heredocs receive the appropriate language highlighting in each example, with behavior comparable to Markdown fenced code blocks.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, dockerfile, typescript, vscode
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.