Shopify / theme-check

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

Languageserver Crashes - VSCode WSL2 Win11 #721

Open ChristopherCapito opened 1 year ago

ChristopherCapito commented 1 year ago

Describe the bug The language server crashes after going through the theme files.

Expected I expecte the check to suceed or fail, but not to crash without a result.

Actual The languagserver goes through all files, on the last one (locales/en.default.json) it crashes.

Stack trace

Checking . ...
Exception while running `NestedSnippet#on_end`:
Timeout::Error: execution expired
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/theme-check-1.14.0/lib/theme_check/offense.rb:33:in `initialize'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/theme-check-1.14.0/lib/theme_check/check.rb:96:in `new'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/theme-check-1.14.0/lib/theme_check/check.rb:96:in `add_offense'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/theme-check-1.14.0/lib/theme_check/checks/nested_snippet.rb:42:in `block (2 levels) in on_end'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/theme-check-1.14.0/lib/theme_check/checks/nested_snippet.rb:17:in `block (2 levels) in with_deep_nested'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/theme-check-1.14.0/lib/theme_check/checks/nested_snippet.rb:17:in `block (2 levels) in with_deep_nested'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/theme-check-1.14.0/lib/theme_check/checks/nested_snippet.rb:17:in `block (2 levels) in with_deep_nested'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/theme-check-1.14.0/lib/theme_check/checks/nested_snippet.rb:13:in `block in with_deep_nested'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/3.2.0/set.rb:511:in `each_key'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/3.2.0/set.rb:511:in `each'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/theme-check-1.14.0/lib/theme_check/checks/nested_snippet.rb:11:in `with_deep_nested'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/theme-check-1.14.0/lib/theme_check/checks/nested_snippet.rb:17:in `block in with_deep_nested'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/3.2.0/set.rb:511:in `each_key'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/3.2.0/set.rb:511:in `each'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/theme-check-1.14.0/lib/theme_check/checks/nested_snippet.rb:11:in `with_deep_nested'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/theme-check-1.14.0/lib/theme_check/checks/nested_snippet.rb:17:in `block in with_deep_nested'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/3.2.0/set.rb:511:in `each_key'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/3.2.0/set.rb:511:in `each'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/theme-check-1.14.0/lib/theme_check/checks/nested_snippet.rb:11:in `with_deep_nested'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/theme-check-1.14.0/lib/theme_check/checks/nested_snippet.rb:17:in `block in with_deep_nested'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/3.2.0/set.rb:511:in `each_key'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/3.2.0/set.rb:511:in `each'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/theme-check-1.14.0/lib/theme_check/checks/nested_snippet.rb:11:in `with_deep_nested'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/theme-check-1.14.0/lib/theme_check/checks/nested_snippet.rb:41:in `block in on_end'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/theme-check-1.14.0/lib/theme_check/checks/nested_snippet.rb:40:in `each_pair'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/theme-check-1.14.0/lib/theme_check/checks/nested_snippet.rb:40:in `on_end'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/theme-check-1.14.0/lib/theme_check/checks.rb:42:in `block in call_check_method'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/3.2.0/timeout.rb:189:in `block in timeout'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/3.2.0/timeout.rb:36:in `block in catch'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/3.2.0/timeout.rb:36:in `catch'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/3.2.0/timeout.rb:36:in `catch'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/3.2.0/timeout.rb:198:in `timeout'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/theme-check-1.14.0/lib/theme_check/checks.rb:41:in `call_check_method'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/theme-check-1.14.0/lib/theme_check/checks.rb:11:in `block in call'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/theme-check-1.14.0/lib/theme_check/checks.rb:10:in `each'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/theme-check-1.14.0/lib/theme_check/checks.rb:10:in `call'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/theme-check-1.14.0/lib/theme_check/analyzer.rb:170:in `finish'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/theme-check-1.14.0/lib/theme_check/analyzer.rb:64:in `analyze_theme'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/theme-check-1.14.0/lib/theme_check/cli.rb:191:in `check'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/theme-check-1.14.0/lib/theme_check/cli.rb:123:in `run!'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/theme-check-1.14.0/lib/theme_check/cli.rb:127:in `run'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/theme-check-1.14.0/lib/theme_check/cli.rb:149:in `parse_and_run'
  /home/cdev/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/theme-check-1.14.0/exe/theme-check:6:in `<top (required)>'
  /home/cdev/.rbenv/versions/3.2.1/bin/theme-check:25:in `load'
  /home/cdev/.rbenv/versions/3.2.1/bin/theme-check:25:in `<main>'

Theme File: ? Node: ? Markup:

Line number: ? Check options: {:max_nesting_level=>3} Theme Check Version: 1.14.0 Ruby Version: 3.2.1 Platform: x86_64-linux Muffin mode: activated



**Debugging information**
- OS [Windows 11, WSL2]
- Version 1.14.0

**Additional context**
The same error occurs with the VSCode Shopify Liquid extension.
Taichi-S commented 11 months ago

I'm also encountering the same issue

Taichi-S commented 11 months ago

@ChristopherCapito I'm not sure how it works, but I was able to run it without any bugs

Here is what I did:

  1. init .theme-check.yml
    theme-check --init
  2. change mac_nesting_level of NestedSnippet to 1 in .theme-check.yml (default value was 3. when it is 2, other warning happened)
    NestedSnippet:
    enabled: true
    ignore: []
    max_nesting_level: 1
  3. run theme-check using the .theme-check.yml
    theme-check -C .theme-check.yml