microsoft / microsoft/TypeScript

jsDoc intellisense support for @typedef in another file

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

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

Awaiting More Feedback Suggestion
主要言語
Go
スター
111k
フォーク
14.4k
平均マージ
1日 19時間
マージ済み PR(30日)
117

説明

Issue Type: Feature Request

Intellisense uses @typedef tags in other files but only if the file is opened in current window. Please allow any typedef tag to be used inside current working directory even if file containing typedef is not opened.

Here is what i mean. I annotated a variable with type. This variable is exported directly with module.exports.

issue-typedef

My typedef is in seperate file.
Configuration.js

/**
 * @typedef {Object} ConfigurationInputDirectories
 * @property {string} modules
 * @property {string} layoutModules
 * @property {string} standaloneScripts
 * @property {string} standaloneStyles
 * @property {string} libraryScripts
 * @property {string} libraryStyles
 * @property {string} markupTemplates
 */

/**
 * @typedef {Object} ConfigurationOutputDirectories
 * @property {string} pageScripts
 * @property {string} vendorScripts
 * @property {string} standaloneScripts
 * @property {string} pageStyles
 * @property {string} vendorStyles
 * @property {string} standaloneStyles
 * @property {string} markupFiles
 */

/**
 * @typedef {Object} ConfigurationVendor
 * @property {string} standardPath
 * @property {string} minPath
 */

/**
 * @typedef {Object} ConfigurationModule
 * @property {string} layoutModule
 * @property {string} markupTemplate
 * @property {string[]} includeStandaloneScripts
 * @property {string[]} includeStandaloneStyles
 * @property {string[]} includeVendorScripts
 * @property {string[]} includeVendorStyles
 * @property {string[]} excludeStandaloneScripts
 * @property {string[]} excludeStandaloneStyles
 * @property {string[]} excludeVendorScripts
 * @property {string[]} excludeVendorStyles
 */


/**
 * @typedef {Object} ConfigurationLayoutModule
 * @property {string} layoutModule
 * @property {string} markupTemplate
 * @property {string[]} includeStandaloneScripts
 * @property {string[]} includeStandaloneStyles
 * @property {string[]} includeVendorScripts
 * @property {string[]} includeVendorStyles
 * @property {string[]} excludeStandaloneScripts
 * @property {string[]} excludeStandaloneStyles
 * @property {string[]} excludeVendorScripts
 * @property {string[]} excludeVendorStyles
 */

/**
 * Represents configuration object for build process.
 * @typedef {Object} Configuration
 * @property {ConfigurationInputDirectories} inputDirectories
 * @property {ConfigurationOutputDirectories} outputDirectories
 * @property {Object.<string,ConfigurationVendor} vendorScripts
 * @property {Object.<string,ConfigurationVendor>} vendorStyles
 * @property {Object.<string,ConfigurationModule>} modules
 * @property {Object.<string,ConfigurationLayoutModule>} layoutModules
 * @property {string} defaultMarkupTemplate
 * @property {string} contentPlaceHolder
 * @property {string} nameDirectorySeperator
 * @property {string[]} validLibraryEntryFileNames
 * @property {string} moduleFileName
 * @property {string} rootModuleFileName
 * @property {string} systemjsPath
 * @property {string} systemjsNamedRegistersPath
 */

When this file containing type definitions is open the intellisense/language service/or whatever you call it is recognizing this variable's type and intellisense displays the members when using this config variable. But when file is closed its type turns to any. It would be nice to see type informations from typedef tags even if files containing tags are closed.
issue-typedef-2

VS Code version: Code 1.33.0 (0dd516dd412d42323fc3464531b1c715d51c4c1a, 2019-04-04T15:14:28.026Z)
OS version: Windows_NT x64 10.0.17134

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

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

はじめの一歩

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

調査の方向性

提供された Configuration.js の typedef と、別の module.exports コンシューマーを使って問題を再現します。まず typedef ファイルを開いた状態で、次に閉じた状態で行います。JavaScript language service による JSDoc @typedef の検出を追跡し、コンシューマーが現在の作業ディレクトリ全体でそれらの型を解決できるようにします。両方の場合で IntelliSense に typedef のメンバーが表示されれば完了です。

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

評価

技術スタック
javascript, typescript
領域
tooling
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

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

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