branch: elpa/graphql-mode
commit d9fa01b44690522afbeca4c12fe860c240da48fb
Author: David Vazquez Pua <[email protected]>
Commit: David Vazquez Pua <[email protected]>

    Improve highlight of definitions
---
 graphql.el | 32 +++++++++++++++-----------------
 1 file changed, 15 insertions(+), 17 deletions(-)

diff --git a/graphql.el b/graphql.el
index c1a53f5339..960383f1a7 100644
--- a/graphql.el
+++ b/graphql.el
@@ -34,23 +34,21 @@
     st))
 
 (defvar graphql-font-lock-keywords
-  (list
-   ;; Keywords
-   (regexp-opt (list "type" "fragment" "interface" "union"))
-
-   ;; Constants
-   (cons (regexp-opt (list "true" "false" "null"))
-         'font-lock-constant-face)
-
-   ;; Built-in scalar types
-   (cons (regexp-opt (list "Int" "Float" "String" "Boolean" "ID"))
-         'font-lock-type-face)
-
-   ;; Directives
-   '("@\\w+" . font-lock-keyword-face)
-
-   ;; Variables
-   '("\\$\\w+" . font-lock-variable-name-face)))
+  `(
+    ;; Definitions
+    (,(concat "\\(" (regexp-opt '("type" "input" "interface")) "\\)"
+              "[[:space:]]+\\(\\w+\\)")
+     (1 font-lock-keyword-face)
+     (2 font-lock-function-name-face))
+    
+    ;; Constants
+    (,(regexp-opt (list "true" "false" "null")) . font-lock-constant-face)
+    ;; Built-in scalar types
+    (,(regexp-opt (list "Int" "Float" "String" "Boolean" "ID")) . 
font-lock-type-face)
+    ;; Directives
+    ("@\\w+" . font-lock-keyword-face)
+    ;; Variables
+    ("\\$\\w+" . font-lock-variable-name-face)))
 
 
 (define-derived-mode graphql-mode prog-mode "GraphQL"

Reply via email to