microsoft / vscode-docker

Docker Extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker
Other
1.22k stars 517 forks source link

HEREDOC parsing results in Empty Continuation Line output #3576

Closed rbairwell closed 1 year ago

rbairwell commented 2 years ago

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

bwateratmsft commented 2 years ago

@rcjsuen can you take a look?

rcjsuen commented 2 years ago

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 commented 2 years ago

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

bwateratmsft commented 1 year ago

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.

Timothy-Dement commented 1 year ago

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
alexyaang commented 1 year ago

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