redhat-developer / redhat-developer/vscode-java
"Add throws declaration" formats entire file
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 546
- Avg merge
- 20h 1m
- Merged PRs (30d)
- 11
Description
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
-
Create a java file start writing some code and have it not match the default formatter. (like indenting case under a switch)
-
write a function that calls a function that throws a checked exception (like CompletableFuture.get)
-
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Add throws declaration suggestion in a Java file with non-default formatting and a call such as CompletableFuture.get. Trace the suggestion and formatter paths to determine why formatting is triggered; done means only the current function gains its throws declaration and the rest of the file remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, typescript
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100