Search code examples
dockersyntax-highlightingultraedit

Ultraedit docker syntax hightlighting file


At http://www.ultraedit.com/downloads/extras/wordfiles.html I did not find a wordfile for Docker.

http://www.ultraedit.com/support/tutorials_power_tips/ultraedit_linux/add_a_wordfile.html explains how you can role your own.

Inspired by https://github.com/docker/docker/blob/master/contrib/syntax/vim/syntax/dockerfile.vim I tried:

/L20"Docker" Line Comment = #  Escape Char = \ String Chars = "' File Extensions = 
/Delimiters = ~!@$%^*()+=/\[]{}:;"<>'�` ,   .?
/Indent Strings = "{("
/Unindent Strings = "})"
/Function String = "%[a-zA-Z_]*("
/C1
ADD
CMD
ENTRYPOINT
ENV
EXPOSE
FROM
MAINTAINER
RUN
USER
LABEL
VOLUME
WORKDIR
COPY
STOPSIGNAL
/C2
/C3
]
[
/C4

for a start.

What changes would be necessary to make this a proper syntax highlighting file for docker?

On my Mac I put the above code into /Library/Application Support/UltraEdit/wordfiles/docker.uew

then restarted Ultraedit and actively selected the Syntax Highlighting for Docker from the view menu.


Solution

  • That tutorial mentions:

    Any files opened after saving the modified wordfile, which have an extension matching those defined in the wordfile, will be highlighted accordingly.

    But a Dockerfile has, by default, no extension.

    Starting with UltraEdit v19.00 some shebangs are supported for automatic detection and highlighting for file types without extensions.
    But that wouldn't help here.

    The user can switch syntax highlighting at any time by clicking on appropriate menu item in View - View as (Highlighting File Type).

    But this thread also mentions:

    The conditions for automatic syntax highlighting selection by UltraEdit on opening a file or saving a file with changed file name are:

    1. Does name of file match case-insensitive a file name specified for a syntax highlighting language with File Names =?

    So replace File Extensions = by File Names = Dockerfile (space before and after equal sign are important) directive in your wordfile to see if that works.

    Mofi mentions in an edit:

    File Extensions and File Names cannot be specified both in a wordfile.