Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

🐛 Cannot format TypeScript in VS Code #5

Closed
1 task done
victorz opened this issue Nov 6, 2023 · 6 comments
Closed
1 task done

🐛 Cannot format TypeScript in VS Code #5

victorz opened this issue Nov 6, 2023 · 6 comments

Comments

@victorz
Copy link

victorz commented Nov 6, 2023

Environment information

I don't have a "biome" binary installed. I just installed the VS Code extension.

What happened?

I installed the VS Code extension and followed the instructions in its README to configure the default formatter for TypeScript files. I'm used to this procedure so I know how to do so.

Also tried running the command "Format Document" with Biome as the default formatter for TypeScript, and I'm met with this dialog:

image

Same with JavaScript files:

image

Prettier works fine... 🤷

Expected result

I expect it to be able to format TypeScript, since that's what it says in the README.

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@ematipico
Copy link
Member

Do you have a biome.json file? If not you need to change this setting https://biomejs.dev/reference/vscode/#biomerequireconfiguration

@victorz
Copy link
Author

victorz commented Nov 8, 2023

Ah okay, gotcha, thank you! You either need a biome.json file, or set biome.requireConfiguration to false in your editor settings. I believe this can be closed in that case. Just a case of having to dig (deep) through documentation to get it to work.

On that -- I really wish it would just start doing its thing after installing and enabling, rather than requiring a config file. That's the extreme allure of Prettier e.g., that it works with basically zero config. This is a very similar tool, right? Maybe there is a good rationale for not working unless there's a config file?

At least the getting-started docs shouldn't say "we recommend creating a config file". It should probably say very clearly close to the top of the README of the VS Code extension, that it's required by default, at the very least. You have to scroll almost to the bottom of the README to find biome.requireConfiguration and interpret that to mean that you need a biome.json file.

And the extension itself should probably raise some kind of notification that it cannot find a biome.json file while the editor setting is set to require it.

My two cents. 🙂 Thanks for your help!

@ematipico
Copy link
Member

ematipico commented Nov 9, 2023

We have had users with different needs and preferences, and it's very difficult to find the right balance and explain that to the users.

Before the extension worked as you expected, and the option was turned off by default. Then users started adding a configuration file, and the extension didn't wasn't in sync with the CLI. We've had users reporting issues.

We can definitely review the README and make the information more visible. Thank you!

@victorz
Copy link
Author

victorz commented Nov 9, 2023

I understand. I had a feeling something like this didn't come out of nowhere. ☺️

But yeah, a review of the README would be super helpful, I believe. I feel like the expected experience when installing VS Code extensions is that they are installed, enabled, and ready-to-go in one click (when pressing the install button and the installation finishes). Prettier fulfills this, as many others do. I'm pretty excited about this project so I'd be happy to find ways to make this an attractive experience as well, as much as possible anyway.

Thanks for taking the time to discuss and help!

By the way, feel free to convert this issue into a "review README" issue by altering the title or whatever you want. Be my guest!

@ematipico ematipico transferred this issue from biomejs/biome Nov 9, 2023
@ematipico
Copy link
Member

We should improve the README and highlight at the beginning how Biome is supposed to work.

@ematipico ematipico transferred this issue from biomejs/setup-biome Nov 9, 2023
@nhedger
Copy link
Member

nhedger commented Nov 19, 2023

The README has been updated to state better that a biome.json file is required for the extension to start.

I'll close this issue for now, but feel free to open another issue or PR if you think something is still unclear.

@nhedger nhedger closed this as completed Nov 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants