microsoft / microsoft/TypeScript

Rename file when renaming default export

Aperta
#29,294 0 commenti 9 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Domain: LS: Refactorings Needs Proposal Suggestion
Lingua principale
Go
Stelle
111k
Fork
14.3k
Merge medio
2g 4h
PR unite (30g)
132

Descrizione

Currently we can use the rename symbol command and that will rename the symbol and its usages (exports, imports, usages in other files, etc.). That's a great start, but I'd love to see this feature expanded to do the following:

  • Many times a file name will coincide with the symbol being refactored. The refactor option should be available when renaming the file, so everything can be done at once.

  • In addition to the refactor changing symbol references across all files, it'd be nice to have the ability to also update comments, strings, etc. that refer to that symbol.

Code Example:

Shape.js

class Shape {}
export default Shape;

Circle.js - We reference Shape as an import, extends, inside a comment, and inside a string. They should all be refactored.

import Shape from "./Shape";

// Shape subclass
class Circle extends Shape {
  constructor() {
    super();
    console.log('A circle is a Shape.');
  }
}

export default Circle;

WebStorm Examples

screen shot 2019-01-04 at 8 36 22 pm screen shot 2019-01-04 at 8 37 02 pm

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia con il comando esistente rename symbol e traccia il modo in cui aggiorna export, import e utilizzi tra i file. Usa l'esempio di Shape.js e Circle.js come caso di accettazione: rinominare l'export predefinito dovrebbe anche rinominare il file corrispondente e aggiornare i riferimenti mostrati nell'import, nel commento e nella stringa.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript, typescript
Ambito
developer-experience, tooling
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.