Skip to content

Intellisense fails to detect package.json import paths #61504

Closed as not planned
Closed as not planned

Description

🔎 Search Terms

  • path completion
  • node.js import path intellisense

🕗 Version & Regression Information

  • Tested on TS 5.7.3 with VSC 1.98.0 and 5.8.2 with VSC 1.98.2

⏯ Playground Link

https://github.com/anthonyma94/path-completion-repro

💻 Code

package.json

  "imports": {
    "#foo/*": {
      "types": [
        "./src/foo/*.ts",
        "./src/foo/*"
      ],
      "default": [
        "./src/foo/*"
      ]
    }
  },

src/foo/test.ts

export const testFunc = () => {}

src/index.ts

import { testFunc } from "#foo/test";

testFunc();

🙁 Actual behavior

Repro for #52460.

Path completion intellisense kicks in for symbol resolution:

Image

But not path resolution:

Image

🙂 Expected behavior

I expect Intellisense to work for both scenarios.

Additional information about the issue

No response

Activity

  1. added
    Possible Improvement
    on Mar 31, 2025
  2. mkvlrn commented on Apr 3, 2025

    @mkvlrn

    I've reached a scenario that is working for me but I really don't think it is supposed to be done this way, because I ended up not needing file extensions for imported modules while not in bundler moduleResolution:

    /** package.json */
    
    {
    // ...
      "type": "module",
      "imports": {
        "#*": {
          // just worked like this, didn't need a "proper" recursive glob like "./src/**/*.ts"
          "dev": "./src/*.ts",
          // same here
          "default": "./build/*.js"
        }
      },
    // ...
    }
    /** tsconfig.json */
    
    {
    // ...
      "customConditions": ["dev"], // this was key
      "esModuleInterop": true,
      "isolatedModules": true,
      "lib": ["ESNext"],
      "module": "NodeNext",
      "moduleResolution": "nodenext",
      "target": "esnext",
    // ...
    }
    /** src/lib/basic-math.ts */
    
    export function add(a: number, b: number): number {
      return a + b;
    }
    /** src/main.ts */
    
    import { add } from "#lib/basic-math";
    
    console.log(`2 + 2 = ${add(2, 2)}`);

    In main.ts I get intellisense if I manually add the "base" #lib/, but it does not suggest adding the base path itself.
    Image

    Running code works fine:

    • without the build step, using dev conditions to import the ts files, using node to strip types (node -C dev src/main.ts)
    • after the build step, without changing import conditions (node build/main.js)

    My environment:

    • node 23.11
    • typescript 5.8.2
    • vscode 1.98.2
  3. added
    Domain: LS: Completion Lists
    on Oct 15, 2025
  4. locked as resolved and limited conversation to collaborators on Dec 3, 2025
  5. RyanCavanaugh commented on Dec 3, 2025

    @RyanCavanaugh
    Member

    Closing language service bugs related to the 6.0 implementation. For more information, see #62827

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    7.0 LS MigrationDomain: LS: Completion ListsPossible Improvement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions