]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve fontification in typescript-ts-mode
authorJostein Kjønigsen <jostein@kjonigsen.net>
Mon, 28 Nov 2022 15:05:27 +0000 (16:05 +0100)
committerYuan Fu <casouri@gmail.com>
Mon, 28 Nov 2022 23:00:03 +0000 (15:00 -0800)
- Restore method-name fontification.
- Fontify all types in class-declarations, extendees too

* lisp/progmodes/typescript-ts-mode.el
(typescript-ts-mode--font-lock-settings): Change patterns.

lisp/progmodes/typescript-ts-mode.el

index bf483a31d3442855418a4e5caf65fa287287b3a6..6c926a4e3e054a0fc0afebc6f5132f4f2b11d02e 100644 (file)
 
      (method_definition
       name: (property_identifier) @font-lock-function-name-face)
+     (required_parameter (identifier) @font-lock-variable-name-face)
+     (optional_parameter (identifier) @font-lock-variable-name-face)
 
      (variable_declarator
       name: (identifier) @font-lock-variable-name-face)
 
      (enum_declaration (identifier) @font-lock-type-face)
 
+     (extends_clause value: (identifier) @font-lock-type-face)
+     ;; extends React.Component<T>
+     (extends_clause value: (member_expression
+                             object: (identifier) @font-lock-type-face
+                             property: (property_identifier) @font-lock-type-face))
+
      (arrow_function
       parameter: (identifier) @font-lock-variable-name-face)
 
    :language 'tsx
    :override t
    :feature 'property
-   `(((property_identifier) @font-lock-property-face)
-
-     (pair value: (identifier) @font-lock-variable-name-face)
+   `((pair value: (identifier) @font-lock-variable-name-face)
 
      ((shorthand_property_identifier) @font-lock-property-face)