Merge branch 'emacs-29' of git.sv.gnu.org:/srv/git/emacs into emacs-29
This commit is contained in:
commit
df243f785d
3 changed files with 155 additions and 139 deletions
|
@ -203,6 +203,8 @@ Return them as multiple value."
|
|||
t)
|
||||
((and (not (symbolp x)) (symbolp y))
|
||||
nil)
|
||||
((or (consp x) (consp y)
|
||||
nil))
|
||||
(t
|
||||
(< (sxhash-equal x)
|
||||
(sxhash-equal y)))))))
|
||||
|
|
|
@ -318,8 +318,8 @@ Using the value `insert' is not recommended in editable
|
|||
buffers because it modifies them.
|
||||
When the value is `in-margins', then clickable buttons are
|
||||
displayed in the margins before the headings.
|
||||
When the value is `t', clickable buttons are displayed
|
||||
in the buffer before the headings. The values `t' and
|
||||
When the value is t, clickable buttons are displayed
|
||||
in the buffer before the headings. The values t and
|
||||
`in-margins' can be used in editing buffers because they
|
||||
don't modify the buffer."
|
||||
;; The value `insert' is not intended to be customizable.
|
||||
|
|
|
@ -199,9 +199,23 @@ Argument LANGUAGE is either `typescript' or `tsx'."
|
|||
[(nested_identifier (identifier)) (identifier)]
|
||||
@typescript-ts-jsx-tag-face)))))
|
||||
|
||||
(defun tsx-ts-mode--font-lock-compatibility-function-expression (language)
|
||||
"Handle tree-sitter grammar breaking change for `function' expression.
|
||||
|
||||
LANGUAGE can be `typescript' or `tsx'. Starting from version 0.20.4 of the
|
||||
typescript/tsx grammar, `function' becomes `function_expression'."
|
||||
(condition-case nil
|
||||
(progn (treesit-query-capture language '((function_expression) @cap))
|
||||
;; New version of the grammar
|
||||
'function_expression)
|
||||
(treesit-query-error
|
||||
;; Old version of the grammar
|
||||
'function)))
|
||||
|
||||
(defun typescript-ts-mode--font-lock-settings (language)
|
||||
"Tree-sitter font-lock settings.
|
||||
Argument LANGUAGE is either `typescript' or `tsx'."
|
||||
(let ((func-exp (tsx-ts-mode--font-lock-compatibility-function-expression language)))
|
||||
(treesit-font-lock-rules
|
||||
:language language
|
||||
:feature 'comment
|
||||
|
@ -228,7 +242,7 @@ Argument LANGUAGE is either `typescript' or `tsx'."
|
|||
:language language
|
||||
:override t ;; for functions assigned to variables
|
||||
:feature 'declaration
|
||||
`((function
|
||||
`((,func-exp
|
||||
name: (identifier) @font-lock-function-name-face)
|
||||
(function_declaration
|
||||
name: (identifier) @font-lock-function-name-face)
|
||||
|
@ -244,7 +258,7 @@ Argument LANGUAGE is either `typescript' or `tsx'."
|
|||
|
||||
(variable_declarator
|
||||
name: (identifier) @font-lock-function-name-face
|
||||
value: [(function) (arrow_function)])
|
||||
value: [(,func-exp) (arrow_function)])
|
||||
|
||||
(variable_declarator
|
||||
name: (identifier) @font-lock-variable-name-face)
|
||||
|
@ -264,7 +278,7 @@ Argument LANGUAGE is either `typescript' or `tsx'."
|
|||
name: (array_pattern
|
||||
(identifier)
|
||||
(identifier) @font-lock-function-name-face)
|
||||
value: (array (number) (function)))
|
||||
value: (array (number) (,func-exp)))
|
||||
|
||||
(catch_clause
|
||||
parameter: (identifier) @font-lock-variable-name-face)
|
||||
|
@ -323,11 +337,11 @@ Argument LANGUAGE is either `typescript' or `tsx'."
|
|||
|
||||
:language language
|
||||
:feature 'expression
|
||||
'((assignment_expression
|
||||
`((assignment_expression
|
||||
left: [(identifier) @font-lock-function-name-face
|
||||
(member_expression
|
||||
property: (property_identifier) @font-lock-function-name-face)]
|
||||
right: [(function) (arrow_function)]))
|
||||
right: [(,func-exp) (arrow_function)]))
|
||||
|
||||
:language language
|
||||
:feature 'function
|
||||
|
@ -375,7 +389,7 @@ Argument LANGUAGE is either `typescript' or `tsx'."
|
|||
:language language
|
||||
:feature 'escape-sequence
|
||||
:override t
|
||||
'((escape_sequence) @font-lock-escape-face)))
|
||||
'((escape_sequence) @font-lock-escape-face))))
|
||||
|
||||
;;;###autoload
|
||||
(define-derived-mode typescript-ts-base-mode prog-mode "TypeScript"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue