StyLua icon indicating copy to clipboard operation
StyLua copied to clipboard

VSCode extension -- Can't install version 2.1 and trying to do so breaks 1.7

Open colevalleygirl opened this issue 6 months ago • 4 comments

Using VS Code (or Cursor):

I get notification that StyLua 2.1.0 is available. When it I ask it to update, it claims briefly to be downloading.

If I then try to format, I get:

[error] Error: spawn c:\Users\XXXX\AppData\Roaming\Code\User\globalStorage\johnnymorganz.stylua\stylua.exe ENOENT at Process.ChildProcess._handle.onexit (node:internal/child_process:285:19) at onErrorNT (node:internal/child_process:483:16) at processTicksAndRejections (node:internal/process/task_queues:90:21)

and an empty file (recoverable with undo -- phew).

c:\Users\XXXXX\AppData\Roaming\Code\User\globalStorage\johnnymorganz.stylua is empty.

Disabling, uninstalling, deleting the johnnymorganz.stylua folder and reinstalling the extension (to get back to 1.7.1, as 2.1.0 isn't available in the Marketplace) doesn't fix it. C:\Users\XXXXX\AppData\Roaming\Cursor\User\globalStorage\johnnymorganz.stylua is still empty.

Windows 11 on ARM.

colevalleygirl avatar Jul 04 '25 12:07 colevalleygirl

This sounds like an issue where downloading the binary failed. I think it could be solved by running the StyLua: Reinstall StyLua command in VSCode.

However, we should handle this gracefully at least, and definitely don't attempt to format the file and cause it to become empty

JohnnyMorganz avatar Aug 10 '25 12:08 JohnnyMorganz

I'm not convinced the StyLua: Reinstall StyLua command will help if the right version isn't available in the marketplace? It's still only reporting 1.7.1 as avaible.

colevalleygirl avatar Aug 10 '25 14:08 colevalleygirl

The extension version is independent of StyLua version - it remains consistent even as stylua has new releases. The extension itself has some logic to find and download the latest stylua release from GitHub

JohnnyMorganz avatar Aug 10 '25 16:08 JohnnyMorganz

OK.

I've installed the binary manually as a workaround

colevalleygirl avatar Aug 10 '25 16:08 colevalleygirl