Shopify/theme-check-vscode

Windows support

charlespwd opened this issue ยท 21 comments

Would need upstream support from Shopify/theme-check first. Not too sure what the implications are. Bat file? No idea.

When the gem file is installed for theme you can locate it using the windows command which.exe which is a rough approximation for which on UNIX based systems, I'll do a fork to get this implemented.

Example;
image

Important is how the response returns all known paths, even if multiple exist. Ideally I believe the .bat is preferred where possible.

Hi @YourWishes, I'm a Windows user and was wondering what the status is of the PR? When I install Theme Check in VSC I get this notification: "The 'shopify' executable was not found on your $PATH. Was it installed? The path can also be changed via the "shopifyLiquid.shopifyCLIPath" setting."

Until Theme Check supports Windows, is there any way for me to manually add the $PATH in the extension settings, and do you know what the paths are for Shopify CLI and the Language Server?

Thanks!

I'm picking this up this week. Coming soon :)

Some notes:

I've found that ruby on Windows is 3x slower than on Linux ๐Ÿ˜ข. The two above PRs assumes that you installed theme-check on Windows (cmd or powershell). This means that, as a Windows user, because ruby is slower on Windows, checks will come in 3x as much time.

I've experienced 5s on Windows Subsystem for Linux (Ubuntu) and 15s on cmd.exe on a 2019 macbook pro running Windows via bootcamp.

There might be a way to go around this by using Windows Subsystem For Linux, but I'm no Windows wiz so I'm not too sure how we'd set that up in the VS Code extension. Plus, I fear that would make the installation steps a tad complicated.

Might be OK if we dump that info in a TROUBLESHOOTING file or something.

Would gladly accept help on this, in the meantime it will work. If that's fast enough for you, good :) The Language Server (completions and stuff) shouldn't feel too slow, but it's the checking that I'm slightly worried about.

This is fixed in the latest version of theme-check (1.2.0) and theme-check-vscode (v1.1.0).

This version should make it into a new version of shopify CLI next week.

If you can't wait, try this:

  1. In your settings.json configuration file, set the "shopifyLiquid.languageServerPath" to the output of where.exe theme-check-language-server.bat (note you should escape the backslashes).

    This should look like:

    {
      // ...
      "shopifyLiquid.languageServerPath": "C:\\Ruby-XXXX\\...\\theme-check-language-server.bat"
    }

I'll leave this open until we bump the theme-check version in the Shopify CLI. and deploy a new Shopify CLI version.

The latest version of theme-check (v1.5.0) should get a Windows user up and running.

gem install theme-check

Please report any issues!

Outstanding issues:

There's a bug in shopify theme language-server that makes it behave differently than theme-check-language-server. Until this is fixed, I have temporarily removed support for the Shopify CLI installation.

1. gem install theme-check
2. gem install theme-check

It works very well now. @charlespwd thank you ๐Ÿ˜„

The latest version of theme-check (v1.5.0) should get a Windows user up and running.

gem install theme-check

Please report any issues!

Outstanding issues:

There's a bug in shopify theme language-server that makes it behave differently than theme-check-language-server. Until this is fixed, I have temporarily removed support for the Shopify CLI installation.

For anyone coming here because of the visual studio error The Theme Check Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted.

I got the above issue because I was using theme-check v1.2.0. Upgrading to v1.5.0 removed the issue.

ADTC commented

Could I have a settings option to suppress the warning? ๐Ÿ˜†

image

There's a bug in shopify theme language-server that makes it behave differently than theme-check-language-server. Until this is fixed, I have temporarily removed support for the Shopify CLI installation.

Has this issue been fixed?

There's a bug in shopify theme language-server that makes it behave differently than theme-check-language-server. Until this is fixed, I have temporarily removed support for the Shopify CLI installation.

@charlespwd Any news about this issue? Has it been fixed? It's been holding me back from switching over to using shopify-cli instead of themekit on Windows, for quite some time now.
I took notice of your work regarding syntax highlighting in #61 which looks really good. So I'd very much like to try these improvements in version 1.3.0 under Windows.
Many thanks!

I just want to mention the plugin works perfectly for me using WSL2/Ubuntu on Windows 11.

My theme files/workspace/theme-check/stylelint/etc are all on WSL, I'm just more comfortable in a Linux shell (and Windows Terminal is quite nice to use).

The info on this page helped me understand switching VS Code to run on WSL - https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-wsl
The link from higher up this thread explains reinstalling the extensions when VS Code is on WSL - https://code.visualstudio.com/docs/remote/wsl#_managing-extensions
That's all the setup it needed.

ADTC commented

I just want to mention the plugin works perfectly for me using WSL2/Ubuntu on Windows 11.

My theme files/workspace/theme-check/stylelint/etc are all on WSL

Technically you're on Linux (not Windows) when you use WSL (WSL2 to be specific). So I don't think it would qualify as "it works on Windows". More of: "It works on virtualized Linux running on a Windows host."

I just would like add my situation here :
I've switched to windows 8.1 and I've installed the default Shopify extension for vscode the one that says it needs theme-check.. it did not work for me .. so I disabled it and installed this
https://marketplace.visualstudio.com/items?itemName=killalau.vscode-liquid-snippets
it works just fine for auto completion ,you will also need to install Liquid Languages Support extension

On Windows 10:

  1. Installed Plugin on VS Code
  2. Installed Ruby+Devkit (MSYS2 base install)
  3. Ran gem install theme-check
  4. Used where.exe theme-check-language-server to get path to .bat
  5. In VS Code settings.json, set "shopifyLiquid.languageServerPath" to path from step 4
  6. Restart VS Code
  7. Profit
gyotov commented

On Windows 10:

  1. Installed Plugin on VS Code
  2. Installed Ruby+Devkit (MSYS2 base install)
  3. Ran gem install theme-check
  4. Used where.exe theme-check-language-server to get path to .bat
  5. In VS Code settings.json, set "shopifyLiquid.languageServerPath" to path from step 4
  6. Restart VS Code
  7. Profit

Works like a charm! Thanks @Carson-JG

5. "shopifyLiquid.languageServerPath"

"shopifyLiquid.languageServerPath": "C:\Users\raihan\AppData\Local\Microsoft\WindowsApps\theme-check-language-server.bat",
do I need to apply like this?

Just wait a week, it'll be baked in the VS Code extension without an out-of-band installation step. It will also get automatically updated from then on.

@charlespwd please see my latest issue, I believe it's connected with this thread:
Shopify/theme-tools#276