biomejs/biome-vscode

VS Code Dev Container error: Extension can't find Biome if node_moduels isn't in the root of the workspace

Closed this issue · 2 comments

My workspace has a directory structure like this:

project/
├── javascript/
│   ├── node_modules/
│   └── package.json
└── python/

@biomejs/biome is in the devDependencies in the package.json and it is installed on the file system. i can use the module when running something like pnpm exec biome format .. However, when I launch a Visual Studio Code Development Container, I get the following error and auto format on save does not work.

Screenshot 2024-02-02 at 10 01 44 AM

This problem does not happen with other Visual Studio extensions like Prettier and ESLint.

Is there anything I can do on my side or do I need to wait for the improved detection mentioned in #74?

Also want to note that the Biome VS Code extension does get installed and enabled when the container builds and boots up. Here's the devcontainer.json:

{
  "name": "boilerplate",
  "service": "boilerplate",
  "dockerComposeFile": "compose.yml",
  "workspaceFolder": "/workspace",
  "forwardPorts": [5173],
  "postStartCommand": "cd ./javascript && pnpm install",
  "customizations": {
    "vscode": {
      "extensions": [
        "esbenp.prettier-vscode",
        "dbaeumer.vscode-eslint",
        "ms-azuretools.vscode-docker",
        "biomejs.biome"
      ],
      "settings": {
        "terminal.integrated.defaultProfile.linux": "zsh",
        "editor.defaultFormatter": "esbenp.prettier-vscode",
        "editor.formatOnSave": true,
        "[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"
        },
        "[jsonc]": {
          "editor.defaultFormatter": "biomejs.biome"
        }
      }
    }
  }
}

Hey @kylerush,

Thanks for opening this issue.

This is a known limitation.

At present, the extension only looks for Biome in the node_modules folder at the root of your workspace. We might do something about it in the future, but it's going to require some more thinking.

Unfortunately, the improved detection discussed in #74 does not include a fix for this.