Add a new request to format all of the files in a directory

This is marked as experimental, and is only intended to be used by
`dart fix` as a way of formatting the files that were modified if the
analysis options file indicates that they ought to be formatted.

Change-Id: I288baebfc7cb3f82cc361bdc19835e43064eb0d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238921
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
Brian Wilkerson
2022-03-28 17:13:40 +00:00
committed by Commit Bot
parent d3c1fee003
commit 4eaf2d68cd
15 changed files with 533 additions and 1 deletions
@@ -541,6 +541,20 @@ public interface AnalysisServer {
*/
public void edit_format(String file, int selectionOffset, int selectionLength, int lineLength, FormatConsumer consumer);
/**
* {@code edit.formatIfEnabled}
*
* Format the contents of the files in one or more directories, but only if the analysis options
* file for those files has enabled the 'format' option.
*
* If any of the specified directories does not exist, that directory will be ignored. If any of
* the files that are eligible for being formatted cannot be formatted because of a syntax error in
* the file, that file will be ignored.
*
* @param directories The paths of the directories containing the code to be formatted.
*/
public void edit_formatIfEnabled(List<String> directories, FormatIfEnabledConsumer consumer);
/**
* {@code edit.getAssists}
*