Extend the edit.dartfix protocol

This CL extends the dartfix protocol to allow specifying which
fixes should be applied. In summary:

* includedFixes - list of fix names to be applied
* includeRequiredFixes - bool indicating required fixes should be applied
* excludedFixes - list of fix names that should not be applied

Given that the client can specify the fixes to be included/excluded,
then the dartfix cmdline help text should include the list of known fixes.
Rather than hard code this in the dartfix client, a new edit.getDartfix
request has been added to return the list of known fixes.

Change-Id: I319f6f405a5d29757bf28b70b778a449f901bbef
Reviewed-on: https://dart-review.googlesource.com/c/91700
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
danrubel
2019-01-31 01:53:32 +00:00
committed by commit-bot@chromium.org
parent 40fca03d07
commit db44a727e5
12 changed files with 1161 additions and 15 deletions
@@ -422,14 +422,27 @@ public interface AnalysisServer {
* those sources. These edits may include changes to sources outside the set of specified sources
* if a change in a specified source requires it.
*
* If includedFixes is specified, then those fixes will be applied. If includeRequiredFixes is
* specified, then "required" fixes will be applied in addition to whatever fixes are specified in
* includedFixes if any. If neither includedFixes nor includeRequiredFixes is specified, then all
* fixes will be applied. If excludedFixes is specified, then those fixes will not be applied
* regardless of whether they are "required" or specified in includedFixes.
*
* @param included A list of the files and directories for which edits should be suggested. If a
* request is made with a path that is invalid, e.g. is not absolute and normalized, an
* error of type INVALID_FILE_PATH_FORMAT will be generated. If a request is made for a
* file which does not exist, or which is not currently subject to analysis (e.g. because
* it is not associated with any analysis root specified to analysis.setAnalysisRoots), an
* error of type FILE_NOT_ANALYZED will be generated.
* @param includedFixes A list of names indicating which fixes should be applied. If a name is
* specified that does not match the name of a known fix, an error of type UNKNOWN_FIX will
* be generated.
* @param includeRequiredFixes A flag indicating that "required" fixes should be applied.
* @param excludedFixes A list of names indicating which fixes should not be applied. If a name is
* specified that does not match the name of a known fix, an error of type UNKNOWN_FIX will
* be generated.
*/
public void edit_dartfix(List<String> included, DartfixConsumer consumer);
public void edit_dartfix(List<String> included, List<String> includedFixes, boolean includeRequiredFixes, List<String> excludedFixes, DartfixConsumer consumer);
/**
* {@code edit.format}
@@ -477,6 +490,14 @@ public interface AnalysisServer {
*/
public void edit_getAvailableRefactorings(String file, int offset, int length, GetAvailableRefactoringsConsumer consumer);
/**
* {@code edit.getDartfixInfo}
*
* Request information about edit.dartfix such as the list of known fixes that can be specified in
* an edit.dartfix request.
*/
public void edit_getDartfixInfo(GetDartfixInfoConsumer consumer);
/**
* {@code edit.getFixes}
*