microsoft / microsoft/TypeScript

External interfaces included in IDE symbol space

Abierto
#243 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Domain: API Help Wanted Suggestion
Lenguaje dominante
Go
Estrellas
111k
Forks
14.3k
Merge medio
2 d 4 h
PR fusionados (30 d)
132

Descripción

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.

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Reproduce el problema con underscore.d.ts referenciado por una directiva XML y, a continuación, investiga cómo Navigate To indexa interfaces y miembros de archivos .d.ts externos. La corrección debe mantener esos identificadores fuera del espacio de símbolos del IDE de forma predeterminada, pero permitirlos cuando “Search within external items” esté habilitado.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
typescript
Área
developer-experience, search
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bien especificado
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.