@@ -2013,10 +2013,13 @@ This performs fontification according to `typescript--class-styles'."
20132013 ; ; - private generic: SomeType<Foo>
20142014 ; ; - private genericArray: SomeType<Foo>[]
20152015 ; ; - function testFunc(): SomeType<> {
2016+ ; ; - function testFunc(a): a is SomeType<> {
20162017 ; ; TODO: namespaced classes!
20172018 ,(list
2018- (concat " :\\ s-\\ (" typescript--type-name-re " \\ )\\ (<" typescript--type-name-re " >\\ )?\\ (\[\] \\ )?\\ ([,;]\\ )?\\ s-*{?" )
2019- '(1 'font-lock-type-face ))
2019+ (concat " :\\ s-\\ (?:\\ s-*\\ (" typescript--name-re " \\ )\\ s-*\\ (is\\ )\\ s-*\\ )?" " \\ (" typescript--type-name-re " \\ )\\ (<" typescript--type-name-re " >\\ )?\\ (\[\] \\ )?\\ ([,;]\\ )?\\ s-*{?" )
2020+ '(1 'font-lock-variable-name-face nil t )
2021+ '(2 'font-lock-keyword-face nil t )
2022+ '(3 'font-lock-type-face ))
20202023
20212024 ; ; type-casts
20222025 ,(list
@@ -2094,7 +2097,7 @@ This performs fontification according to `typescript--class-styles'."
20942097 ; ; but need care to avoid affecting the // and */ comment markers.
20952098 (" \\ (?:^\\ |[=([{,:;|&!]\\ |\\ _<return\\ _>\\ )\\ (?:[ \t ]\\ )*\\ (/\\ )[^/*]"
20962099 (1 (ignore
2097- (forward-char -1 )
2100+ (forward-char -1 )
20982101 (when (or (not (memq (char-after (match-beginning 0 )) '(?\s ?\t )))
20992102 ; ; If the / is at the beginning of line, we have to check
21002103 ; ; the end of the previous text.
@@ -2330,20 +2333,20 @@ the same column as the current line."
23302333 (save-excursion
23312334 (save-match-data
23322335 (when (looking-at " \\ s-*\\ _<while\\ _>" )
2333- (if (save-excursion
2334- (skip-chars-backward " [ \t\n ]*}" )
2335- (looking-at " [ \t\n ]*}" ))
2336- (save-excursion
2337- (backward-list ) (forward-symbol -1 ) (looking-at " \\ _<do\\ _>" ))
2338- (typescript--re-search-backward " \\ _<do\\ _>" (point-at-bol ) t )
2339- (or (looking-at " \\ _<do\\ _>" )
2340- (let ((saved-indent (current-indentation )))
2341- (while (and (typescript--re-search-backward " ^\\ s-*\\ _<" nil t )
2342- (/= (current-indentation ) saved-indent)))
2343- (and (looking-at " \\ s-*\\ _<do\\ _>" )
2344- (not (typescript--re-search-forward
2345- " \\ _<while\\ _>" (point-at-eol ) t ))
2346- (= (current-indentation ) saved-indent)))))))))
2336+ (if (save-excursion
2337+ (skip-chars-backward " [ \t\n ]*}" )
2338+ (looking-at " [ \t\n ]*}" ))
2339+ (save-excursion
2340+ (backward-list ) (forward-symbol -1 ) (looking-at " \\ _<do\\ _>" ))
2341+ (typescript--re-search-backward " \\ _<do\\ _>" (point-at-bol ) t )
2342+ (or (looking-at " \\ _<do\\ _>" )
2343+ (let ((saved-indent (current-indentation )))
2344+ (while (and (typescript--re-search-backward " ^\\ s-*\\ _<" nil t )
2345+ (/= (current-indentation ) saved-indent)))
2346+ (and (looking-at " \\ s-*\\ _<do\\ _>" )
2347+ (not (typescript--re-search-forward
2348+ " \\ _<while\\ _>" (point-at-eol ) t ))
2349+ (= (current-indentation ) saved-indent)))))))))
23472350
23482351
23492352(defun typescript--ctrl-statement-indentation ()
@@ -2952,9 +2955,9 @@ Key bindings:
29522955 comment-start-skip " \\ (//+\\ |/\\ *+\\ )\\ s *" )
29532956
29542957 (setq-local electric-indent-chars
2955- (append " {}():;," electric-indent-chars))
2958+ (append " {}():;," electric-indent-chars))
29562959 (setq-local electric-layout-rules
2957- '((?\; . after) (?\{ . after) (?\} . before)))
2960+ '((?\; . after) (?\{ . after) (?\} . before)))
29582961
29592962 (let ((c-buffer-is-cc-mode t ))
29602963 ; ; FIXME: These are normally set by `c-basic-common-init' . Should
0 commit comments