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

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

[nongnu] elpa/elixir-mode d495ed87a9 3/3: Merge pull request #478 from m


From: ELPA Syncer
Subject: [nongnu] elpa/elixir-mode d495ed87a9 3/3: Merge pull request #478 from mpanarin/add_font-lock_to_arrows
Date: Wed, 10 Aug 2022 23:58:21 -0400 (EDT)

branch: elpa/elixir-mode
commit d495ed87a9c507f5939a51c740f119950c83e2ff
Merge: e0d0466d83 192fa47f91
Author: Justin Smestad <justin.smestad@gmail.com>
Commit: GitHub <noreply@github.com>

    Merge pull request #478 from mpanarin/add_font-lock_to_arrows
    
    Add font-lock to arrows
---
 elixir-mode.el                 |  5 +++++
 tests/elixir-mode-font-test.el | 25 +++++++++++++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/elixir-mode.el b/elixir-mode.el
index 8efa991c69..5865d8cf38 100644
--- a/elixir-mode.el
+++ b/elixir-mode.el
@@ -182,6 +182,7 @@
                                  (zero-or-more (any "A-Z" "a-z" "_" "0-9"))))
                            (optional (or "!" "?"))
                            symbol-end))
+      (arrows . ,(rx (or "->" "<-" "=>" "|>")))
       (pseudo-var . ,(rx symbol-start
                          (optional (or "%" "&"))
                          (or "_" "__MODULE__" "__DIR__" "__ENV__" "__CALLER__"
@@ -435,6 +436,10 @@ is used to limit the scan."
     (,(elixir-rx (group pseudo-var))
      1 font-lock-constant-face)
 
+    ;; Arrows
+    (,(elixir-rx (group arrows))
+     1 font-lock-keyword-face)
+
     ;; Code points
     (,(elixir-rx (group code-point))
      1 font-lock-negation-char-face)))
diff --git a/tests/elixir-mode-font-test.el b/tests/elixir-mode-font-test.el
index 1306b3f79a..8d3e539ced 100644
--- a/tests/elixir-mode-font-test.el
+++ b/tests/elixir-mode-font-test.el
@@ -579,6 +579,31 @@ _1_day"
    (should (eq (elixir-test-face-at 2) 'font-lock-comment-face))
    (should (eq (elixir-test-face-at 19) 'font-lock-comment-face))))
 
+(ert-deftest elixir-mode-syntax-table/arrows ()
+  :tags '(fontification syntax-table)
+
+  (elixir-test-with-temp-buffer
+   "with {:ok, _} <- SomeModule.call(),
+         :ok <- OtherModule.call() do
+      :ok
+    end"
+   (should (eq (elixir-test-face-at 15) 'font-lock-keyword-face))
+   (should (eq (elixir-test-face-at 50) 'font-lock-keyword-face)))
+
+  (elixir-test-with-temp-buffer
+   "%{
+      \"\"foo\"\" => \"bar\"
+    }"
+   (should (eq (elixir-test-face-at 18) 'font-lock-keyword-face)))
+
+  (elixir-test-with-temp-buffer
+   "[] |> IO.inspect()"
+   (should (eq (elixir-test-face-at 4) 'font-lock-keyword-face)))
+
+  (elixir-test-with-temp-buffer
+   "a = fn x -> x end"
+   (should (eq (elixir-test-face-at 10) 'font-lock-keyword-face))))
+
 (ert-deftest elixir-mode-in-docstring ()
   "https://github.com/elixir-editors/emacs-elixir/issues/355";
   :tags 'fontification



reply via email to

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