EmranMR / tree-sitter-blade

tree-sitter grammar for Laravel blade files
MIT License
199 stars 8 forks source link

comment bug #42

Closed EmranMR closed 11 months ago

EmranMR commented 11 months ago

The new injections.scm needs to be adjusted so that it takes into account not consider comment body as php, require predicate to fix this:

Screenshot 2023-12-04 at 17 54 31
EmranMR commented 11 months ago

Remove extras bring $.comment inside definition. It is more semantic, and gives more granular control in terms of injection, otherwise odd behaviour arise like below with no ability to fix the injections.scm The appearance anywhere in the document is already taken into account

; ❌ Wrong
(blade [0, 0] - [3, 0]
  (text [0, 0] - [3, 0]
    (comment [1, 4] - [1, 21]
      (text [1, 9] - [1, 17]))))
; ✅ Correct
(blade [0, 0] - [3, 0]
  (text [0, 0] - [1, 4])
  (comment [1, 4] - [1, 21]
    (text [1, 9] - [1, 17]))
  (text [2, 0] - [3, 0]))