Closed melMass closed 1 week ago
I can't reproduce the issue on the playground, but this is what happens in neovim:
I think it was fixed in #693 but I can't find why it happens
webstorm has same problem
@melMass are you using ALE to format or something else? I'm using ALE and see this as well, but it doesn't happen when formatting from the CLI
looks like it might have something to do with the way neovim is exporting to stdout:
before:
console.log("⚠️ ")
highlight the line with V
, then:
:'<,'>!bunx biome format --stdin-file-path=asdf.ts
after:
console.log("! ");
but if I copy and paste that directly into the console it seems fine:
❯ echo 'console.log("⚠<fe0f> ")' | bunx biome check --apply --stdin-file-path=asdf.ts
console.log("⚠️ ");
I'm not entirely sure where the <fe0f>
is coming from, but when I paste into zsh/iterm2 that shows up.
ok it might still have something to do with biome not quite understanding what encoding stdin is in or something...
:'<,'>!cat
leaves it untouched, and:
:'<,'>!cat > temp.ts && bunx biome check --apply temp.ts && cat temp.ts
gives me:
Checked 1 file in 2ms. Fixed 1 file.
console.log("⚠️ ");
Hmm I'm also finding this pretty confusing. Without --apply
it seems to print an error but the exit code is still 0
. With --apply
the output looks identical.
When putting them through diff
or piping through stdin they do look different though, so I guess it's not actually a neovim issue
OK I think I figured it out. I believe biome is trying to strip ansi characters when it detects that the output is not interactive (e.g. to a pipe or a file). In this case its instead converting the emoji into a plain string. As a workaround, if you use --colors=force
then it will keep the emoji.
A slightly different bug seems to be in the check mode where it prints the output first, then a message saying it would have printed the following content. So it's backwards and it's also reporting an error when there actually shouldn't be one.
I know we have the issue, but I am unable to replicate it, maybe because I have a shell that supports Ansi? I wished there was a consistent way - at least for me - to get an invalid output.
BTW, if anyone wants to help, we use the termcolor
crate to setup the stdout stream. Maybe someone can suggest a better option, among of these variants: https://docs.rs/termcolor/1.4.1/termcolor/enum.ColorChoice.html#variants
Sorry I can't track exactly when/how but it's now working properly!
Just to note that it wasn't happening for all emojis but only some.
I'm going to close the issue
Edit: I just saw all redmk messages, I guess it still needs a proper conclusion, feel free to close it
Environment information
Configuration
Playground link
https://biomejs.dev/playground/?code=CgBlAHgAcABvAHIAdAAgAGMAbwBuAHMAdAAgAGkAbgBmAG8ATABvAGcAZwBlAHIAIAA9ACAAYwByAGUAYQB0AGUATABvAGcAZwBlAHIAKAAnADkhD%2F4nACwAIAAnAHkAZQBsAGwAbwB3ACcAKQAKAGUAeABwAG8AcgB0ACAAYwBvAG4AcwB0ACAAdwBhAHIAbgBMAG8AZwBnAGUAcgAgAD0AIABjAHIAZQBhAHQAZQBMAG8AZwBnAGUAcgAoACcAoCYP%2FicALAAgACcAbwByAGEAbgBnAGUAJwAsACAAJwB3AGEAcgBuACcAKQAKAGUAeABwAG8AcgB0ACAAYwBvAG4AcwB0ACAAZQByAHIAbwByAEwAbwBnAGcAZQByACAAPQAgAGMAcgBlAGEAdABlAEwAbwBnAGcAZQByACgAJwA92CXdJwAsACAAJwByAGUAZAAnACwAIAAnAGUAcgByAG8AcgAnACkACgBlAHgAcABvAHIAdAAgAGMAbwBuAHMAdAAgAHMAdQBjAGMAZQBzAHMATABvAGcAZwBlAHIAIAA9ACAAYwByAGUAYQB0AGUATABvAGcAZwBlAHIAKAAnAAUnJwAsACAAJwBnAHIAZQBlAG4AJwApAAoACgA%3D
Code of Conduct