microsoft / microsoft/TypeScript
JSDoc @type completion not working inside function argument
- 主要语言
- Go
- 星标
- 111k
- 派生
- 14.3k
- 平均合并
- 2 天 4 小时
- 30 天内合并 PR
- 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_
贡献指南
调研方向
从 issue 中的 fourslash.ts 复现开始,尤其关注在函数参数中使用 JSDoc @type 的虚拟 b.js 案例。跟踪 TypeScript language service 对这些 JSDoc 类型表达式的 completion 处理,并将其与正常工作的 @typedef 和独立案例进行比较。完成的标准是回归覆盖率在缺失案例中显示 ABC 和 SomeNumber 的 completions。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, typescript
- 领域
- developer-experience, tooling
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 55/100