Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow disabling formatting for a region of code. #1522

Merged
merged 6 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion benchmark/run.dart
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ double _runTrial(DartFormatter formatter, ParseStringResult parseResult,
result = visitor.run(parseResult.unit).text;
} else {
var visitor = AstNodeVisitor(formatter, parseResult.lineInfo, source);
result = visitor.run(parseResult.unit).text;
result = visitor.run(source, parseResult.unit).text;
}
}

Expand Down
4 changes: 2 additions & 2 deletions example/format.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void main(List<String> args) {
class C {}
''');

_runTest('selection/selection.stmt', 2);
_runTest('other/selection.stmt', 2);
}

void _formatStmt(String source, {bool tall = true, int pageWidth = 40}) {
Expand Down Expand Up @@ -68,7 +68,7 @@ void _drawRuler(String label, int width) {
/// directory.
Future<void> _runTest(String path, int line,
{int pageWidth = 40, bool tall = true}) async {
var testFile = await TestFile.read(path);
var testFile = await TestFile.read('${tall ? 'tall' : 'short'}/$path');
var formatTest = testFile.tests.firstWhere((test) => test.line == line);

var formatter = DartFormatter(
Expand Down
Loading