microsoft / microsoft/TypeScript

JSDoc @type completion not working inside function argument

Aperta
#62,281 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Domain: JSDoc Help Wanted Possible Improvement
Lingua principale
Go
Stelle
111k
Fork
14.3k
Merge medio
2g 4h
PR unite (30g)
132

Descrizione

### 🔎 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_

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia con le riproduzioni fourslash.ts nell’issue, in particolare i casi di b.js virtuale che usano JSDoc @type all’interno di un argomento di funzione. Traccia la gestione dei completions da parte del TypeScript language service per queste espressioni di tipo JSDoc e confrontala con i casi @typedef e standalone funzionanti. Il lavoro è completato quando la copertura di regressione mostra completions per ABC e SomeNumber nei casi mancanti.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript, typescript
Ambito
developer-experience, tooling
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
55/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.