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

🐛 Unable to use Biome format outside of a workspace with a biome.json file #387

Open
1 of 3 tasks
baptisteArno opened this issue Oct 8, 2024 · 6 comments
Open
1 of 3 tasks

Comments

@baptisteArno
Copy link

VS Code version

1.95.0

Extension version

2024.10.40751

Biome version

Can't find it

Operating system

  • Windows
  • macOS
  • Linux

Description

Whenever I try to format a standalone file (tried with json and js), it says

Extension 'Biome' is configured as formatter but it cannot format 'JavaScript'-files

Here are my user settings:

"editor.formatOnSave": true,
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "[javascript]": {
    "editor.defaultFormatter": "biomejs.biome"
  },
  "[javascriptreact]": {
    "editor.defaultFormatter": "biomejs.biome"
  },
  "[typescript]": {
    "editor.defaultFormatter": "biomejs.biome"
  },
  "[typescriptreact]": {
    "editor.defaultFormatter": "biomejs.biome"
  },
  "[json]": {
    "editor.defaultFormatter": "biomejs.biome"
  },
  "[css]": {
    "editor.defaultFormatter": "biomejs.biome"
  }

Steps to reproduce

I guess just open a standalone file that is not part of a project that has biome installed

Expected behavior

To format docs

Does this issue occur when using the CLI directly?

No

Link to a minimal reproduction

No response

Logs

No response

@baptisteArno baptisteArno changed the title 🐛 I am unable to use Biome format outside of a workspace with a biome.json file 🐛 Unable to use Biome format outside of a workspace with a biome.json file Oct 8, 2024
@ematipico ematipico added the Needs reproduction Needs a reproduction label Oct 8, 2024
@ematipico
Copy link
Member

Please provide a minimal reproduction @baptisteArno

@baptisteArno
Copy link
Author

CleanShot.2024-10-08.at.11.58.04.mp4

@ematipico
Copy link
Member

Sorry @baptisteArno, but this isn't a reproduction. We need a reproduction so we can reproduce the issue and debug it.

To create a reproduction, you can use our new CLI tool, which should help you to create a very quick repository with what you need: npm create @biomejs/biome-reproduction

@ematipico
Copy link
Member

As you can notice from the video, the extension didn't enable Biome because the event enables and spawns the Biome server wasn't triggered. When Biome is enabled, you should see Biome in the bottom left. This is expected (maybe things have changed in the preview release).

@baptisteArno
Copy link
Author

Correct me if I am wrong but I don't think I can create a code reproduction for that particular issue since it is not tied to a specific workspace / biome setting. To reproduce it, we even need the biome.json file not to be there. It just needs plain VSCode Insiders + Biome pre-release to reproduce it.

Sometimes, a reproduction is just a step-by-step instructions

  1. In VSCode Insiders, install Biome extension
  2. Create new file with the following content console.log("Hello world")
  3. Biome is not enabled even though the file was autodetected as Javscript and even if we specific the Javascript file type, Biome does not launch

@ematipico
Copy link
Member

Thank you. The step-by-step instructions are also a valid reproduction. This information should have been present in the initial description.

@ematipico ematipico removed the Needs reproduction Needs a reproduction label Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants