| Index: pkg/analysis_server/lib/src/domain_analysis.dart
|
| diff --git a/pkg/analysis_server/lib/src/domain_analysis.dart b/pkg/analysis_server/lib/src/domain_analysis.dart
|
| index 3a788ba28337aac3ee6519e9d94d097da0009a4a..c0d2983d5934141772631c704db1757ef591421c 100644
|
| --- a/pkg/analysis_server/lib/src/domain_analysis.dart
|
| +++ b/pkg/analysis_server/lib/src/domain_analysis.dart
|
| @@ -78,6 +78,11 @@ class AnalysisDomainHandler implements RequestHandler {
|
| static const String ADDED_PARAM = 'added';
|
|
|
| /**
|
| + * The name of the `content` parameter.
|
| + */
|
| + static const String CONTENT_PARAM = 'content';
|
| +
|
| + /**
|
| * The name of the `default` parameter.
|
| */
|
| static const String DEFAULT_PARAM = 'default';
|
| @@ -118,11 +123,21 @@ class AnalysisDomainHandler implements RequestHandler {
|
| static const String LENGTH_PARAM = 'length';
|
|
|
| /**
|
| + * The name of the `newLength` parameter.
|
| + */
|
| + static const String NEW_LENGTH_PARAM = 'newLength';
|
| +
|
| + /**
|
| * The name of the `offset` parameter.
|
| */
|
| static const String OFFSET_PARAM = 'offset';
|
|
|
| /**
|
| + * The name of the `oldLength` parameter.
|
| + */
|
| + static const String OLD_LENGTH_PARAM = 'oldLength';
|
| +
|
| + /**
|
| * The name of the `options` parameter.
|
| */
|
| static const String OPTIONS_PARAM = 'options';
|
| @@ -222,8 +237,20 @@ class AnalysisDomainHandler implements RequestHandler {
|
| }
|
|
|
| Response updateContent(Request request) {
|
| - // TODO(scheglov) implement
|
| - return null;
|
| + var changes = new Map<String, ContentChange>();
|
| + RequestDatum filesDatum = request.getRequiredParameter(FILES_PARAM);
|
| + filesDatum.forEachMap((file, changeDatum) {
|
| + var change = new ContentChange();
|
| + change.content = changeDatum[CONTENT_PARAM].asString();
|
| + if (changeDatum.hasKey(OFFSET_PARAM)) {
|
| + change.offset = changeDatum[OFFSET_PARAM].asInt();
|
| + change.oldLength = changeDatum[OLD_LENGTH_PARAM].asInt();
|
| + change.newLength = changeDatum[NEW_LENGTH_PARAM].asInt();
|
| + }
|
| + changes[file] = change;
|
| + });
|
| + server.updateContent(changes);
|
| + return new Response(request.id);
|
| }
|
|
|
| Response updateOptions(Request request) {
|
| @@ -236,3 +263,14 @@ class AnalysisDomainHandler implements RequestHandler {
|
| return null;
|
| }
|
| }
|
| +
|
| +
|
| +/**
|
| + * A description of the change to the content of a file.
|
| + */
|
| +class ContentChange {
|
| + String content;
|
| + int offset;
|
| + int oldLength;
|
| + int newLength;
|
| +}
|
|
|