You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Formatting does not produce minimal edits when empty collections are unwrapped onto a single line #5198
Splitting this from #5169 as there are two issues.
"Format Selection" can format the entire file #5169 will deal with Format Selection incorrectly formatting the entire document (this should never happen, regardless of whether or not we can minimize the format edits)
The formatter unwrapping [\n] should not result in us failing to compute minimal edits
With just the first issue fixed, we'll produce no edits instead of formatting the entire document. However, we should really produce an edit just for unwrapping the empty collection.
Example:
var a =<String>[
];
var b ='';
Should format to:
var a =<String>[];
var b ='';
...without falling back to full-document formats.
Currently it fails because the start code gets two tokens (an open bracket and a close bracket) but the end code gets a single simpletoken that is [].
This is fixed by dart-lang/sdk@b1f0b08. This is a fix in the language server that ships as part of the SDK, so the fix will show up in a future SDK release (not a Dart-Code release).
Activity
[analysis_server] When formatting, handle differences in token stream…
DanTup commentedon Jul 24, 2024
This is fixed by dart-lang/sdk@b1f0b08. This is a fix in the language server that ships as part of the SDK, so the fix will show up in a future SDK release (not a Dart-Code release).