branch: elpa/dart-mode
commit ae8a28b55937a9baa7ab1c964ef52cfbee97d35d
Author: Brady Trainor <[email protected]>
Commit: Brady Trainor <[email protected]>
Follow conventions in font-lock levels
For example, file directives are fontified at level one, and variables
are fontified at level three.
---
dart-mode.el | 35 +++++++++++++++++++++--------------
1 file changed, 21 insertions(+), 14 deletions(-)
diff --git a/dart-mode.el b/dart-mode.el
index ddda8c6..856c488 100644
--- a/dart-mode.el
+++ b/dart-mode.el
@@ -389,12 +389,16 @@ indentation levels from right to left."
;;; Additional fontification support
+(setq dart--file-directives
+ '("as" "deferred" "export" "hide" "import" "library" "of" "part"
+ "show"))
+
(setq dart--builtins
;; ECMA 408; Section: Identifier Reference
;; "Built-in identifiers"
'("abstract" "as" "deferred" "dynamic" "export" "external"
- "factory" "get" "implements" "import" "library" "operator"
- "part" "set" "static" "typedef"))
+ "hide" "factory" "get" "implements" "import" "library" "of"
+ "operator" "part" "set" "show" "static" "typedef"))
(setq dart--keywords
;; ECMA 408; Section: Reserved Words
@@ -598,7 +602,8 @@ indentation levels from right to left."
dart-font-lock-keywords-3)))
(setq dart-font-lock-keywords-1
- '((dart--function-declaration-func .
font-lock-function-name-face)))
+ `((,(regexp-opt dart--file-directives 'words) . font-lock-builtin-face)
+ (dart--function-declaration-func .
font-lock-function-name-face)))
(setq dart-font-lock-keywords-2
`(,dart--async-keywords-re
@@ -610,17 +615,19 @@ indentation levels from right to left."
(,dart--metadata-re . font-lock-constant-face)
(,(regexp-opt dart--types 'words) . font-lock-type-face)
(,dart--types-re . font-lock-type-face)
- (dart--function-declaration-func . font-lock-function-name-face)
- (dart--declared-identifier-func . font-lock-variable-name-face)
- (dart--declared-identifier-anchor-func
- . (dart--declared-identifier-next-func
- nil
- nil
- (0 font-lock-variable-name-face)))
- (dart--string-interpolation-id-func (0 font-lock-variable-name-face
t))
- (dart--string-interpolation-exp-func (0 font-lock-variable-name-face
t))))
-
-(setq dart-font-lock-keywords-3 dart-font-lock-keywords-2)
+ (dart--function-declaration-func . font-lock-function-name-face)))
+
+(setq dart-font-lock-keywords-3
+ (append
+ dart-font-lock-keywords-2
+ `((dart--declared-identifier-func . font-lock-variable-name-face)
+ (dart--declared-identifier-anchor-func
+ . (dart--declared-identifier-next-func
+ nil
+ nil
+ (0 font-lock-variable-name-face)))
+ (dart--string-interpolation-id-func (0 font-lock-variable-name-face
t))
+ (dart--string-interpolation-exp-func (0 font-lock-variable-name-face
t)))))
(setq dart-string-delimiter (rx (and
;; Match even number of backslashes.