Skip to content

Auto-import completions for project-local symbols produce no import edit #58

Description

@KazariEX

When a project-local auto-import candidate returned by tsgo completion is accepted, the completionEntryDetails request fails and no import edit is produced.

Reproduction

package.json

{
  "private": true,
  "devDependencies": {
    "typescript": "npm:typescript-native-bridge@6.0.3-bridge.12.tsgo.7.0.2"
  }
}

tsconfig.json

{
  "include": ["./src/*.ts"]
}

src/model.ts

export const ReadRecordModel = {};

src/main.ts

ReadRecordModel;
  1. Run pnpm install.
  2. Open the project in VS Code and select the workspace TypeScript version.
  3. Trigger completion on ReadRecordModel in src/main.ts.
  4. Accept the auto-import candidate from ./model.

Expected

The import is inserted:

import { ReadRecordModel } from "./model";

ReadRecordModel;

Actual

The completion list includes ReadRecordModel with hasAction: true, but accepting it does not insert an import.

The corresponding completionEntryDetails request fails with:

Debug Failure. Some exportInfo should match the specified symbol / moduleSymbol

The completion data returned by the tsgo path does not contain the exportMapKey used by stock TypeScript:

{
  "exportName": "ReadRecordModel",
  "fileName": "<project>/src/model.ts",
  "moduleSpecifier": "./model"
}

During completion details resolution, the same exported declaration is represented by a host-binder Symbol and a tsgo registry Symbol. Their declaration locations match, but their object identities do not, so the strict export-info Symbol match fails.

Stock TypeScript 6.0.3 returns an entry containing exportMapKey and produces the expected import edit.

The issue reproduces with typescript-native-bridge bridge.7 through bridge.12.


This issue was created with assistance from a code agent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions