Closed stevekaran closed 1 year ago
Since adding cdnreconnect.rb to my gem repository, now I get a psych parser error 🤦♂️
D:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/psych-5.1.1.1/lib/psych/parser.rb:62:in `_native_parse': (.theme-check.yml): did not find expected key while parsing a block mapping at line 1 column 1 (Psych::SyntaxError)
from D:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/psych-5.1.1.1/lib/psych/parser.rb:62:in `parse'
from D:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/psych-5.1.1.1/lib/psych.rb:455:in `parse_stream'
from D:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/psych-5.1.1.1/lib/psych.rb:399:in `parse'
from D:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/psych-5.1.1.1/lib/psych.rb:323:in `safe_load'
from D:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/psych-5.1.1.1/lib/psych.rb:369:in `load'
from D:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/psych-5.1.1.1/lib/psych.rb:671:in `block in load_file'
from D:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/psych-5.1.1.1/lib/psych.rb:670:in `open'
from D:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/psych-5.1.1.1/lib/psych.rb:670:in `load_file'
from D:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/theme-check-1.15.0/lib/theme_check/config.rb:43:in `load_file'
from D:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/theme-check-1.15.0/lib/theme_check/config.rb:63:in `load_config'
from D:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/theme-check-1.15.0/lib/theme_check/config.rb:17:in `from_path'
from D:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/theme-check-1.15.0/lib/theme_check/language_server/handler.rb:274:in `config_for_path'
from D:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/theme-check-1.15.0/lib/theme_check/language_server/handler.rb:221:in `in_memory_storage'
from D:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/theme-check-1.15.0/lib/theme_check/language_server/handler.rb:68:in `on_initialize'
from D:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/theme-check-1.15.0/lib/theme_check/language_server/server.rb:138:in `handle_message'
from D:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/theme-check-1.15.0/lib/theme_check/language_server/server.rb:80:in `block (2 levels) in start_json_rpc_thread'
from D:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/theme-check-1.15.0/lib/theme_check/language_server/server.rb:77:in `loop'
from D:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/theme-check-1.15.0/lib/theme_check/language_server/server.rb:77:in `block in start_json_rpc_thread'
[Error - 10:52:15 PM] Server initialization failed.
Message: A theme-check-language-server has occured, inspect OUTPUT logs for details.
Code: -32603
[Error - 10:52:15 PM] Theme Check Language Server client: couldn't create connection to server.
If I rename my .\theme-check.yml
, the server and extension start working again. I guess there's more work to do that just adding a missing file 🤷♂️
That's because CdnPreconnect isn't released in the ruby version yet. It was added after 1.15. You can remove it from your .theme-check.yml file for the time being or use the "shopifyLiquid.themeCheckNextDevPreview": true
VS Code extension setting to use the next version of theme-check that does include it.
(sorry in advance for the long explanation, want to be thorough...)
I use VSCode on Windows to build and debug Shopify themes. I have installed the Shopify Liquid VSCode extension, which requires Shopify CLI and Theme CLI. I installed all prerequisites (NodeJS, Ruby, etc...) and everything appeared to be working well. I then downloaded the config file default.yml, and placed it my theme directory. As soon as the config was read, the Theme Language Server would crash and the extension would stop working. Running
shopify theme check --verbose
revealed the following Ruby error:This
CdnPreconnect
option is included in default.yml, and upon removing it (comment or delete), the Theme Language Server starting working again, as did the extension. Upon researching the problem, from cdnpreconnect.md, it makes reference to cdnpreconnect.rb. I checked my localtheme-check 1.15
gem installation and cdnpronnect.rb is missing. I redownloaded thetheme-check 1.15
gem from rubygems.org, unpacked the gem, andcdnpreconnect.rb
is still missing.Please update the theme-check gem to ensure
cdnreconnect.rb
is included (as well as any other missing rubies/files). I have since downloaded cdnreconnect.rb from this repo and placed in my gem library.