Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(566)

Issue 822273004: Add API to provide a selection range, and return the updated selection after formatting. (Closed)

Created:
5 years, 11 months ago by Bob Nystrom
Modified:
5 years, 11 months ago
CC:
reviews_dartlang.org
Base URL:
https://github.com/dart-lang/dart_style.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Add API to provide a selection range, and return the updated selection after formatting. Fix #93. BUG=https://github.com/dart-lang/dart_style/issues/93 R=brianwilkerson@google.com Committed: 119b00b06d1ecde69e01859413329e32b6cd6c14

Patch Set 1 #

Total comments: 7

Patch Set 2 : Remove redundant argument check. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+572 lines, -84 lines) Patch
M benchmark/benchmark.dart View 1 chunk +1 line, -1 line 0 comments Download
M lib/src/chunk.dart View 3 chunks +64 lines, -1 line 0 comments Download
M lib/src/dart_formatter.dart View 1 6 chunks +68 lines, -18 lines 0 comments Download
M lib/src/formatter_exception.dart View 1 chunk +2 lines, -0 lines 0 comments Download
M lib/src/line_splitter.dart View 3 chunks +24 lines, -5 lines 0 comments Download
M lib/src/line_writer.dart View 7 chunks +74 lines, -33 lines 0 comments Download
M lib/src/source_visitor.dart View 8 chunks +118 lines, -19 lines 0 comments Download
M test/formatter_test.dart View 3 chunks +79 lines, -7 lines 0 comments Download
A test/selections/selections.stmt View 1 chunk +73 lines, -0 lines 0 comments Download
A test/selections/selections.unit View 1 chunk +69 lines, -0 lines 0 comments Download

Messages

Total messages: 8 (1 generated)
Bob Nystrom
After this lands, to format some code with a selection, you basically do: var sourceCode ...
5 years, 11 months ago (2015-01-07 23:10:42 UTC) #2
Brian Wilkerson
LGTM! I think you're right that it makes sense to push the selection start to ...
5 years, 11 months ago (2015-01-08 00:17:45 UTC) #3
Bob Nystrom
https://chromiumcodereview.appspot.com/822273004/diff/1/lib/src/dart_formatter.dart File lib/src/dart_formatter.dart (right): https://chromiumcodereview.appspot.com/822273004/diff/1/lib/src/dart_formatter.dart#newcode54 lib/src/dart_formatter.dart:54: if (selectionLength == null) { On 2015/01/08 00:17:45, Brian ...
5 years, 11 months ago (2015-01-08 00:36:38 UTC) #4
Bob Nystrom
Committed patchset #2 (id:20001) manually as 119b00b06d1ecde69e01859413329e32b6cd6c14 (presubmit successful).
5 years, 11 months ago (2015-01-08 00:36:59 UTC) #5
pquitslund
LGTM. Sweet! :)
5 years, 11 months ago (2015-01-08 00:39:25 UTC) #6
Bob Nystrom
On 2015/01/08 00:17:45, Brian Wilkerson wrote: > LGTM! > > I think you're right that ...
5 years, 11 months ago (2015-01-08 00:45:01 UTC) #7
Brian Wilkerson
5 years, 11 months ago (2015-01-08 05:31:29 UTC) #8
Message was sent while issue was closed.
https://chromiumcodereview.appspot.com/822273004/diff/1/lib/src/dart_formatte...
File lib/src/dart_formatter.dart (right):

https://chromiumcodereview.appspot.com/822273004/diff/1/lib/src/dart_formatte...
lib/src/dart_formatter.dart:154: parser.parseAsync = true;
> With 0.22.4, I do need to set parseAsync.

In that case, you probably also want to add:

  parser.parseDeferredLibraries = true;
  parser.parseEnum = true;

Powered by Google App Engine
This is Rietveld 408576698