Shopify / theme-check

The Ultimate Shopify Theme Linter
Other
333 stars 96 forks source link

[Intelligent code completion] Introduce support to iterator assignments in the `AssignmentsFinder` #663

Closed karreiro closed 1 year ago

karreiro commented 1 year ago

Currently, AssignmentsFinder only visits Liquid::Assign nodes to get valid assignments. However, it must also support iterator assignments like:

1. {% for p in collections.first.products %}
2.  {% assign last_product = p %}
3.  {{ p.title }}
4.  {{ last_product.█ }}
5. {% endfor %}

In other words, AssignmentsFinder must know that p exists at the line 2 and its type is product (so, last_product is also a product).

Context/Motivation: https://github.com/Shopify/theme-check/pull/654#discussion_r1018299135