File tree Expand file tree Collapse file tree 4 files changed +59
-1
lines changed Expand file tree Collapse file tree 4 files changed +59
-1
lines changed Original file line number Diff line number Diff line change 226
226
(eval-when-compile
227
227
(defconst elixir-rx-constituents
228
228
`(
229
+ ; ; Match `@doc' or `@moduledoc' syntax, with or without triple quotes.
230
+ (heredocs . ,(rx symbol-start
231
+ (or " @doc" " @moduledoc" " ~s" )
232
+ symbol-end))
229
233
(keywords . ,(rx symbol-start
230
234
(or " ->" " bc" " lc" " in" " inbits" " inlist" " quote"
231
235
" unquote" " unquote_splicing" " var" " do" " after" " for"
328
332
(group module-names))
329
333
1 font-lock-type-face )
330
334
335
+ ; ; Heredoc
336
+ (,(elixir-rx (group heredocs))
337
+ 1 font-lock-builtin-face )
338
+
331
339
; ; Keywords
332
340
(,(elixir-rx (group keywords))
333
341
1 font-lock-keyword-face )
Original file line number Diff line number Diff line change 30
30
(modify-syntax-entry ?\[ " (]" table)
31
31
(modify-syntax-entry ?\] " )[" table)
32
32
(modify-syntax-entry ?\: " '" table)
33
- (modify-syntax-entry ?\ @ " ' " table)
33
+ (modify-syntax-entry ?@ " _ " table)
34
34
table)
35
35
" Elixir mode syntax table." )
36
36
Original file line number Diff line number Diff line change 99
99
end"
100
100
(should (eq (elixir-test-face-at 5 ) 'font-lock-function-name-face ))
101
101
(should (eq (elixir-test-face-at 8 ) 'font-lock-function-name-face ))))
102
+
103
+ (ert-deftest elixir-mode-syntax-table/fontify-heredoc/1 ()
104
+ :tags '(fontification heredoc syntax-table)
105
+ (elixir-test-with-temp-buffer
106
+ " @doc \"\"\" "
107
+ (should (eq (elixir-test-face-at 1 ) 'font-lock-builtin-face ))
108
+ (should (eq (elixir-test-face-at 2 ) 'font-lock-builtin-face ))
109
+ (should (eq (elixir-test-face-at 6 ) 'font-lock-string-face ))))
110
+
111
+ (ert-deftest elixir-mode-syntax-table/fontify-heredoc/2 ()
112
+ :tags '(fontification heredoc syntax-table)
113
+ (elixir-test-with-temp-buffer
114
+ " @moduledoc \"\"\" "
115
+ (should (eq (elixir-test-face-at 1 ) 'font-lock-builtin-face ))
116
+ (should (eq (elixir-test-face-at 2 ) 'font-lock-builtin-face ))
117
+ (should (eq (elixir-test-face-at 12 ) 'font-lock-string-face ))))
118
+
119
+ (ert-deftest elixir-mode-syntax-table/fontify-heredoc/3 ()
120
+ :tags '(fontification heredoc syntax-table)
121
+ (elixir-test-with-temp-buffer
122
+ " ~s\"\"\" "
123
+ (should (eq (elixir-test-face-at 1 ) 'font-lock-builtin-face ))
124
+ (should (eq (elixir-test-face-at 2 ) 'font-lock-builtin-face ))
125
+ (should (eq (elixir-test-face-at 3 ) 'font-lock-string-face ))))
126
+
Original file line number Diff line number Diff line change @@ -437,3 +437,28 @@ end"
437
437
end
438
438
end
439
439
end" )
440
+
441
+ (elixir-def-indentation-test indent-heredoc
442
+ (:expected-result :failed )
443
+ "
444
+ defmodule Foo do
445
+ @doc \"\"\"
446
+ this is a heredoc string
447
+
448
+ \"\"\"
449
+ def convert do
450
+ x = 15
451
+ end
452
+ end
453
+ "
454
+ "
455
+ defmodule Foo do
456
+ @doc \"\"\"
457
+ this is a heredoc string
458
+
459
+ \"\"\"
460
+ def convert do
461
+ x = 15
462
+ end
463
+ end
464
+ " )
You can’t perform that action at this time.
0 commit comments