tlaplus-community / tree-sitter-tlaplus

A tree-sitter grammar for TLA⁺ and PlusCal
MIT License
57 stars 10 forks source link

Incorrect reference highlighting of parameters #62

Open ahelwer opened 2 years ago

ahelwer commented 2 years ago

This will be highlighted incorrectly with tree-sitter's highlighting implementation, although not nvim-treesitter's.

standalone_symbol_ref(<> _, _ ‼ _, _ ^#) ≜
  ∧ op(□, ≺, ^*)  \* constant
  ∧ op(<>, ‼, ^#) \* parameter
  ∧ op(¬, ⊆, ⁺)   \* defined operator

symbol_scope_test ≜
  ∧ <>(1)
  ∧ a ‼ b
  ∧ x^#

The -fix operators in symbol_scope_test will exhibit reference highlighting from the parameters in standalone_symbol_ref, even though they're out of scope. Strangely, adding an operator definition between the two operators fixes the problem; at least the issue is limited in scope. Uncertain whether this is a bug with the grammar or with how tree-sitter does highlighting.