microsoft / microsoft/TypeScript

From-first import statement completion

Abierto
#43,670 3 comentarios 1 reacción 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Awaiting More Feedback Suggestion
Lenguaje dominante
Go
Estrellas
111k
Forks
14.4k
Merge medio
1 d 19 h
PR fusionados (30 d)
117

Descripción

Suggestion

import, completion, reverse, inverse, from-first

✅ Viability Checklist

This would be a completion feature for the language server, with no impact on the compiler or language syntax.

⭐ Suggestion

A smoother developer experience for completing imports when the symbol is unknown and the package is.

This is the opposite of the new symbol-first import completion feature proposed for TS 4.3.

📃 Motivating Example

The symbol-first import completion feature is interesting, but I think it somewhat misses a real-world context. Bottom line is that, as developers, we hardly ever actually spend time at the top of the file manually writing imports.

Whenever I know the symbol I want to import, I am usually writing it in-line in my code block, and TS Lang Server is able to complete the import based on its usage. This is 99% of the cases in which I am importing a symbol whose name I know. From this perspective, having completion for import { myFunc } is not so useful.

Given this, the only time I'm actually at the top of a file writing import statements is usually when I know the name of the package, but I don't know exactly what the symbol name is, or where to start. In this case I end up having to write import { } from 'myPackage'; and then going back to the { } and triggering completion.

It would be a small improvement, but being able to write from 'myPackage' and being presented with the list of symbols to select from would be much more relevant in my mind, because the only time we're up the top of the file writing imports is when we DON'T know what symbols we're looking for.

💻 Use Cases

I think the motivating example outlines this sufficiently.

The implementation seems simple. Simple enough at least that a snippet in VSCode or Webstorm ought to be able to match its behaviour.

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

Comienza con el comportamiento existente de completado de importaciones del TypeScript language server descrito en el issue. Reproduce el completado después de escribir from 'myPackage' y compáralo con el completado de importaciones basado primero en símbolos; la tarea está terminada cuando se ofrecen los símbolos del paquete sin insertar manualmente una cláusula de importación vacía.

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

Evaluación

Stack tecnológico
typescript
Área
tooling
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.