Skip to content

Commit 6fde866

Browse files
committed
don't highlights LHS as a variable in == case fixes #225
1 parent cb3f1a8 commit 6fde866

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

elixir-mode.el

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,8 @@ is used to limit the scan."
388388
;; Variable definitions
389389
(,(elixir-rx (group identifiers)
390390
(zero-or-more space)
391-
"="
392-
(or (zero-or-more space)
391+
(repeat 1 "=")
392+
(or (or sigils identifiers space)
393393
(one-or-more "\n")))
394394
1 font-lock-variable-name-face)
395395

test/elixir-mode-font-test.el

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ match=~r/foo/"
7474
(elixir-test-with-temp-buffer
7575
"~r/\"/
7676
x = 15"
77-
(should (eq (elixir-test-face-at 7) 'font-lock-variable-name-face))))
77+
(should (eq (elixir-test-face-at 8) 'font-lock-variable-name-face))))
7878

7979
(ert-deftest elixir-mode-syntax-table/fontify-regex-with-question/1 ()
8080
"https://github.com/elixir-lang/emacs-elixir/issues/36"
@@ -173,7 +173,6 @@ end"
173173
(elixir-test-with-temp-buffer
174174
"\"#{1 + 2} is 3.\""
175175
(should (eq (elixir-test-face-at 1) 'font-lock-string-face))
176-
;; (should (eq (elixir-test-face-at 3) 'font-lock-variable-name-face))
177176
(should (eq (elixir-test-face-at 11) 'font-lock-string-face))))
178177

179178
(ert-deftest elixir-mode-syntax-table/fontify-continuation-lines-assignment ()
@@ -183,6 +182,12 @@ end"
183182
some_expr"
184183
(should (eq (elixir-test-face-at 1) 'font-lock-variable-name-face))))
185184

185+
(ert-deftest elixir-mode-syntax-table/dont-fontify-equal-match ()
186+
:tags '(fontification syntax-table)
187+
(elixir-test-with-temp-buffer
188+
"this == that"
189+
(should-not (eq (elixir-test-face-at 2) 'font-lock-variable-name-face))))
190+
186191
(ert-deftest elixir-mode-syntax-table/fontify-triple-quoted-string ()
187192
:tags '(fontification syntax-table)
188193
(elixir-test-with-temp-buffer

0 commit comments

Comments
 (0)