microsoft / microsoft/TypeScript
Using classes in jsdoc comments results in different behaviors depending on how the class was required
まだ誰も着手していません。
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.3k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
説明
TS Template added by @mjbvz
TypeScript Version: 3.9.1
Search Terms
- javascript
- jsdoc
Issue Type: Bug
I have a class Foo in a file deep in my project.
Everything works fine if I require it directly: intellisense understands that when I use Foo in my jsdoc comments, I mean that I want instances of Foo:

But if I require the same file through other files, intellisense thinks I want the Foo class:

I have created an example repo that reproduces the problem here:
https://github.com/gaelhameon/vscode-intellisense-issue
Is this the expected behavior ?
If it is, is there a way to have the "instance" behavior without having to require the file directly ?
Thanks in advance!
VS Code version: Code 1.45.0 (d69a79b73808559a91206d73d7717ff5f798f23c, 2020-05-07T16:18:48.860Z)
OS version: Windows_NT x64 10.0.18362
System Info
| Item | Value |
|---|---|
| CPUs | Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz (8 x 1800) |
| GPU Status | 2d_canvas: enabled flash_3d: enabled flash_stage3d: enabled flash_stage3d_baseline: enabled gpu_compositing: enabled multiple_raster_threads: enabled_on oop_rasterization: disabled_off protected_video_decode: enabled rasterization: enabled skia_renderer: disabled_off_ok video_decode: enabled viz_display_compositor: enabled_on viz_hit_test_surface_layer: disabled_off_ok webgl: enabled webgl2: enabled |
| Load (avg) | undefined |
| Memory (System) | 7.82GB (1.53GB free) |
| Process Argv | |
| Screen Reader | no |
| VM | 0% |
Extensions (5)
| Extension | Author (truncated) | Version |
|---|---|---|
| javascript-test-runner-reloaded | ale | 2.2.1 |
| vscode-eslint | dba | 2.1.5 |
| gitlens | eam | 10.2.1 |
| vscode-pull-request-github | Git | 0.16.0 |
| vscode-commitizen | Kni | 0.8.4 |
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
リンクされている再現リポジトリから始め、TypeScript 3.9.1 で issue に記載されている 2 つの require パスを比較します。クラスを直接 required した場合と、他のファイル経由で required した場合に、JSDoc が Foo をどのように解決するかを追跡し、その後、報告された VS Code のセットアップで動作を確認します。2 つのインポートパスが一貫したインスタンス指向の IntelliSense を生成し、再現ケースをカバーする回帰テストがあれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, typescript
- 領域
- devtools
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 25/100