redhat-developer / redhat-developer/vscode-java

"Add throws declaration" formats entire file

Aperta
#1,095 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

code action
Lingua principale
TypeScript
Stelle
2.3k
Fork
546
Merge medio
20h 1m
PR unite (30g)
11

Descrizione

When you use the "Add throws declaration" it formats the entire file instead of just adding the throws clause to the current function.

Environment
  • Operating System: Windows 10
  • JDK version: openjdk 11.0.4 2019-07-16
  • Visual Studio Code version: 1.38.1
  • Java extension version: 0.50.0
Steps To Reproduce
  1. Create a java file start writing some code and have it not match the default formatter. (like indenting case under a switch)

  2. write a function that calls a function that throws a checked exception (like CompletableFuture.get)

  3. Use the suggestion to add throws declarations to the current function.

Current Result

Throws declarations are added but the entire file gets formatted

Expected Result

only the throws declarations should be added to the current function and the rest of the file is untouched.

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 riproducendo il suggerimento Add throws declaration in un file Java con una formattazione non predefinita e una chiamata come CompletableFuture.get. Traccia i percorsi del suggerimento e del formatter per determinare perché viene attivata la formattazione; il lavoro è completato quando solo la funzione corrente acquisisce la sua throws declaration e il resto del file rimane invariato.

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

Valutazione

Stack tecnologico
java, typescript
Ambito
developer-experience, tooling
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
42/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.