vscode-docker icon indicating copy to clipboard operation
vscode-docker copied to clipboard

HEREDOC parsing results in Empty Continuation Line output

Open rbairwell opened this issue 3 years ago • 3 comments

Possibly a reoccurrence of https://github.com/microsoft/vscode-docker/pull/3399 / https://github.com/microsoft/vscode-docker/pull/3355

If a HEREDOC section of a Dockerfile (as introduced in Buildx 1.4 https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/syntax.md#here-documents , if there is an empty line in the HEREDOC/HERE_DOCUMENT section, this extension reports "Empty continuation line dockerfile-utils(11)"

Docker File snippet:

# syntax=docker/dockerfile:1.4
....
FROM debian:bullseye
...
# see https://www.docker.com/blog/introduction-to-heredocs-in-dockerfiles/
COPY <<EOF ${MY_PATH}/file.patch
--- file	2022-07-15 18:10:27.286229900 +0000
+++ file.two	2022-07-15 18:09:57.204518600 +0000
@@ -3,11 +3,11 @@
 # DEBUG_CFLAGS=-g -O0

 # LOCALCFLAGS= -I/usr/local/include/libxml2

with the report happening on the empty line between the two commented out sections.

Screenshot:

image

Environment

Extension version: v1.22.1 ( last updated 11/07/2022, 15:43:38 ) VS Code Version: Version: 1.69.1 (user setup) Commit: b06ae3b2d2dbfe28bca3134cc6be65935cdfea6a Date: 2022-07-12T08:21:24.514Z Electron: 18.3.5 Chromium: 100.0.4896.160 Node.js: 16.13.2 V8: 10.0.139.17-electron.0 OS: Windows_NT x64 10.0.19044

rbairwell avatar Jul 16 '22 08:07 rbairwell

@rcjsuen can you take a look?

bwateratmsft avatar Jul 18 '22 14:07 bwateratmsft

I can confirm that this is a problem. Heredocs are only supported for RUN instructions at the moment. I will update this issue once I have created the relevant issues for tracking.

rcjsuen avatar Jul 27 '22 12:07 rcjsuen

This is now being tracked by https://github.com/rcjsuen/dockerfile-utils/issues/112.

rcjsuen avatar Aug 02 '22 09:08 rcjsuen

I guess the 0.9.0 version (current) of the language service doesn't yet utilize the update dockerfile-utils package, so we'll have to wait on releasing. I'll move this to 1.25.0 milestone.

bwateratmsft avatar Jan 09 '23 15:01 bwateratmsft

Is this possibly related to some strange here-string syntax-highlighting behavior I'm seeing in extension version v1.23.3?

With the extension installed, comments aren't properly colored following here-strings:

Screenshot 2023-02-20 at 10 22 28 AM Screenshot 2023-02-20 at 10 22 03 AM

If I uninstall the extension and re-open, I see correct comment coloring following here-strings:

Screenshot 2023-02-20 at 10 23 12 AM

Timothy-Dement avatar Feb 20 '23 15:02 Timothy-Dement

This fix has now been released in version 1.26 of the extension.

alexyaang avatar Jul 17 '23 15:07 alexyaang