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

Compatibility fixes for refactored Bash #3

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions Containerfile.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,12 @@ contexts:
set:
- match: $
pop: true
- include: scope:source.shell.bash#variable-value
- include: scope:source.shell.bash#literal-array-value
- match: (?i)(ENV)\b
captures:
1: keyword.context.containerfile
set:
- scope:source.shell.bash#cmd-export-args-meta
- scope:source.shell.bash#cmd-args-meta
- scope:source.shell.bash#cmd-export-args
- match: (?i)(LABEL)\b
captures:
Expand All @@ -244,15 +244,20 @@ contexts:
- match: (?i)HEALTHCHECK\b
scope: keyword.other.containerfile
set:
- scope:source.shell.bash#cmd-args-meta
- scope:source.shell.bash#cmd-args
- optional-cmd
- optional-instruction-args
- match: '{{onbuild_instruction}}(?=\s)'
scope: keyword.other.containerfile
set: scope:source.shell.bash#cmd-args # TODO: set optional-instruction-args first?
set:
- scope:source.shell.bash#cmd-args-meta
- scope:source.shell.bash#cmd-args # TODO: set optional-instruction-args first?
- match: '{{non_onbuild_instruction}}(?=\s)'
scope: keyword.other.containerfile
set: scope:source.shell.bash#cmd-args
set:
- scope:source.shell.bash#cmd-args-meta
- scope:source.shell.bash#cmd-args

shell-instruction:
- match: '{{shell_instruction}}\b'
Expand Down Expand Up @@ -342,5 +347,5 @@ contexts:
- match: =
scope: keyword.operator.assignment.bash
set:
- scope:source.shell.bash#cmd-export-args-meta
- scope:source.shell.bash#cmd-args-meta
- scope:source.shell.bash#cmd-export-args
19 changes: 11 additions & 8 deletions syntax_test_Containerfile.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ RUN curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poet
# ^^^^ meta.parameter.option variable.parameter.option
# ^ punctuation.definition.parameter
# ^ keyword.operator.assignment.pipe
# ^^^^^^^^^^^^^^ meta.variable variable.other.readwrite
# ^^^^^^^^^^^^^^ variable.other.readwrite
# ^ keyword.operator.assignment
# ^ meta.number.integer.decimal constant.numeric.value
# ^ meta.string string.unquoted.shell
# ^^^^^^ meta.function-call.identifier variable.function

ENV PATH "/root/.poetry/bin:/opt/venv/bin:${PATH}"
Expand All @@ -91,7 +91,7 @@ ENV PATH "/root/.poetry/bin:/opt/venv/bin:${PATH}"
# ^^^^^^^ meta.interpolation.parameter
# ^ punctuation.definition.variable
# ^ punctuation.section.interpolation.begin
# ^^^^ variable.other.readwrite
# ^^^^ variable.language.builtin
# ^ punctuation.section.interpolation.end
# ^ string.quoted.double punctuation.definition.string.end

Expand Down Expand Up @@ -136,13 +136,13 @@ COPY --from=python_builder /opt /opt
# Add the VirtualEnv to the beginning of $PATH
ENV PATH="/opt/venv/bin:$PATH"
# ^ keyword.context
# ^^^^ meta.function-call.arguments meta.variable variable.other.readwrite
# ^^^^ meta.function-call.arguments variable.language.builtin
# ^ meta.function-call.arguments keyword.operator.assignment
# ^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments meta.string
# ^ string.quoted.double punctuation.definition.string.begin
# ^^^^^^^^^^^^^^ string.quoted.double
# ^ meta.interpolation.parameter variable.other.readwrite punctuation.definition.variable
# ^^^^ meta.interpolation.parameter variable.other.readwrite
# ^ meta.interpolation.parameter variable.language.builtin punctuation.definition.variable
# ^^^^ meta.interpolation.parameter variable.language.builtin
# ^ string.quoted.double punctuation.definition.string.end

# -------------------------------
Expand Down Expand Up @@ -219,7 +219,7 @@ RUN <<EOT bash
apt-get install -y something
# TODO: scope as bash script
EOT
# <- source.shell.bash.embedded.containerfile meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell
# <- source.shell.bash.embedded.containerfile meta.redirection.shell meta.tag.heredoc.end.shell entity.name.tag.heredoc.shell
# ^ - meta.string

# syntax=docker/dockerfile:1
Expand Down Expand Up @@ -262,9 +262,12 @@ RUN \

RUN apt-get -y update && \
# comment eaten by Docker, not passed to shell
# <- comment.line.number-sign.containerfile punctuation.definition.comment.containerfile
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.containerfile
apt-get install something
# <- source.shell.bash.embedded.containerfile - comment - variable
#^^^ source.shell.bash.embedded.containerfile - comment - variable
# ^^^^^^^ source.shell.bash.embedded.containerfile variable.function.shell
# <- comment.line.number-sign.containerfile punctuation.definition.comment.containerfile - source.shell

LABEL org.opencontainers.image.authors="[email protected]"
# ^^^ keyword.other.containerfile
Expand Down
2 changes: 1 addition & 1 deletion syntax_test_WindowsDockerfile.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ RUN Get-CimInstance -ComputerName localhost win32_logicaldisk `
| foreach-object {write " $($_.caption) $('{0:N2}' `
-f ($_.Size/1gb)) GB total, $('{0:N2}' `
-f ($_.FreeSpace/1gb)) GB free "}
# ^^ source.containerfile source.powershell.embedded meta.block string.quoted.double interpolated.complex.source keyword.operator.string-format
# ^^ source.containerfile source.powershell.embedded keyword.operator

# <- - source.powershell