| Index: pkg/analysis_server/lib/src/protocol.dart
|
| diff --git a/pkg/analysis_server/lib/src/protocol.dart b/pkg/analysis_server/lib/src/protocol.dart
|
| index aec8d718031308651d40461e4b09bdd8fd97c832..ef960f06d385e0155a6909bcfa0a76d4927d18ea 100644
|
| --- a/pkg/analysis_server/lib/src/protocol.dart
|
| +++ b/pkg/analysis_server/lib/src/protocol.dart
|
| @@ -392,7 +392,8 @@ abstract class JsonDecoder {
|
| var disambiguatorPath = '$jsonPath[${JSON.encode(field)}]';
|
| String disambiguator = _decodeString(disambiguatorPath, json[field]);
|
| if (!decoders.containsKey(disambiguator)) {
|
| - throw mismatch(disambiguatorPath, 'One of: ${decoders.keys.toList()}', json);
|
| + throw mismatch(
|
| + disambiguatorPath, 'One of: ${decoders.keys.toList()}', json);
|
| }
|
| return decoders[disambiguator](jsonPath, json);
|
| } else {
|
| @@ -625,8 +626,8 @@ class RequestDecoder extends JsonDecoder {
|
| buffer.write(JSON.encode(actual));
|
| buffer.write('"');
|
| }
|
| - return new RequestFailure(new Response.invalidParameter(
|
| - _request, jsonPath, buffer.toString()));
|
| + return new RequestFailure(
|
| + new Response.invalidParameter(_request, jsonPath, buffer.toString()));
|
| }
|
|
|
| @override
|
| @@ -721,20 +722,31 @@ class Response {
|
| : _result = result;
|
|
|
| /**
|
| + * Initialize a newly created instance to represent the
|
| + * FILE_NOT_ANALYZED error condition.
|
| + */
|
| + Response.fileNotAnalyzed(Request request, String file)
|
| + : this(request.id,
|
| + error: new RequestError(RequestErrorCode.FILE_NOT_ANALYZED,
|
| + 'File is not analyzed: $file.'));
|
| +
|
| + /**
|
| * Initialize a newly created instance to represent the FORMAT_INVALID_FILE
|
| * error condition.
|
| */
|
| - Response.formatInvalidFile(Request request) : this(request.id,
|
| - error: new RequestError(RequestErrorCode.FORMAT_INVALID_FILE,
|
| - 'Error during `edit.format`: invalid file.'));
|
| + Response.formatInvalidFile(Request request)
|
| + : this(request.id,
|
| + error: new RequestError(RequestErrorCode.FORMAT_INVALID_FILE,
|
| + 'Error during `edit.format`: invalid file.'));
|
|
|
| /**
|
| * Initialize a newly created instance to represent the FORMAT_WITH_ERROR
|
| * error condition.
|
| */
|
| - Response.formatWithErrors(Request request) : this(request.id,
|
| - error: new RequestError(RequestErrorCode.FORMAT_WITH_ERRORS,
|
| - 'Error during `edit.format`: source contains syntax errors.'));
|
| + Response.formatWithErrors(Request request)
|
| + : this(request.id,
|
| + error: new RequestError(RequestErrorCode.FORMAT_WITH_ERRORS,
|
| + 'Error during `edit.format`: source contains syntax errors.'));
|
|
|
| /**
|
| * Initialize a newly created instance based upon the given JSON data
|
| @@ -766,37 +778,40 @@ class Response {
|
| * Initialize a newly created instance to represent the
|
| * GET_ERRORS_INVALID_FILE error condition.
|
| */
|
| - Response.getErrorsInvalidFile(Request request) : this(request.id,
|
| - error: new RequestError(RequestErrorCode.GET_ERRORS_INVALID_FILE,
|
| - 'Error during `analysis.getErrors`: invalid file.'));
|
| + Response.getErrorsInvalidFile(Request request)
|
| + : this(request.id,
|
| + error: new RequestError(RequestErrorCode.GET_ERRORS_INVALID_FILE,
|
| + 'Error during `analysis.getErrors`: invalid file.'));
|
|
|
| /**
|
| * Initialize a newly created instance to represent the
|
| * GET_NAVIGATION_INVALID_FILE error condition.
|
| */
|
| - Response.getNavigationInvalidFile(Request request) : this(request.id,
|
| - error: new RequestError(RequestErrorCode.GET_NAVIGATION_INVALID_FILE,
|
| - 'Error during `analysis.getNavigation`: invalid file.'));
|
| + Response.getNavigationInvalidFile(Request request)
|
| + : this(request.id,
|
| + error: new RequestError(
|
| + RequestErrorCode.GET_NAVIGATION_INVALID_FILE,
|
| + 'Error during `analysis.getNavigation`: invalid file.'));
|
|
|
| /**
|
| * Initialize a newly created instance to represent an error condition caused
|
| * by an analysis.reanalyze [request] that specifies an analysis root that is
|
| * not in the current list of analysis roots.
|
| */
|
| - Response.invalidAnalysisRoot(Request request, String rootPath) : this(
|
| - request.id,
|
| - error: new RequestError(RequestErrorCode.INVALID_ANALYSIS_ROOT,
|
| - "Invalid analysis root: $rootPath"));
|
| + Response.invalidAnalysisRoot(Request request, String rootPath)
|
| + : this(request.id,
|
| + error: new RequestError(RequestErrorCode.INVALID_ANALYSIS_ROOT,
|
| + "Invalid analysis root: $rootPath"));
|
|
|
| /**
|
| * Initialize a newly created instance to represent an error condition caused
|
| * by a [request] that specifies an execution context whose context root does
|
| * not exist.
|
| */
|
| - Response.invalidExecutionContext(Request request, String contextId) : this(
|
| - request.id,
|
| - error: new RequestError(RequestErrorCode.INVALID_EXECUTION_CONTEXT,
|
| - "Invalid execution context: $contextId"));
|
| + Response.invalidExecutionContext(Request request, String contextId)
|
| + : this(request.id,
|
| + error: new RequestError(RequestErrorCode.INVALID_EXECUTION_CONTEXT,
|
| + "Invalid execution context: $contextId"));
|
|
|
| /**
|
| * Initialize a newly created instance to represent an error condition caused
|
| @@ -807,33 +822,45 @@ class Response {
|
| */
|
| Response.invalidParameter(Request request, String path, String expectation)
|
| : this(request.id,
|
| - error: new RequestError(RequestErrorCode.INVALID_PARAMETER,
|
| - "Invalid parameter '$path'. $expectation."));
|
| + error: new RequestError(RequestErrorCode.INVALID_PARAMETER,
|
| + "Invalid parameter '$path'. $expectation."));
|
|
|
| /**
|
| * Initialize a newly created instance to represent an error condition caused
|
| * by a malformed request.
|
| */
|
| - Response.invalidRequestFormat() : this('',
|
| - error: new RequestError(
|
| - RequestErrorCode.INVALID_REQUEST, 'Invalid request'));
|
| + Response.invalidRequestFormat()
|
| + : this('',
|
| + error: new RequestError(
|
| + RequestErrorCode.INVALID_REQUEST, 'Invalid request'));
|
|
|
| /**
|
| * Initialize a newly created instance to represent an error condition caused
|
| * by a request that requires an index, but indexing is disabled.
|
| */
|
| - Response.noIndexGenerated(Request request) : this(request.id,
|
| - error: new RequestError(
|
| - RequestErrorCode.NO_INDEX_GENERATED, 'Indexing is disabled'));
|
| + Response.noIndexGenerated(Request request)
|
| + : this(request.id,
|
| + error: new RequestError(
|
| + RequestErrorCode.NO_INDEX_GENERATED, 'Indexing is disabled'));
|
| +
|
| + /**
|
| + * Initialize a newly created instance to represent the
|
| + * ORGANIZE_DIRECTIVES_ERROR error condition.
|
| + */
|
| + Response.organizeDirectivesError(Request request, String message)
|
| + : this(request.id,
|
| + error: new RequestError(
|
| + RequestErrorCode.ORGANIZE_DIRECTIVES_ERROR, message));
|
|
|
| /**
|
| * Initialize a newly created instance to represent the
|
| * REFACTORING_REQUEST_CANCELLED error condition.
|
| */
|
| - Response.refactoringRequestCancelled(Request request) : this(request.id,
|
| - error: new RequestError(
|
| - RequestErrorCode.REFACTORING_REQUEST_CANCELLED,
|
| - 'The `edit.getRefactoring` request was cancelled.'));
|
| + Response.refactoringRequestCancelled(Request request)
|
| + : this(request.id,
|
| + error: new RequestError(
|
| + RequestErrorCode.REFACTORING_REQUEST_CANCELLED,
|
| + 'The `edit.getRefactoring` request was cancelled.'));
|
|
|
| /**
|
| * Initialize a newly created instance to represent the SERVER_ERROR error
|
| @@ -852,49 +879,52 @@ class Response {
|
| * Initialize a newly created instance to represent the
|
| * SORT_MEMBERS_INVALID_FILE error condition.
|
| */
|
| - Response.sortMembersInvalidFile(Request request) : this(request.id,
|
| - error: new RequestError(RequestErrorCode.SORT_MEMBERS_INVALID_FILE,
|
| - 'Error during `edit.sortMembers`: invalid file.'));
|
| + Response.sortMembersInvalidFile(Request request)
|
| + : this(request.id,
|
| + error: new RequestError(RequestErrorCode.SORT_MEMBERS_INVALID_FILE,
|
| + 'Error during `edit.sortMembers`: invalid file.'));
|
|
|
| /**
|
| * Initialize a newly created instance to represent the
|
| * SORT_MEMBERS_PARSE_ERRORS error condition.
|
| */
|
| - Response.sortMembersParseErrors(Request request, int numErrors) : this(
|
| - request.id,
|
| - error: new RequestError(RequestErrorCode.SORT_MEMBERS_PARSE_ERRORS,
|
| - 'Error during `edit.sortMembers`: file has $numErrors scan/parse errors.'));
|
| + Response.sortMembersParseErrors(Request request, int numErrors)
|
| + : this(request.id,
|
| + error: new RequestError(RequestErrorCode.SORT_MEMBERS_PARSE_ERRORS,
|
| + 'Error during `edit.sortMembers`: file has $numErrors scan/parse errors.'));
|
|
|
| /**
|
| * Initialize a newly created instance to represent an error condition caused
|
| * by a `analysis.setPriorityFiles` [request] that includes one or more files
|
| * that are not being analyzed.
|
| */
|
| - Response.unanalyzedPriorityFiles(String requestId, String fileNames) : this(
|
| - requestId,
|
| - error: new RequestError(RequestErrorCode.UNANALYZED_PRIORITY_FILES,
|
| - "Unanalyzed files cannot be a priority: '$fileNames'"));
|
| + Response.unanalyzedPriorityFiles(String requestId, String fileNames)
|
| + : this(requestId,
|
| + error: new RequestError(RequestErrorCode.UNANALYZED_PRIORITY_FILES,
|
| + "Unanalyzed files cannot be a priority: '$fileNames'"));
|
|
|
| /**
|
| * Initialize a newly created instance to represent an error condition caused
|
| * by a [request] that cannot be handled by any known handlers.
|
| */
|
| - Response.unknownRequest(Request request) : this(request.id,
|
| - error: new RequestError(
|
| - RequestErrorCode.UNKNOWN_REQUEST, 'Unknown request'));
|
| + Response.unknownRequest(Request request)
|
| + : this(request.id,
|
| + error: new RequestError(
|
| + RequestErrorCode.UNKNOWN_REQUEST, 'Unknown request'));
|
|
|
| /**
|
| * Initialize a newly created instance to represent an error condition caused
|
| * by a [request] referencing a source that does not exist.
|
| */
|
| - Response.unknownSource(Request request) : this(request.id,
|
| - error: new RequestError(
|
| - RequestErrorCode.UNKNOWN_SOURCE, 'Unknown source'));
|
| + Response.unknownSource(Request request)
|
| + : this(request.id,
|
| + error: new RequestError(
|
| + RequestErrorCode.UNKNOWN_SOURCE, 'Unknown source'));
|
|
|
| - Response.unsupportedFeature(String requestId, String message) : this(
|
| - requestId,
|
| - error: new RequestError(
|
| - RequestErrorCode.UNSUPPORTED_FEATURE, message));
|
| + Response.unsupportedFeature(String requestId, String message)
|
| + : this(requestId,
|
| + error: new RequestError(
|
| + RequestErrorCode.UNSUPPORTED_FEATURE, message));
|
|
|
| /**
|
| * Return a table representing the structure of the Json object that will be
|
|
|