Skip to content

💡 Add support for multi-root workspaces in VSCode #1566

@agusterodin

Description

@agusterodin

Suggest an idea for Knip

I am unable to get Knip to work properly for my monorepo in a multi-root workspace. Variables in the "common" package are being reported as unused (underlined in IDE extension) despite being used by product2.

This is what my multi-root workspace looks like:

{
  "folders": [
    {
      "name": "ui",
      "path": "../ui/product1"
    },
    {
      "name": "common",
      "path": "../ui/common"
    },
    {
      "name": "server",
      "path": "../backend/server"
    },
    {
      "name": "processor",
      "path": "../backend/processor"
    },
    {
      "name": "backend-library",
      "path": "../backend-library"
    },
    {
      "name": "db-schemas",
      "path": "../db-schemas"
    },
    {
      "path": "../ui"
    }
  ],
}

This is the structure of my workspace (pnpm-workspace.yaml file)

packages:
  - 'common'
  - 'product2'
  - 'product1'

The ui directory contains the monorepo that Knip is being used on. Every other directory (eg: db-schemas) is non-TypeScript backend stuff.

Unused import direction in common UI library works correctly in the IDE extension when opening my monorepo in a VSCode single root workspace.

I am not using any configuration file (eg: knip.json). This is purely the automatic configuration. I tried messing around with configuration files but couldn't come up with anything useful.


Not sure if this is relevant or even necessary but TailwindCSS's Intellisense extension has support for workspace setting "object notation" where you can specify relative configuration paths for all/some of the roots in your multi-root workspace.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions