Skip to content

How to trace/debug auto import suggestions? #62829

@jedwards1211

Description

@jedwards1211

Acknowledgement

  • I acknowledge that issues using this template may be closed without further explanation at the maintainer's discretion.

Comment

I'm authoring a package with

  "type": "module",
  "exports": {
    "./package.json": "./package.json",
    "./*": {
      "types": {
        "import": "./dist/*.d.ts",
        "default": "./dist/*.d.cts"
      },
      "import": "./dist/*.js",
      "default": "./dist/*.cjs"
    }
  },

When I install it in a new project I can't get tsserver to auto suggest any imports from these files (until I've manually added an import from a given file), regardless of module and moduleResolution settings.

How do I turn on debug logging that will help me figure out why tsserver isn't offering any auto import suggestions from my package?

I tried turning on "typescript.tsserver.log": "verbose" and looking at those logs but I don't see anything that sheds light on how tsserver is making decisions.

Is there any logging option for this? I've used traceResolution to debug module resolution issues that cause compile errors and it was super helpful, but import suggestions still seem like a black box.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs More InfoThe issue still hasn't been fully clarified

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions