@@ -155,7 +155,6 @@ indentation levels from right to left."
155155 " Function"
156156 " get"
157157 " implements"
158- " import"
159158 " interface"
160159 " late"
161160 " library"
@@ -196,6 +195,7 @@ indentation levels from right to left."
196195 " this"
197196 " throw"
198197 " try"
198+ " import"
199199 " var"
200200 " while"
201201 " with" ))
@@ -362,6 +362,29 @@ For example, \"main\" in \"void main() async\" would be matched."
362362 (goto-char end))
363363 (throw 'result nil ))))
364364
365+ (defun dart--function-call-func (limit )
366+ " Font-lock matcher function for method invocations.
367+
368+ Matches invocations before LIMIT that look like,
369+
370+ \" lowercaseIdentifier([...])\"
371+
372+ For example, the \" now\" in \" DateTime.now()\" would be matched"
373+ (catch 'result
374+ (let (beg end)
375+ (while (re-search-forward
376+ (rx (group (eval (dart--identifier 'lower ))) ?\( ) limit t )
377+ (setq beg (match-beginning 1 ))
378+ (setq end (match-end 1 ))
379+ ; ; Exclude control-flow expressions to highlight only methods
380+ (unless (member (match-string 1 )
381+ '(" if" " switch" " for" " while" " catch" " assert" ))
382+ (set-match-data (list beg end))
383+ (goto-char end)
384+ (throw 'result t ))
385+ (goto-char end)))
386+ (throw 'result nil )))
387+
365388(defun dart--abstract-method-func (limit )
366389 " Font-lock matcher function for abstract methods.
367390
@@ -614,6 +637,7 @@ untyped parameters. For example, in
614637 (,(regexp-opt dart--types 'words ) . font-lock-type-face )
615638 (,dart--types-re . font-lock-type-face )
616639 (dart--function-declaration-func . font-lock-function-name-face )
640+ (dart--function-call-func . font-lock-function-name-face )
617641 (,dart--operator-declaration-re . (1 font-lock-function-name-face ))
618642 (dart--abstract-method-func . font-lock-function-name-face )))
619643
0 commit comments