gbaptista / sublime-text-fennel

Fennel Language Support for Sublime Text 3 & 4
https://packagecontrol.io/packages/Fennel
MIT License
15 stars 2 forks source link

Multi-value pick in let binding falsely highlighted as function #7

Open turbo opened 2 years ago

turbo commented 2 years ago

A pick expression should highlight the same in (local (_ a b) (fn)) and (let [(_ a b) (fn)] ...), but in let, the first item is treated as a function by the highlighter:

image
gbaptista commented 2 years ago

Thanks for reporting!

Could you help me isolate the scenario? I remember fixing this case, and I cannot reproduce it here.

Example:

(let [(x y z) (unpack [10 9 8])]
  (+ x y z))

Works fine: Screenshot_20220728_090546

We have these tests to validate that scenario: syntax_test_fennel_reference.fnl#L250 and syntax_test_fennel_reference.fnl#L513

I suspect it may be an edge case with nested expressions or something like that.

turbo commented 2 years ago

Here's the smallest valid case I can produce:

(let [x y
      (_ _ a b) c])

Here's a smaller example that still exhibits the behavior, but is invalid syntax - may help debug:

(let [x 
      (_ _)])
gbaptista commented 2 years ago

Oh, I got it. It happens from the second pair onwards:

(let [(a b) [1 2] (c d) [3 4]])

Screenshot_20220728_092907

The c should not be highlighted as a function call.