microsoft / microsoft/TypeScript

External interfaces included in IDE symbol space

未关闭
#243 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Domain: API Help Wanted Suggestion
主要语言
Go
星标
111k
派生
14.3k
平均合并
2 天 4 小时
30 天内合并 PR
132

描述

Overview

Interfaces defined in .d.ts files (even if they are not part of the Visual Studio project) are nonetheless included in the IDE symbol space; i.e. they appear in the Navigate To search results.

Repro

Add the NuGet package underscore.TypeScript.DefinitelyTyped to a project. Ensure that underscore.d.ts is not included in the project; however, do put a reference to it in a TypeScript file in the project, e.g.

/// <reference path="../Scripts/typings/underscore/underscore.d.ts"/>

In Visual Studio, press Ctrl + , and type reduce. Notice you get lots of listings for methods defined in the underscore interface.

Commentary

The repro steps are analogous to adding a reference to System.Web.Mvc, hitting Ctrl + ,, typing file, and seeing the File methods for System.Web.Mvc.Controller, plus who knows what else. Of course, for assembly references this doesn't happen; it would be noise, polluting the IDE symbol space with stuff you rarely want to try to navigate to. Libraries have lots of symbols, often more than our own apps. Those symbols get in the way of navigating quickly within our own app. That's why there's a switch to turn off external items. The same situation applies to JavaScript libraries with TypeScript annotations - not at the same scale as the .NET Framework, but still at enough scale to be a problem.

The bug is that for TypeScript, interfaces and their members in .d.ts files always show up. Ideally, they shouldn't show up regardless of whether the .d.ts file is referenced with an XML directive or by including the file in the project.

The main use case where it would be helpful to include the identifiers in the IDE symbol space is when developers are actually writing .d.ts files. To serve that need, it would be reasonable to include the symbols if the "Search within external items" option is enabled.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

复现由 XML 指令引用的 underscore.d.ts 所导致的问题,然后调查 Navigate To 如何为外部 .d.ts 文件中的接口和成员建立索引。修复应默认将这些标识符排除在 IDE 符号空间之外,但在启用“Search within external items”时允许它们。

由索引模型根据 Issue 内容生成。

评估

技术栈
typescript
领域
developer-experience, search
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
描述清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。