emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/graphql-mode 7d954d0045 035/122: Fix font lock to highligh


From: ELPA Syncer
Subject: [nongnu] elpa/graphql-mode 7d954d0045 035/122: Fix font lock to highlight whole symbols, not just words
Date: Sat, 29 Jan 2022 08:03:31 -0500 (EST)

branch: elpa/graphql-mode
commit 7d954d00450d7573c5c42f2ef452a01913dc1cd5
Author: David Vazquez Pua <dvazquezpua@deloitte.nl>
Commit: David Vazquez Pua <dvazquezpua@deloitte.nl>

    Fix font lock to highlight whole symbols, not just words
    
    The \w+ regex matches word constituents, but for example, _ is a
    symbol consistuent but not word constituent.
    
    Replace it with the regex (\_<.*?\_>)
    
    Fix #8
---
 graphql-mode.el | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/graphql-mode.el b/graphql-mode.el
index e56a7bf16e..15da3620af 100644
--- a/graphql-mode.el
+++ b/graphql-mode.el
@@ -122,6 +122,7 @@ response from the server."
   (let ((st (make-syntax-table)))
     (modify-syntax-entry ?\# "<" st)
     (modify-syntax-entry ?\n ">" st)
+    (modify-syntax-entry ?\$ "'" st)
     st))
 
 
@@ -144,7 +145,7 @@ response from the server."
 
 (defvar graphql-definition-regex
   (concat "\\(" (regexp-opt '("type" "input" "interface" "fragment" "query" 
"enum")) "\\)"
-          "[[:space:]]+\\(\\w+\\)"))
+          "[[:space:]]+\\(\\_<.+?\\_>\\)"))
 
 (defvar graphql-builtin-types
   '("Int" "Float" "String" "Boolean" "ID"))
@@ -186,10 +187,10 @@ response from the server."
 (defvar graphql-font-lock-keywords
   `(
     ;; Type definition
-    ("\\(type\\)[[:space:]]+\\(\\w+\\)"
+    ("\\(type\\)[[:space:]]+\\(\\_<.+?\\_>\\)"
      (1 font-lock-keyword-face)
      (2 font-lock-function-name-face)
-     ("[[:space:]]+\\(implements\\)\\(?:[[:space:]]+\\(\\w+\\)\\)?"
+     ("[[:space:]]+\\(implements\\)\\(?:[[:space:]]+\\(\\_<.+?\\_>\\)\\)?"
       nil nil
       (1 font-lock-keyword-face)
       (2 font-lock-function-name-face)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]