Closed Poitrin closed 1 year ago
should i be seeing these deprecated filters for integers and other object types?
should i be seeing these deprecated filters for integers and other object types?
Unfortunately yes – I did not change the logic, the deprecated filters are just more prominent now 😢:
If I take article_img_url
as an example, you will see that its input type is variable
:
"deprecated": true,
"syntax": "variable | article_img_url",
"name": "article_img_url"
Therefore, these filters – no matter if they are deprecated or not – are suggested for every type.
Among 9 variable
filters, 4 are deprecated (which are the ones you see in your screenshots).
start = { 'variable' => [0, 0], 'string' => [0, 0], 'form' => [0, 0], 'font' => [0, 0],
'number' => [0, 0], 'array' => [0, 0], 'media' => [0, 0], 'metafield' => [0, 0], 'paginate' => [0, 0], 'address' => [0, 0], 'type' => [0, 0] }
ShopifyLiquid::SourceIndex.filters.each_with_object(start) do |filter, result|
result[filter.input_type][filter.deprecated? ? 1 : 0] += 1
end
=> {"variable"=>[5, 4], "string"=>[82, 2], "form"=>[2, 1], "font"=>[3, 0], "number"=>[17, 0], "array"=>[11, 0], "media"=>[4, 0], "metafield"=>[2, 0], "paginate"=>[1, 0], "address"=>[1, 0], "type"=>[2, 0]}
Possible solutions
image
instead. That way, they are only suggested when working with image
s like article.image
.variable
filters.)Unfortunately yes – I did not change the logic, the deprecated filters are just more prominent now 😢:
goooot it thanks for the explanation! i think if you havent already lets capture this in an issue as a possible enhancement. for now tho i think it's a good idea to keep it as is, we can get feedback from developers what we release and see if it's confusing. but i suspect hiding the deprecated suggestion all together will be more frustrating
Possible solutions (my fav) We update the docs so that the 4 aforementioned deprecated filters get the input type image instead. That way, they are only suggested when working with images like article.image. We hide all deprecated filters. (Or at least deprecated variable filters.)
sorting deprecated variable suggestions to the bottom might also be a good compromise 😮
if you havent already lets capture this in an issue as a possible enhancement
→ https://github.com/Shopify/theme-check/issues/676 – Done :-)
WHY are these changes introduced?
Fixes #658
WHAT is this pull request doing?
Adds logic to
FilterCompletionProvider
to…| default
)Displays deprecated filters too, so that users can still see the filter they wanted to use.
How to test your changes?
For all cases (if not stated differently):
array
string
number
form
font
media
metafield
paginate
address
Display all filters
In the following examples, return types have no corresponding filter (e.g.
article.image
has return typeimage
, but there is no filter forimage |
). Therefore, make sure that all filters are suggested.Display deprecated filters
Verify that deprecated filters are crossed out, and that a deprecation reason is shown.