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

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

Closed
kylerush opened this issue Feb 2, 2024 · 2 comments

Comments

@kylerush
Copy link

kylerush commented Feb 2, 2024

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?

@kylerush
Copy link
Author

kylerush commented Feb 2, 2024

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"
        }
      }
    }
  }
}

@nhedger
Copy link
Member

nhedger commented Feb 2, 2024

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.

@nhedger nhedger closed this as completed Feb 2, 2024
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

2 participants