branch: elpa/dockerfile-mode
commit 902e4c2a5a80d8481bc08fd18a474c23ef2c1d3e
Author: Matus Goljer <matus.gol...@gmail.com>
Commit: Matus Goljer <matus.gol...@gmail.com>

    Add faces for image name and alias
---
 dockerfile-mode.el | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/dockerfile-mode.el b/dockerfile-mode.el
index f031ff20be..9c9933a8b2 100644
--- a/dockerfile-mode.el
+++ b/dockerfile-mode.el
@@ -55,6 +55,14 @@ Each element of the list will be passed as a separate
   :type '(repeat string)
   :group 'dockerfile)
 
+(defface dockerfile-image-name
+  '((t (:inherit (font-lock-type-face bold))))
+  "Face to highlight the base image name after FROM instruction.")
+
+(defface dockerfile-image-alias
+  '((t (:inherit (font-lock-constant-face bold))))
+  "Face to highlight the base image alias inf FROM ... AS <alias> construct.")
+
 (defvar dockerfile-font-lock-keywords
   `(,(cons (rx (or line-start "onbuild ")
                (group (or "from" "maintainer" "run" "cmd" "expose" "env" "arg"
@@ -62,6 +70,9 @@ Each element of the list will be passed as a separate
                           "label" "stopsignal" "shell" "healthcheck"))
                word-boundary)
            font-lock-keyword-face)
+    (,(rx "FROM " (group (+? nonl)) (or " " eol) (? "as " (group (1+ nonl))))
+     (1 'dockerfile-image-name)
+     (2 'dockerfile-image-alias nil t))
     ,@(sh-font-lock-keywords)
     ,@(sh-font-lock-keywords-2)
     ,@(sh-font-lock-keywords-1))

Reply via email to