Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 68a7503

Browse files
committed
Merge pull request #234 from elixir-lang/dont-highlight-lhs-as-variable
don't highlights LHS as a variable in `==` case fixes #225
2 parents d84ddb4 + 6fde866 commit 68a7503

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
@@ -374,8 +374,8 @@ is used to limit the scan."
374374
;; Variable definitions
375375
(,(elixir-rx (group identifiers)
376376
(zero-or-more space)
377-
"="
378-
(or (zero-or-more space)
377+
(repeat 1 "=")
378+
(or (or sigils identifiers space)
379379
(one-or-more "\n")))
380380
1 font-lock-variable-name-face)
381381

test/elixir-mode-font-test.el

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

8282
(ert-deftest elixir-mode-syntax-table/fontify-regex-with-question/1 ()
8383
"https://github.com/elixir-lang/emacs-elixir/issues/36"
@@ -176,7 +176,6 @@ end"
176176
(elixir-test-with-temp-buffer
177177
"\"#{1 + 2} is 3.\""
178178
(should (eq (elixir-test-face-at 1) 'font-lock-string-face))
179-
;; (should (eq (elixir-test-face-at 3) 'font-lock-variable-name-face))
180179
(should (eq (elixir-test-face-at 11) 'font-lock-string-face))))
181180

182181
(ert-deftest elixir-mode-syntax-table/fontify-continuation-lines-assignment ()
@@ -186,6 +185,12 @@ end"
186185
some_expr"
187186
(should (eq (elixir-test-face-at 1) 'font-lock-variable-name-face))))
188187

188+
(ert-deftest elixir-mode-syntax-table/dont-fontify-equal-match ()
189+
:tags '(fontification syntax-table)
190+
(elixir-test-with-temp-buffer
191+
"this == that"
192+
(should-not (eq (elixir-test-face-at 2) 'font-lock-variable-name-face))))
193+
189194
(ert-deftest elixir-mode-syntax-table/fontify-triple-quoted-string ()
190195
:tags '(fontification syntax-table)
191196
(elixir-test-with-temp-buffer

0 commit comments

Comments
 (0)