prettierd icon indicating copy to clipboard operation
prettierd copied to clipboard

1488

Open GooseOb opened this issue 1 year ago • 13 comments

Worked fine until the moment when it started to produce in random places. On every save it adds �� to the same place (start of the 1488 line).

Using lazy.nvim with null-ls. Plugin is installed via Mason. FIle encoding is utf-8. Using cyrillic characters. Working on WSL2 Ubuntu. Isn't reproducing with prettier.

image

image

GooseOb avatar Mar 16 '24 23:03 GooseOb

Can you reproduce when running prettierd on the command line?

fsouza avatar Mar 18 '24 04:03 fsouza

Yes cat src/dict/index.ts | prettierd src/dict/index.ts: image

I forgot to mention, this file is in .prettierignore. But excluding it from there does not help (formats, but produces ).

GooseOb avatar Mar 19 '24 12:03 GooseOb

can you run prettierd --debug-info src/dict/index.ts?

Also is that code open source? If so, can you link it? If not, can you share a snippet of it with the cyrillic characters? I'll try to repro

fsouza avatar Mar 19 '24 15:03 fsouza

Yes, it's open source, here's the repo

GooseOb avatar Mar 20 '24 10:03 GooseOb

$ prettierd --debug-info src/dict/index.ts

prettierd 0.25.2
prettier version: 3.1.1
  Loaded from: /home/gooseob/projects/taraskevizer/node_modules/prettier/index.cjs

GooseOb avatar Mar 20 '24 16:03 GooseOb

It's the same situation for Japanese characters, can reproduce with prettierd, but cannot reproduce with prettier

jakubreron avatar Apr 01 '24 10:04 jakubreron

Thanks for the added details. Can you try the latest release?

fsouza avatar Apr 12 '24 02:04 fsouza

Unfortunately, after upgrading to 0.25.3 the issue still exists for me :(

Prettier version in mason: image

Diff after running prettierd formatting image

jakubreron avatar Apr 12 '24 05:04 jakubreron

Thanks for confirming! I'll keep digging into it.

fsouza avatar Apr 12 '24 19:04 fsouza

The bug seems similar to GooseOb/taraskevizer#5. So there might be a problem with node. I tried with bun and it works fine, so I opened nodejs/node#52944

GooseOb avatar May 11 '24 15:05 GooseOb

Oh, I see you changed the implementation of get-stdin and I do not see the bug now. Seems like it helped

GooseOb avatar May 11 '24 17:05 GooseOb

No, it didn't, I still get this characters :)

GooseOb avatar May 13 '24 22:05 GooseOb

Any fix?

exzolink avatar Aug 21 '24 23:08 exzolink

The fix is in these 2 PRs: https://github.com/mantoni/core_d.js/pull/32 and https://github.com/fsouza/prettierd/pull/917. As it's hard to know when both will be merged and released I've published fixed versions in npm as @powerman-asdf/core_d and @powerman-asdf/prettierd.

powerman avatar Aug 02 '25 18:08 powerman