@@ -80,11 +80,14 @@ hello
80
80
" foo = \"\"\"
81
81
# a string with hashtag
82
82
# another # one
83
+ -- not a comment --
84
+ -- | not a comment
85
+ {- not a comment -}
83
86
\"\"\"
84
87
"
85
88
'((1 3 font-lock-function-name-face )
86
89
(5 5 font-lock-variable-name-face )
87
- (7 55 font-lock-string-face ))))
90
+ (7 114 font-lock-string-face ))))
88
91
89
92
(ert-deftest multiline-string-with-embedded-strings ()
90
93
:expected-result :failed
@@ -96,3 +99,151 @@ this = \"still a string\"
96
99
'((1 3 font-lock-function-name-face )
97
100
(5 5 font-lock-variable-name-face )
98
101
(7 37 font-lock-string-face ))))
102
+
103
+ (ert-deftest docs-bar-comment-different-spacings ()
104
+ (purescript-test-ranges
105
+ " -- | Docs comment 1 space
106
+ -- | Docs comment many spaces
107
+ "
108
+ '((1 57 font-lock-doc-face ))))
109
+
110
+ (ert-deftest docs-bar-comment-continuation ()
111
+ " Acc. to
112
+ https://github.com/purescript/documentation/blob/master/language/Syntax.md
113
+ PureScript explicitly doesn't support Haskell-style docs continuation
114
+ where vertical bar is omitted"
115
+ (purescript-test-ranges
116
+ " -- | Docs start
117
+ -- continue
118
+ "
119
+ '((1 16 font-lock-doc-face )
120
+ (17 19 font-lock-comment-delimiter-face )
121
+ (20 28 font-lock-comment-face ))))
122
+
123
+ (ert-deftest docs-cap-comment-different-spacings ()
124
+ (purescript-test-ranges
125
+ " -- ^ Docs comment space
126
+ -- ^ Docs comment many spaces
127
+ "
128
+ '((1 57 font-lock-doc-face ))))
129
+
130
+ (ert-deftest multiline-comment ()
131
+ (purescript-test-ranges
132
+ " {-
133
+ multiline comment
134
+ -- | not a doc
135
+ --| not a doc
136
+ still comment
137
+ -}
138
+ noncomment
139
+ {--}
140
+ noncomment
141
+ "
142
+ '((1 64 font-lock-comment-face )
143
+ (65 66 font-lock-comment-delimiter-face )
144
+ (67 78 nil )
145
+ (79 80 font-lock-comment-face )
146
+ (81 82 font-lock-comment-delimiter-face )
147
+ (83 93 nil ))))
148
+
149
+ (ert-deftest multiline-comment-w-delimiter-inside ()
150
+ :expected-result :failed
151
+ (purescript-test-ranges
152
+ " {- {-{- -} noncomment"
153
+ '((1 6 font-lock-comment-face )
154
+ (7 10 font-lock-comment-delimiter-face )
155
+ (11 21 nil ))))
156
+
157
+ (ert-deftest type-with-typenames-and--> ()
158
+ (purescript-test-ranges
159
+ " type Component props = Effect (props -> JSX)"
160
+ '((1 4 font-lock-keyword-face )
161
+ (5 5 nil )
162
+ (6 14 font-lock-type-face )
163
+ (15 21 nil )
164
+ (22 22 font-lock-variable-name-face )
165
+ (23 23 nil )
166
+ (24 29 font-lock-type-face )
167
+ (30 37 nil )
168
+ (38 39 font-lock-variable-name-face )
169
+ (40 40 nil )
170
+ (41 43 font-lock-type-face )
171
+ (44 45 nil ))))
172
+
173
+ (ert-deftest module-in-different-locations ()
174
+ (purescript-test-ranges
175
+ " module React.Basic.Hooks ( Component, module React.Basic
176
+ , module Data.Tuple.Nested ) where
177
+ "
178
+ '((1 6 font-lock-keyword-face )
179
+ (7 7 nil )
180
+ (8 24 font-lock-type-face )
181
+ (25 27 nil )
182
+ (28 36 font-lock-type-face )
183
+ (37 38 nil )
184
+ (39 44 font-lock-keyword-face )
185
+ (45 45 nil )
186
+ (46 56 font-lock-type-face )
187
+ (57 84 nil )
188
+ (85 90 font-lock-keyword-face )
189
+ (91 91 nil )
190
+ (92 108 font-lock-type-face )
191
+ (109 111 nil )
192
+ (112 116 font-lock-keyword-face )
193
+ (117 117 nil ))))
194
+
195
+ (ert-deftest func-decl-w-do-and-qualified-do ()
196
+ (purescript-test-ranges
197
+ " mkMyComponent :: Component {}
198
+ mkMyComponent = do
199
+ modalComp :: (NodeRef -> JSX) <- mkModal
200
+ component \" mkMyComponent\" \\ _ -> React.do
201
+ dialogRef :: NodeRef <- newNodeRef
202
+ pure $ R.label_ []
203
+ "
204
+ '((1 13 font-lock-function-name-face )
205
+ (14 14 nil )
206
+ (15 16 font-lock-variable-name-face )
207
+ (17 17 nil )
208
+ (18 26 font-lock-type-face )
209
+ (27 30 nil )
210
+ (31 43 font-lock-function-name-face )
211
+ (44 44 nil )
212
+ (45 45 font-lock-variable-name-face )
213
+ (46 46 nil )
214
+ (47 48 font-lock-keyword-face )
215
+ (49 61 nil )
216
+ (62 63 font-lock-variable-name-face )
217
+ (64 65 nil )
218
+ (66 72 font-lock-type-face )
219
+ (73 73 nil )
220
+ (74 75 font-lock-variable-name-face )
221
+ (76 76 nil )
222
+ (77 79 font-lock-type-face )
223
+ (80 81 nil )
224
+ (82 83 font-lock-variable-name-face )
225
+ (84 104 nil )
226
+ (105 119 font-lock-string-face )
227
+ (120 120 nil )
228
+ (121 121 font-lock-variable-name-face )
229
+ (122 122 font-lock-keyword-face )
230
+ (123 123 nil )
231
+ (124 125 font-lock-variable-name-face )
232
+ (126 126 nil )
233
+ (127 131 font-lock-type-face )
234
+ (132 132 font-lock-variable-name-face )
235
+ (133 134 font-lock-keyword-face )
236
+ (135 149 nil )
237
+ (150 151 font-lock-variable-name-face )
238
+ (152 152 nil )
239
+ (153 159 font-lock-type-face )
240
+ (160 160 nil )
241
+ (161 162 font-lock-variable-name-face )
242
+ (163 181 nil )
243
+ (182 182 font-lock-variable-name-face )
244
+ (183 183 nil )
245
+ (184 184 font-lock-type-face )
246
+ (185 185 font-lock-variable-name-face )
247
+ (186 192 nil )
248
+ (193 194 font-lock-type-face )
249
+ (195 195 nil ))))
0 commit comments