[Top][All Lists]

[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
      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]

      function: (identifier) @font-lock-function-name-face)

      field: (field_identifier) @font-lock-variable-name-face)

      argument: (identifier) @font-lock-variable-name-face
      field: (field_identifier) @font-lock-variable-name-face)

      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)
      label: (statement_identifier) @font-lock-type-face))

What does this rule highlight?

   :feature 'assignment
   :language 'python
   `(;; Variable names and LHS.
     (assignment left: (identifier)
     (assignment left: (attribute
                        attribute: (identifier)
     (pattern_list (identifier)
     (tuple_pattern (identifier)
     (list_pattern (identifier)
     (list_splat_pattern (identifier)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]