microsoft / microsoft/TypeScript

JSDoc @type completion not working inside function argument

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

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

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

説明

### 🔎 Search Terms

jsdoc, completion

### 🕗 Version & Regression Information

Never seems to have worked

### ⏯ Playground Link

_No response_

### 💻 Code

JSDoc has some completion issues with completions like this:

```js
function someFunc(/** @type {^cursor here^} **/) {}
```

❌ Does not work - `@type` completion (in function argument) from `@import` with named argument
```
///

// @allowJS: true
// @checkJs: true
// @module: esnext

// @filename: ./a.ts
////export interface ABC {}

// @filename: ./b.js
/////** @import * as t from "./a" */
////function someFunc(/** @type {t./**/} */arg) {}

verify.completions({
marker: "",
includes: "ABC",
});
```

✅ Works - `@type` completion (in function argument) from `@typedef` and with named argument

```
///

// @allowJS: true
// @checkJs: true
// @module: esnext

// @filename: ./b.js
/////** @typedef {number} SomeNumber */
////function someFunc(/** @type {S/**/} */arg) {}

verify.completions({
marker: "",
includes: "SomeNumber",
});
```

✅ Works - `@type` completion (not part of function argument) from `@import` completion inside

```
///

// @allowJS: true
// @checkJs: true
// @module: esnext

// @filename: ./a.ts
////export interface ABC {}

// @filename: ./b.js
/////** @import * as t from "./a" */
/////** @type {t./**/} */

verify.completions({
marker: "",
includes: "ABC",
});
```

❌ Does not work - `@type` completion (in function argument) from `@import` (argument not named yet)
```
///

// @allowJS: true
// @checkJs: true
// @module: esnext

// @filename: ./a.ts
////export interface ABC {}

// @filename: ./b.js
/////** @import * as t from "./a" */
////function someFunc(/** @type {t./**/} */) {}

verify.completions({
marker: "",
includes: "ABC",
});
```

❌ Does not work - `@type` completion (in function argument) `@typedef` (argument not named yet)

```
///

// @allowJS: true
// @checkJs: true
// @module: esnext

// @filename: ./b.js
/////** @typedef {number} SomeNumber */
////function someFunc(/** @type {S/**/} */) {}

verify.completions({
marker: "",
includes: "SomeNumber",
});
```

### 🙁 Actual behavior

See above, completions are missing.

### 🙂 Expected behavior

See above, completions are present.

### Additional information about the issue

_No response_

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

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

はじめの一歩

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

調査の方向性

issue 内の fourslash.ts の再現コードから始め、特に関数引数内で JSDoc @type を使用している仮想 b.js のケースを確認してください。これらの JSDoc 型式に対する TypeScript language service の completion 処理を追跡し、動作している @typedef のケースおよびスタンドアロンのケースと比較してください。完了の条件は、欠落しているケースで ABC と SomeNumber の completions が回帰テストでカバーされることです。

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

評価

技術スタック
javascript, typescript
領域
developer-experience, tooling
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
55/100

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

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