microsoft / microsoft/TypeScript
JSDoc @type completion not working inside function argument
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.3k
- Ø Merge
- 2 T. 4 Std.
- Gemergte PRs (30 T.)
- 132
Beschreibung
### 🔎 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_
Beitragsleitfaden
Rechercherichtung
Beginne mit den fourslash.ts-Reproduktionen im Issue, insbesondere den Fällen mit der virtuellen b.js, die JSDoc @type innerhalb eines Funktionsarguments verwenden. Verfolge die Completion-Behandlung des TypeScript language service für diese JSDoc-Typausdrücke und vergleiche sie mit den funktionierenden @typedef- und eigenständigen Fällen. Fertig ist die Arbeit, wenn die Regressionstests in den fehlenden Fällen completions für ABC und SomeNumber abdecken.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, typescript
- Bereich
- developer-experience, tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 55/100