profile
viewpoint

Ask questionsWrong Highlight When a Union Type Inside a Generic Starts With null

Problem

so I've found this bug in the highlighting image as you can see, if I start the generic with a null then this error happens, a good question also is if null should be highlighted as a reserved keyword, as a type, or as a value (in my color scheme types are blue , values are purple and reserved keywords are pink)

tree-sitter/tree-sitter-typescript

Answer questions mjambon

Even simpler repro:

$ tree-sitter parse <(echo 'a<null|b>()')
(program [0, 0] - [1, 0]
  (ERROR [0, 0] - [0, 11]
    (binary_expression [0, 0] - [0, 6]
      left: (identifier [0, 0] - [0, 1])
      right: (null [0, 2] - [0, 6]))
    (identifier [0, 7] - [0, 8])
    (formal_parameters [0, 9] - [0, 11])))
/dev/fd/63	0 ms	(ERROR [0, 0] - [0, 11])
$ tree-sitter parse <(echo 'a<b|null>()')
(program [0, 0] - [1, 0]
  (expression_statement [0, 0] - [0, 11]
    (call_expression [0, 0] - [0, 11]
      function: (identifier [0, 0] - [0, 1])
      type_arguments: (type_arguments [0, 1] - [0, 9]
        (union_type [0, 2] - [0, 8]
          (type_identifier [0, 2] - [0, 3])
          (type_identifier [0, 4] - [0, 8])))
      arguments: (arguments [0, 9] - [0, 11]))))
useful!

Related questions

No questions were found.
source:https://uonfu.com/
Github User Rank List