theme-check 1.11.0 → 1.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -0
  3. data/CHANGELOG.md +18 -0
  4. data/CONTRIBUTING.md +82 -0
  5. data/README.md +4 -0
  6. data/Rakefile +7 -0
  7. data/TROUBLESHOOTING.md +65 -0
  8. data/data/shopify_liquid/built_in_liquid_objects.json +60 -0
  9. data/data/shopify_liquid/deprecated_filters.json +22 -0
  10. data/data/shopify_liquid/documentation/filters.json +5528 -0
  11. data/data/shopify_liquid/documentation/latest.json +1 -0
  12. data/data/shopify_liquid/documentation/objects.json +19272 -0
  13. data/data/shopify_liquid/documentation/tags.json +1252 -0
  14. data/data/shopify_liquid/plus_labels.json +15 -0
  15. data/data/shopify_liquid/theme_app_extension_labels.json +3 -0
  16. data/lib/theme_check/checks/undefined_object.rb +4 -0
  17. data/lib/theme_check/language_server/completion_context.rb +52 -0
  18. data/lib/theme_check/language_server/completion_engine.rb +15 -21
  19. data/lib/theme_check/language_server/completion_provider.rb +26 -1
  20. data/lib/theme_check/language_server/completion_providers/assignments_completion_provider.rb +40 -0
  21. data/lib/theme_check/language_server/completion_providers/filter_completion_provider.rb +49 -6
  22. data/lib/theme_check/language_server/completion_providers/object_attribute_completion_provider.rb +48 -0
  23. data/lib/theme_check/language_server/completion_providers/object_completion_provider.rb +15 -10
  24. data/lib/theme_check/language_server/completion_providers/render_snippet_completion_provider.rb +5 -1
  25. data/lib/theme_check/language_server/completion_providers/tag_completion_provider.rb +8 -1
  26. data/lib/theme_check/language_server/handler.rb +3 -1
  27. data/lib/theme_check/language_server/protocol.rb +9 -0
  28. data/lib/theme_check/language_server/type_helper.rb +22 -0
  29. data/lib/theme_check/language_server/variable_lookup_finder/assignments_finder/node_handler.rb +63 -0
  30. data/lib/theme_check/language_server/variable_lookup_finder/assignments_finder/scope.rb +60 -0
  31. data/lib/theme_check/language_server/variable_lookup_finder/assignments_finder/scope_visitor.rb +44 -0
  32. data/lib/theme_check/language_server/variable_lookup_finder/assignments_finder.rb +76 -0
  33. data/lib/theme_check/language_server/variable_lookup_finder/constants.rb +44 -0
  34. data/lib/theme_check/language_server/variable_lookup_finder/liquid_fixer.rb +103 -0
  35. data/lib/theme_check/language_server/variable_lookup_finder/potential_lookup.rb +10 -0
  36. data/lib/theme_check/language_server/variable_lookup_finder/tolerant_parser.rb +114 -0
  37. data/lib/theme_check/language_server/variable_lookup_finder.rb +67 -100
  38. data/lib/theme_check/language_server/variable_lookup_traverser.rb +70 -0
  39. data/lib/theme_check/language_server.rb +12 -0
  40. data/lib/theme_check/remote_asset_file.rb +13 -7
  41. data/lib/theme_check/shopify_liquid/deprecated_filter.rb +1 -1
  42. data/lib/theme_check/shopify_liquid/documentation/markdown_template.rb +51 -0
  43. data/lib/theme_check/shopify_liquid/documentation.rb +44 -0
  44. data/lib/theme_check/shopify_liquid/filter.rb +35 -3
  45. data/lib/theme_check/shopify_liquid/object.rb +8 -3
  46. data/lib/theme_check/shopify_liquid/source_index/base_entry.rb +60 -0
  47. data/lib/theme_check/shopify_liquid/source_index/base_state.rb +23 -0
  48. data/lib/theme_check/shopify_liquid/source_index/filter_entry.rb +18 -0
  49. data/lib/theme_check/shopify_liquid/source_index/filter_state.rb +11 -0
  50. data/lib/theme_check/shopify_liquid/source_index/object_entry.rb +14 -0
  51. data/lib/theme_check/shopify_liquid/source_index/object_state.rb +11 -0
  52. data/lib/theme_check/shopify_liquid/source_index/parameter_entry.rb +21 -0
  53. data/lib/theme_check/shopify_liquid/source_index/property_entry.rb +9 -0
  54. data/lib/theme_check/shopify_liquid/source_index/return_type_entry.rb +37 -0
  55. data/lib/theme_check/shopify_liquid/source_index/tag_entry.rb +20 -0
  56. data/lib/theme_check/shopify_liquid/source_index/tag_state.rb +11 -0
  57. data/lib/theme_check/shopify_liquid/source_index.rb +76 -0
  58. data/lib/theme_check/shopify_liquid/source_manager.rb +111 -0
  59. data/lib/theme_check/shopify_liquid/tag.rb +11 -1
  60. data/lib/theme_check/shopify_liquid.rb +17 -1
  61. data/lib/theme_check/version.rb +1 -1
  62. data/shipit.rubygems.yml +3 -0
  63. data/theme-check.gemspec +3 -1
  64. metadata +40 -8
  65. data/data/shopify_liquid/deprecated_filters.yml +0 -14
  66. data/data/shopify_liquid/filters.yml +0 -211
  67. data/data/shopify_liquid/objects.yml +0 -84
  68. data/data/shopify_liquid/plus_objects.yml +0 -15
  69. data/data/shopify_liquid/tags.yml +0 -30
  70. data/data/shopify_liquid/theme_app_extension_objects.yml +0 -2
@@ -6,6 +6,8 @@ module ThemeCheck
6
6
  module Tag
7
7
  extend self
8
8
 
9
+ LABELS_NOT_IN_SOURCE_INDEX = ["elsif", "ifchanged", { "schema" => "endschema" }, "when"]
10
+
9
11
  def labels
10
12
  @labels ||= tags_file_contents
11
13
  .map { |x| to_label(x) }
@@ -38,7 +40,15 @@ module ThemeCheck
38
40
  end
39
41
 
40
42
  def tags_file_contents
41
- @tags_file_contents ||= YAML.load(File.read("#{__dir__}/../../../data/shopify_liquid/tags.yml"))
43
+ @tags_file_contents ||= SourceIndex.tags.map do |tag|
44
+ opening_tag = tag.name
45
+ closing_tag = "end#{opening_tag}"
46
+ if tag.hash['syntax'] =~ /#{opening_tag}.+#{closing_tag}/m
47
+ { opening_tag => closing_tag }
48
+ else
49
+ opening_tag
50
+ end
51
+ end + LABELS_NOT_IN_SOURCE_INDEX
42
52
  end
43
53
  end
44
54
  end
@@ -1,6 +1,22 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require_relative 'shopify_liquid/deprecated_filter'
4
+ require_relative 'shopify_liquid/documentation'
3
5
  require_relative 'shopify_liquid/filter'
4
6
  require_relative 'shopify_liquid/object'
5
- require_relative 'shopify_liquid/tag'
7
+ require_relative 'shopify_liquid/source_manager'
8
+ require_relative 'shopify_liquid/source_index'
6
9
  require_relative 'shopify_liquid/system_translations'
10
+ require_relative 'shopify_liquid/tag'
11
+
12
+ require_relative 'shopify_liquid/source_index/base_entry'
13
+ require_relative 'shopify_liquid/source_index/filter_entry'
14
+ require_relative 'shopify_liquid/source_index/object_entry'
15
+ require_relative 'shopify_liquid/source_index/parameter_entry'
16
+ require_relative 'shopify_liquid/source_index/property_entry'
17
+ require_relative 'shopify_liquid/source_index/return_type_entry'
18
+ require_relative 'shopify_liquid/source_index/tag_entry'
19
+ require_relative 'shopify_liquid/source_index/base_state'
20
+ require_relative 'shopify_liquid/source_index/filter_state'
21
+ require_relative 'shopify_liquid/source_index/object_state'
22
+ require_relative 'shopify_liquid/source_index/tag_state'
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module ThemeCheck
3
- VERSION = "1.11.0"
3
+ VERSION = "1.12.1"
4
4
  end
@@ -0,0 +1,3 @@
1
+ deploy:
2
+ pre:
3
+ - bundle exec rake download_theme_liquid_docs
data/theme-check.gemspec CHANGED
@@ -18,7 +18,9 @@ Gem::Specification.new do |spec|
18
18
  spec.metadata['allowed_push_host'] = 'https://rubygems.org'
19
19
 
20
20
  spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
21
- %x{git ls-files -z}.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
+ # Load all files tracked in git except files in test directory
22
+ # Include untracked files in liquid documentation folder
23
+ %x{git ls-files -z}.split("\x0").reject { |f| f.match(%r{^test/}) } + Dir['data/shopify_liquid/documentation/**']
22
24
  end
23
25
  spec.bindir = "exe"
24
26
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: theme-check
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.0
4
+ version: 1.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marc-André Cournoyer
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-08-22 00:00:00.000000000 Z
11
+ date: 2022-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: liquid
@@ -76,17 +76,20 @@ files:
76
76
  - README.md
77
77
  - RELEASING.md
78
78
  - Rakefile
79
+ - TROUBLESHOOTING.md
79
80
  - bin/theme-check
80
81
  - bin/theme-check-language-server
81
82
  - config/default.yml
82
83
  - config/nothing.yml
83
84
  - config/theme_app_extension.yml
84
- - data/shopify_liquid/deprecated_filters.yml
85
- - data/shopify_liquid/filters.yml
86
- - data/shopify_liquid/objects.yml
87
- - data/shopify_liquid/plus_objects.yml
88
- - data/shopify_liquid/tags.yml
89
- - data/shopify_liquid/theme_app_extension_objects.yml
85
+ - data/shopify_liquid/built_in_liquid_objects.json
86
+ - data/shopify_liquid/deprecated_filters.json
87
+ - data/shopify_liquid/documentation/filters.json
88
+ - data/shopify_liquid/documentation/latest.json
89
+ - data/shopify_liquid/documentation/objects.json
90
+ - data/shopify_liquid/documentation/tags.json
91
+ - data/shopify_liquid/plus_labels.json
92
+ - data/shopify_liquid/theme_app_extension_labels.json
90
93
  - data/shopify_translation_keys.yml
91
94
  - dev.yml
92
95
  - docs/api/check.md
@@ -222,10 +225,13 @@ files:
222
225
  - lib/theme_check/language_server/code_action_provider.rb
223
226
  - lib/theme_check/language_server/code_action_providers/quickfix_code_action_provider.rb
224
227
  - lib/theme_check/language_server/code_action_providers/source_fix_all_code_action_provider.rb
228
+ - lib/theme_check/language_server/completion_context.rb
225
229
  - lib/theme_check/language_server/completion_engine.rb
226
230
  - lib/theme_check/language_server/completion_helper.rb
227
231
  - lib/theme_check/language_server/completion_provider.rb
232
+ - lib/theme_check/language_server/completion_providers/assignments_completion_provider.rb
228
233
  - lib/theme_check/language_server/completion_providers/filter_completion_provider.rb
234
+ - lib/theme_check/language_server/completion_providers/object_attribute_completion_provider.rb
229
235
  - lib/theme_check/language_server/completion_providers/object_completion_provider.rb
230
236
  - lib/theme_check/language_server/completion_providers/render_snippet_completion_provider.rb
231
237
  - lib/theme_check/language_server/completion_providers/tag_completion_provider.rb
@@ -251,8 +257,18 @@ files:
251
257
  - lib/theme_check/language_server/protocol.rb
252
258
  - lib/theme_check/language_server/server.rb
253
259
  - lib/theme_check/language_server/tokens.rb
260
+ - lib/theme_check/language_server/type_helper.rb
254
261
  - lib/theme_check/language_server/uri_helper.rb
255
262
  - lib/theme_check/language_server/variable_lookup_finder.rb
263
+ - lib/theme_check/language_server/variable_lookup_finder/assignments_finder.rb
264
+ - lib/theme_check/language_server/variable_lookup_finder/assignments_finder/node_handler.rb
265
+ - lib/theme_check/language_server/variable_lookup_finder/assignments_finder/scope.rb
266
+ - lib/theme_check/language_server/variable_lookup_finder/assignments_finder/scope_visitor.rb
267
+ - lib/theme_check/language_server/variable_lookup_finder/constants.rb
268
+ - lib/theme_check/language_server/variable_lookup_finder/liquid_fixer.rb
269
+ - lib/theme_check/language_server/variable_lookup_finder/potential_lookup.rb
270
+ - lib/theme_check/language_server/variable_lookup_finder/tolerant_parser.rb
271
+ - lib/theme_check/language_server/variable_lookup_traverser.rb
256
272
  - lib/theme_check/language_server/versioned_in_memory_storage.rb
257
273
  - lib/theme_check/liquid_check.rb
258
274
  - lib/theme_check/liquid_file.rb
@@ -272,8 +288,23 @@ files:
272
288
  - lib/theme_check/schema_helper.rb
273
289
  - lib/theme_check/shopify_liquid.rb
274
290
  - lib/theme_check/shopify_liquid/deprecated_filter.rb
291
+ - lib/theme_check/shopify_liquid/documentation.rb
292
+ - lib/theme_check/shopify_liquid/documentation/markdown_template.rb
275
293
  - lib/theme_check/shopify_liquid/filter.rb
276
294
  - lib/theme_check/shopify_liquid/object.rb
295
+ - lib/theme_check/shopify_liquid/source_index.rb
296
+ - lib/theme_check/shopify_liquid/source_index/base_entry.rb
297
+ - lib/theme_check/shopify_liquid/source_index/base_state.rb
298
+ - lib/theme_check/shopify_liquid/source_index/filter_entry.rb
299
+ - lib/theme_check/shopify_liquid/source_index/filter_state.rb
300
+ - lib/theme_check/shopify_liquid/source_index/object_entry.rb
301
+ - lib/theme_check/shopify_liquid/source_index/object_state.rb
302
+ - lib/theme_check/shopify_liquid/source_index/parameter_entry.rb
303
+ - lib/theme_check/shopify_liquid/source_index/property_entry.rb
304
+ - lib/theme_check/shopify_liquid/source_index/return_type_entry.rb
305
+ - lib/theme_check/shopify_liquid/source_index/tag_entry.rb
306
+ - lib/theme_check/shopify_liquid/source_index/tag_state.rb
307
+ - lib/theme_check/shopify_liquid/source_manager.rb
277
308
  - lib/theme_check/shopify_liquid/system_translations.rb
278
309
  - lib/theme_check/shopify_liquid/tag.rb
279
310
  - lib/theme_check/storage.rb
@@ -284,6 +315,7 @@ files:
284
315
  - lib/theme_check/theme_file_rewriter.rb
285
316
  - lib/theme_check/version.rb
286
317
  - packaging/homebrew/theme_check.base.rb
318
+ - shipit.rubygems.yml
287
319
  - theme-check.gemspec
288
320
  homepage: https://github.com/Shopify/theme-check
289
321
  licenses:
@@ -1,14 +0,0 @@
1
- ---
2
- Liquid::ColorFilter:
3
- hex_to_rgba:
4
- - color_to_rgb
5
- - color_modify
6
- Liquid::UrlFilter:
7
- img_url:
8
- - image_url
9
- img_tag:
10
- - image_tag
11
- collection_img_url:
12
- - img_url
13
- product_img_url:
14
- - img_url
@@ -1,211 +0,0 @@
1
- ---
2
- # Here's an example workflow that's going to get ya the list of filters available
3
- # ```bash
4
- # spin up storefront-renderer
5
- # spin ssh
6
- # cd storefront-renderer
7
- # bundle exec rake console
8
- # ```
9
- # ```ruby
10
- # Pathname(ENV["HOME"]).join('filters.yml').write(YAML.dump(Liquid::StrainerFactory.global_filter_names))
11
- # ```
12
- # ```bash
13
- # exit
14
- # scp $(spin show -o fqdn):/filters.yml .
15
- # ```
16
- # The list of filters is now in a file named filters.yml in your $(pwd).
17
- # Note that it'll probably need a bit of massaging before including here...
18
- Liquid::StandardFilters:
19
- - times
20
- - h
21
- - uniq
22
- - compact
23
- - url_encode
24
- - escape
25
- - escape_once
26
- - url_decode
27
- - base64_encode
28
- - base64_decode
29
- - base64_url_safe_encode
30
- - base64_url_safe_decode
31
- - truncatewords
32
- - strip_html
33
- - strip_newlines
34
- - replace
35
- - remove
36
- - sort_natural
37
- - replace_first
38
- - replace_last
39
- - remove_first
40
- - remove_last
41
- - newline_to_br
42
- - upcase
43
- - downcase
44
- - capitalize
45
- - divided_by
46
- - minus
47
- - at_most
48
- - at_least
49
- - size
50
- - last
51
- - split
52
- - append
53
- - reverse
54
- - concat
55
- - prepend
56
- - join
57
- - strip
58
- - lstrip
59
- - rstrip
60
- - sort
61
- - where
62
- - map
63
- - default
64
- - first
65
- - slice
66
- - modulo
67
- - abs
68
- - date
69
- - ceil
70
- - round
71
- - truncate
72
- - plus
73
- - floor
74
- FormFilter:
75
- - payment_terms
76
- - installments_pricing
77
- - default_errors
78
- - payment_button
79
- DateFilter:
80
- - date
81
- I18nFilter:
82
- - translate
83
- - time_tag
84
- - sentence
85
- - t
86
- - date
87
- - app_block_path_for
88
- - dev_shop?
89
- - app_extension_path_for
90
- - global_block_type?
91
- - app_block_path?
92
- - app_extension_path?
93
- - app_snippet_path?
94
- - registration_uuid_from
95
- - handle_from
96
- UrlFilter:
97
- - stylesheet_tag
98
- - script_tag
99
- - img_tag
100
- - link_to
101
- - shopify_asset_url
102
- - payment_type_img_url
103
- - payment_type_svg_tag
104
- - placeholder_svg_tag
105
- - img_url
106
- - asset_url
107
- - asset_img_url
108
- - global_asset_url
109
- - file_url
110
- - file_img_url
111
- - product_img_url
112
- - collection_img_url
113
- - article_img_url
114
- - image_url
115
- - preload_tag
116
- JsonFilter:
117
- - json
118
- ColorFilter:
119
- - color_mix
120
- - color_contrast
121
- - color_difference
122
- - brightness_difference
123
- - hex_to_rgba
124
- - color_to_rgb
125
- - color_to_hsl
126
- - color_to_hex
127
- - color_extract
128
- - color_brightness
129
- - color_modify
130
- - color_lighten
131
- - color_darken
132
- - color_saturate
133
- - color_desaturate
134
- MoneyFilter:
135
- - money
136
- - money_with_currency
137
- - money_without_currency
138
- - money_without_trailing_zeros
139
- StringFilter:
140
- - md5
141
- - camelcase
142
- - format_code
143
- - handle
144
- - camelize
145
- - handleize
146
- - url_param_escape
147
- - url_escape
148
- - encode_url_component
149
- CollectionFilter:
150
- - sort_by
151
- - within
152
- - link_to_vendor
153
- - link_to_type
154
- - url_for_type
155
- - url_for_vendor
156
- TagFilter:
157
- - link_to_tag
158
- - highlight_active_tag
159
- - link_to_add_tag
160
- - link_to_remove_tag
161
- CryptoFilter:
162
- - hmac_sha1
163
- - hmac_sha256
164
- - md5
165
- - sha1
166
- - sha256
167
- CustomerAccountFilter:
168
- - customer_login_link
169
- - customer_logout_link
170
- - customer_register_link
171
- - recover_password_link
172
- - delete_customer_address_link
173
- - edit_customer_address_link
174
- - cancel_customer_order_link
175
- CurrencyFormFilter:
176
- - currency_selector
177
- PaginationFilter:
178
- - default_pagination
179
- WeightFilter:
180
- - unit
181
- - weight
182
- - weight_with_unit
183
- TextFilter:
184
- - pluralize
185
- - highlight
186
- - format_address
187
- - paragraphize
188
- - excerpt
189
- - pad_spaces
190
- FontFilter:
191
- - font_face
192
- - font_url
193
- - font_modify
194
- DistanceFilter:
195
- - distance_from
196
- MediaFilter:
197
- - external_video_tag
198
- - video_tag
199
- - model_viewer_tag
200
- - media_tag
201
- - image_tag
202
- - external_video_url
203
- ThemeFilter:
204
- - theme_url
205
- - link_to_theme
206
- - _online_store_editor_live_setting
207
- MetafieldFilter:
208
- - metafield_tag
209
- - metafield_text
210
- DebugFilter:
211
- - debug
@@ -1,84 +0,0 @@
1
- ---
2
- - additional_checkout_buttons
3
- - address
4
- - all_country_option_tags
5
- - all_products
6
- - article
7
- - articles
8
- - block
9
- - blog
10
- - blogs
11
- - canonical_url
12
- - cart
13
- - checkout
14
- - collection
15
- - collections
16
- - comment
17
- - content_for_additional_checkout_buttons
18
- - content_for_header
19
- - content_for_index
20
- - content_for_layout
21
- - country_option_tags
22
- - currency
23
- - current_page
24
- - current_tags
25
- - customer
26
- - customer_address
27
- - discount_allocation
28
- - discount_application
29
- - external_video
30
- - font
31
- - forloop
32
- - form
33
- - fulfillment
34
- - gift_card
35
- - handle
36
- - image
37
- - images
38
- - line_item
39
- - link
40
- - linklist
41
- - linklists
42
- - location
43
- - localization
44
- - metafield
45
- - model
46
- - model_source
47
- - order
48
- - page
49
- - page_description
50
- - page_image
51
- - page_title
52
- - pages
53
- - paginate
54
- - part
55
- - policy
56
- - powered_by_link
57
- - predictive_search
58
- - product
59
- - product_option
60
- - product_variant
61
- - recommendations
62
- - request
63
- - routes
64
- - script
65
- - scripts
66
- - search
67
- - section
68
- - selling_plan
69
- - selling_plan_allocation
70
- - selling_plan_group
71
- - settings
72
- - shipping_method
73
- - shop
74
- - shop_locale
75
- - store_availability
76
- - tablerow
77
- - tax_line
78
- - template
79
- - theme
80
- - transaction
81
- - unit_price_measurement
82
- - variant
83
- - video
84
- - video_source
@@ -1,15 +0,0 @@
1
- ---
2
- - alternative_payment_methods
3
- - breadcrumb
4
- - checkout_html_classes
5
- - checkout_scripts
6
- - checkout_stylesheets
7
- - content_for_footer
8
- - content_for_logo
9
- - content_for_order_summary
10
- - direction
11
- - locale
12
- - order_summary_toggle
13
- - page_title
14
- - skip_to_content_link
15
- - tracking_code
@@ -1,30 +0,0 @@
1
- ---
2
- - assign
3
- - break
4
- - capture
5
- - case: endcase
6
- - comment: endcomment
7
- - continue
8
- - cycle
9
- - decrement
10
- - echo
11
- - else
12
- - elsif
13
- - for: endfor
14
- - form: endform
15
- - if: endif
16
- - ifchanged
17
- - increment
18
- - javascript: endjavascript
19
- - layout
20
- - liquid
21
- - paginate: endpaginate
22
- - raw
23
- - render
24
- - schema: endschema
25
- - section
26
- - style: endstyle
27
- - stylesheet
28
- - tablerow
29
- - unless
30
- - when
@@ -1,2 +0,0 @@
1
- ---
2
- - app