Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

1488 #694

Open
GooseOb opened this issue Mar 16, 2024 · 13 comments
Open

1488 #694

GooseOb opened this issue Mar 16, 2024 · 13 comments
Labels
bug Something isn't working

Comments

@GooseOb
Copy link

GooseOb commented Mar 16, 2024

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

@fsouza
Copy link
Owner

fsouza commented Mar 18, 2024

Can you reproduce when running prettierd on the command line?

@GooseOb
Copy link
Author

GooseOb commented Mar 19, 2024

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 ).

@fsouza fsouza added the bug Something isn't working label Mar 19, 2024
@fsouza
Copy link
Owner

fsouza commented Mar 19, 2024

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

@GooseOb
Copy link
Author

GooseOb commented Mar 20, 2024

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

@GooseOb
Copy link
Author

GooseOb commented Mar 20, 2024

$ 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

@jakubreron
Copy link

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

fsouza added a commit that referenced this issue Apr 11, 2024
It's not _really_ a new dependency as prettier already depends on it,
but let's bring it in.

I suspect that users are running into weird encoding issues in #694 (and
maybe #698).

Rather than spending too much time on this, I'm just taking a shortcut:
users confirm that they cannot reproduce the issue in `prettier`, so
let's read stdin the same `prettier` does :)
fsouza added a commit that referenced this issue Apr 11, 2024
It's not _really_ a new dependency as prettier already depends on it,
but let's bring it in.

I suspect that users are running into weird encoding issues in #694 (and
maybe #698).

Rather than spending too much time on this, I'm just taking a shortcut:
users confirm that they cannot reproduce the issue in `prettier`, so
let's read stdin the same `prettier` does :)
fsouza added a commit that referenced this issue Apr 12, 2024
It's not _really_ a new dependency as prettier already depends on it,
but let's bring it in.

I suspect that users are running into weird encoding issues in #694 (and
maybe #698).

Rather than spending too much time on this, I'm just taking a shortcut:
users confirm that they cannot reproduce the issue in `prettier`, so
let's read stdin the same `prettier` does :)
@fsouza
Copy link
Owner

fsouza commented Apr 12, 2024

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

@jakubreron
Copy link

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

Prettier version in mason:
image

Diff after running prettierd formatting
image

@fsouza
Copy link
Owner

fsouza commented Apr 12, 2024

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

@GooseOb
Copy link
Author

GooseOb commented May 11, 2024

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
Copy link
Author

GooseOb commented May 11, 2024

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

@GooseOb GooseOb closed this as completed May 11, 2024
@GooseOb
Copy link
Author

GooseOb commented May 13, 2024

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

@exzolink
Copy link

Any fix?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants