Skip to content

Incorrect highlighting for certain RUN directives in nvim #51

@jason-ci

Description

@jason-ci

Hi, I'm seeing some incorrect highlighting for some of the RUN directives in this Dockerfile in Neovim;

FROM node:20-alpine AS builder

WORKDIR /staging

COPY . /staging/

RUN corepack enable
RUN pnpm install --frozen-lockfile
RUN pnpm build
RUN pnpm prune --prod

FROM node:20-alpine

WORKDIR /app

COPY --from=builder /staging/package.json /staging/pnpm-lock.yaml  /app/
COPY --from=builder /staging/node_modules /app/node_modules
COPY --from=builder /staging/build /app/build

EXPOSE 3000
CMD ["node", "/app/build"]

Output of :InspectTree;

(command) ; [7:5 - 10:21]
 name: (command_name) ; [7:5 - 12]
  (word) ; [7:5 - 12]
 argument: (word) ; [7:14 - 8:8]
 argument: (word) ; [8:10 - 16]
 argument: (word) ; [8:18 - 9:8]
 argument: (word) ; [9:10 - 10:8]
 argument: (word) ; [10:10 - 14]
 argument: (word) ; [10:16 - 21]
(from_instruction) ; [1:1 - 30]
 (image_spec) ; [1:6 - 19]
  name: (image_name) ; [1:6 - 9]
  tag: (image_tag) ; [1:10 - 19]
 as: (image_alias) ; [1:24 - 30]
(workdir_instruction) ; [3:1 - 16]
 (path) ; [3:9 - 16]
(copy_instruction) ; [5:1 - 16]
 (path) ; [5:6 - 6]
 (path) ; [5:8 - 16]
(run_instruction) ; [7:1 - 19]
 (shell_command) ; [7:5 - 19]
  (shell_fragment) ; [7:5 - 19]
(run_instruction) ; [8:1 - 34]
 (shell_command) ; [8:5 - 34]
  (shell_fragment) ; [8:5 - 34]
(run_instruction) ; [9:1 - 14]
 (shell_command) ; [9:5 - 14]
  (shell_fragment) ; [9:5 - 14]
(run_instruction) ; [10:1 - 21]
 (shell_command) ; [10:5 - 21]
  (shell_fragment) ; [10:5 - 21]
(from_instruction) ; [12:1 - 19]
 (image_spec) ; [12:6 - 19]
  name: (image_name) ; [12:6 - 9]
  tag: (image_tag) ; [12:10 - 19]
(workdir_instruction) ; [14:1 - 12]
 (path) ; [14:9 - 12]
(copy_instruction) ; [16:1 - 72]
 (param) ; [16:6 - 19]
 (path) ; [16:21 - 41]
 (path) ; [16:43 - 65]
 (path) ; [16:68 - 72]
(copy_instruction) ; [17:1 - 59]
 (param) ; [17:6 - 19]
 (path) ; [17:21 - 41]
 (path) ; [17:43 - 59]
(copy_instruction) ; [18:1 - 45]
 (param) ; [18:6 - 19]
 (path) ; [18:21 - 34]
 (path) ; [18:36 - 45]
(expose_instruction) ; [20:1 - 11]
 (expose_port) ; [20:8 - 11]
(cmd_instruction) ; [21:1 - 26]
 (json_string_array) ; [21:5 - 26]
  (json_string) ; [21:6 - 11]
  (json_string) ; [21:14 - 25]

Screenshot of highlighting I'm seeing;
highlighting

Build info;

  • Neovim version: 0.9.5
  • nvim-treesitter commit: 3ef8d25df2d8eca6f15a6889cb2bc9d4c6101096
  • dockerfile.so parser commit: 439c3e7b8a9bfdbf1f7d7c2beaae4173dc484cbf

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions