flutter / flutter/flutter-intellij
improve the behavior of format on poorly formed files
- Dominant language
- Java
- Stars
- 2k
- Forks
- 356
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 27
Description
When editing in build() methods, if the braces/parens aren’t balanced, hitting format will destroy the file. When you go to hit undo, IntelliJ asks if you want to undo through the format operation (which breaks your flow, to have to answer a dialog).
And for context, it's very easy when refactoring build methods - adding, removing, and reordering widgets - to get into a state where the parens are unbalanced.

We should:
- verify that intellij is using the analysis server for formatting when the file is mis-formed
- follow up with dartfmt about being able to format bad files
- have intellij not ask about undoing through a format operation
- possibly, make the IntelliJ formatter (not dartfmt) format better when there are unbalanced (possibly related to https://youtrack.jetbrains.com/issue/WEB-28954)
/cc @alexander-doroshko @jwren
Contributor guide
Research direction
No source file or test entry point is named. Start by reproducing formatting on a file with unbalanced braces or parentheses in IntelliJ, then investigate whether the analysis server or dartfmt handles the request and how the undo prompt is triggered. Done would require a decided scope and verified behavior for malformed files and undo handling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100