prettier-emacs icon indicating copy to clipboard operation
prettier-emacs copied to clipboard

fix #77: prettier-js cleanse the code

Open t1anchen opened this issue 1 year ago • 2 comments

Problem

See the issue #77

Brief Analysis

After debugging the procedure, it is found that the call-process calls prettier with arguments with outputting to temporary files before doing patching. Original implementation is to input code content to prettier via standard input, however somehow it does not work under win11/powershell. When putting the code file as argument, the reformat is working (e.g. prettier xxx.js).

Test Coverage

Only tested on Win11. Environment can be found in issue #77 as well.

t1anchen avatar May 15 '24 10:05 t1anchen

Hi @t1anchen, thanks for your contribution!

I'm a little confused. Are you saying you're having a problem when running Emacs in a console session inside Windows PowerShell?

When you said, "prettier-js cleanses the code file," did you mean, "all the code in your file gets deleted?" I'm not sure what you meant by "cleanse."

jacksonrayhamilton avatar Jul 02 '25 18:07 jacksonrayhamilton

I tried out the change you suggested on macOS and it doesn't seem to cause a regression. Just wondering how to reproduce, as our tests are currently passing on Windows.

I believe the Windows on GitHub Actions is using PowerShell Core (pwsh) by default. I'm finding that there's an older version of PowerShell, "PowerShell Desktop" (powershell); maybe that's where this issue occurs?

jacksonrayhamilton avatar Jul 02 '25 18:07 jacksonrayhamilton