dprint / dprint-vscode

Visual Studio Code extension for formatting code with dprint.
MIT License
59 stars 12 forks source link

Local Dprint in JS project doens't work #97

Open douglasg14b opened 1 week ago

douglasg14b commented 1 week ago

Version: 0.47.2


Dprint no longer appears to work in my project in VSCode, I do not want to globally install it, and expect it work work as part of the project itself (And expect it to work for anyone else that pulls the project). This does not seem to be the case :/

It's installed in the repo, but the extension does not pick it up. Similarly there is a dprint.json at the root of the repo.

[ERROR] Problem launching dprint. '"dprint"' is not recognized as an internal or external command, operable program or batch file.

[ERROR] Error initializing dprint. Ensure it is globally installed on the path (see https://dprint.dev/install) or specify a "dprint.path" setting to the executable. [INFO] Configuration file not found. [INFO] Extension active!

dsherret commented 1 week ago

What version of the extension are you using? What operating system/architecture do you have? Does your node_modules folder have a dprint executable in it? What happens if you run npx dprint -v? After running that if you restart the extension does it work?

douglasg14b commented 1 week ago
  1. Extenstion: v0.16.3
  2. node_modules: image image
  3. npx dprint -v: dprint 0.47.2
  4. After running npx dprint behavior continues after an editor restart
dsherret commented 1 week ago

Does it work with version 0.16.2? Do you think https://github.com/dprint/dprint-vscode/pull/92 broke it? Specifically https://github.com/dprint/dprint-vscode/pull/92/files#diff-cadc1bd035f997fef1cdf057f2016ed0cfeb8b602903fceacca2e3d2363b8c67R20

Are you on aarch64 windows or x86-64?

douglasg14b commented 1 week ago

If I downgrade to 0.16.2 the problem is resolved yep.

I'm on Windows, x86 architecture.

I agree with the reasoning for the change, however I assume there is a bug in copying or validating that it was copied. Probably needs some method for validating that the copying operation occurred 🤔

At first glance the code to copy seems pretty standard, perhaps the existing check is hitting an edge case?