microsoft / microsoft/TypeScript

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

オープン
#64,270 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Go
スター
111k
フォーク
14.3k
平均マージ
2日 4時間
マージ済み PR(30日)
132

説明

🔎 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:

{
  "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:

export const foo = "foo";
export const bar = "bar";

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

In src/index.ts, type:

import {

and trigger completion with Ctrl+Space.

The module contains the following named exports:

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:

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:

import {

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

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

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:

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

The relevant completion settings are also explicitly enabled:

{
  "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.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

リンクされた最小限のリポジトリから始め、src/index.ts と src/library.ts を使用して、import { に続けて tsgo、さらに TypeScript 6 を入力した後の補完を再現します。補完結果を、期待される foo、bar、greeting の候補と比較します。tsgo でローカルモジュールの名前付きエクスポートが名前付きインポートの補完リスト内に表示されれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
typescript
領域
devtools
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
活発
明瞭さ
おおむね明確
初心者へのやさしさ
68/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。