microsoft / microsoft/TypeScript

Auto-import completions are not shown inside named imports with TypeScript 7 / tsgo

Open
#64,270 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

### 🔎 Search Terms

TypeScript 7, tsgo, TypeScript Native Language Server, named import completions, import completions, auto import, autoImports, includeCompletionsForImportStatements, import autocomplete, VS Code

### 🕗 Version & Regression Information

- This changed between TypeScript 6 and TypeScript 7.
- TypeScript 6: named import completions work as expected.
- TypeScript 7.0.2: named import completions are not provided when using the native TypeScript language server (`tsgo`).

This issue is reproducible with the minimal repository:

https://github.com/devvitor67/typescript-7-named-exports-error

The repository is configured to use the TypeScript 7 native language server.

Relevant VS Code settings:

```json
{
"js/ts.experimental.useTsgo": true,
"js/ts.suggest.includeCompletionsForImportStatements": true,
"js/ts.suggest.autoImports": true
}
```

The completion-related settings are explicitly enabled.

### ⏯ Playground Link

https://github.com/devvitor67/typescript-7-named-exports-error

### 💻 Code

The reproduction uses a local module with named exports.

`src/library.ts`:

```ts
export const foo = "foo";
export const bar = "bar";

export function greeting(name: string) {
return `Hello, ${name}!`;
}
```

In `src/index.ts`, type:

```ts
import {
```

and trigger completion with `Ctrl+Space`.

The module contains the following named exports:

```ts
foo
bar
greeting
```

With TypeScript 6, these exports are suggested by the language server.

With TypeScript 7 / `tsgo`, no named import completions are displayed.

### 🙁 Actual behavior

With TypeScript 7.0.2 and the native TypeScript language server (`tsgo`) enabled, no completion suggestions are shown after typing:

```ts
import {
```

Even though the local module contains resolvable named exports, the completion list is empty.

The same project produces the expected named import completion suggestions when using TypeScript 6.

This can be reproduced using the minimal repository:

https://github.com/devvitor67/typescript-7-named-exports-error

### 🙂 Expected behavior

When typing:

```ts
import {
```

the language server should suggest the named exports available from the resolvable module.

For the reproduction above, the following suggestions should be displayed:

```text
foo
bar
greeting
```

This is the behavior observed with TypeScript 6.

### Additional information about the issue

This appears to be a regression in named import completion behavior when using the TypeScript 7 native language server (`tsgo`).

The issue is not dependent on an external package or its type declarations. The reproduction uses only a local TypeScript module with simple named exports.

The project uses TypeScript 7.0.2 and the native language server is explicitly enabled:

```json
{
"js/ts.experimental.useTsgo": true
}
```

The relevant completion settings are also explicitly enabled:

```json
{
"js/ts.suggest.includeCompletionsForImportStatements": true,
"js/ts.suggest.autoImports": true
}
```

The expected behavior can be observed by switching the same project to TypeScript 6, where the named exports are correctly suggested inside the `import { ... }` statement.

I have provided a minimal reproduction repository to make the issue easier to investigate:

https://github.com/devvitor67/typescript-7-named-exports-error

I will also verify the behavior against the latest `typescript@next` build to determine whether the issue has already been fixed.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked minimal repository, using src/index.ts and src/library.ts, and reproduce completion after typing import { with tsgo and then TypeScript 6. Compare the completion results against the expected foo, bar, and greeting suggestions. Done means named exports from the local module appear inside the named import completion list with tsgo.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.