microsoft / microsoft/TypeScript

jsDoc intellisense support for @typedef in another file

Đang mở
#30,941 2 bình luận 6 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Awaiting More Feedback Suggestion
Ngôn ngữ chính
Go
Star
111k
Fork
14.3k
Merge trung bình
2 ngày 4 giờ
Pull request đã merge (30 ngày)
132

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Tái hiện vấn đề với các typedef trong Configuration.js được cung cấp và một consumer module.exports riêng biệt, trước tiên khi tệp typedef đang mở và sau đó khi đã đóng. Theo dõi quá trình JavaScript language service phát hiện JSDoc @typedef và làm cho consumer phân giải các kiểu đó trên toàn bộ thư mục làm việc hiện tại; hoàn tất khi IntelliSense hiển thị các thành viên typedef trong cả hai trường hợp.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
javascript, typescript
Lĩnh vực
tooling
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.