[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Tree sitter support for C-like languages
From: |
Yuan Fu |
Subject: |
Re: Tree sitter support for C-like languages |
Date: |
Wed, 16 Nov 2022 09:51:43 -0800 |
I noticed that the new fontification is much busier than cc-mode, so here’s
some of my thoughts:
:language mode
:override t
:feature 'expression
'((assignment_expression
left: (identifier) @font-lock-variable-name-face)
I think assignment should be isolated out to an “assignment” feature, where we
highlight the lhs target of the assignment: the identifier, the field, etc. For
example, the assignment group in Python [1]
(call_expression
function: (identifier) @font-lock-function-name-face)
(field_expression
field: (field_identifier) @font-lock-variable-name-face)
(field_expression
argument: (identifier) @font-lock-variable-name-face
field: (field_identifier) @font-lock-variable-name-face)
(pointer_expression
argument: (identifier) @font-lock-variable-name-face))
They highlight every single use of functions and fields, so they should be
level 3. (And I’ll disable them personally :-) Highlighting the field and the
functions should be two different features IMO.
:language mode
:override t
:feature 'statement
'((expression_statement (identifier) @font-lock-variable-name-face)
(labeled_statement
label: (statement_identifier) @font-lock-type-face))
What does this rule highlight?
[1]
:feature 'assignment
:language 'python
`(;; Variable names and LHS.
(assignment left: (identifier)
@font-lock-variable-name-face)
(assignment left: (attribute
attribute: (identifier)
@font-lock-variable-name-face))
(pattern_list (identifier)
@font-lock-variable-name-face)
(tuple_pattern (identifier)
@font-lock-variable-name-face)
(list_pattern (identifier)
@font-lock-variable-name-face)
(list_splat_pattern (identifier)
@font-lock-variable-name-face))
Yuan
- Re: Tree sitter support for C-like languages, (continued)
Re: Tree sitter support for C-like languages, Randy Taylor, 2022/11/10
Re: Tree sitter support for C-like languages,
Yuan Fu <=
- Re: Tree sitter support for C-like languages, Theodor Thornhill, 2022/11/16
- Re: Tree sitter support for C-like languages, Yuan Fu, 2022/11/16
- Re: Tree sitter support for C-like languages, Yuan Fu, 2022/11/21
- Re: Tree sitter support for C-like languages, Theodor Thornhill, 2022/11/21
- Re: Tree sitter support for C-like languages, Yuan Fu, 2022/11/22