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

Unified Diff: pkg/analysis_server/lib/src/analysis_server.dart

Issue 449213002: Rework "analysis.updateContent" analysis server request. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/lib/src/analysis_server.dart
diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart
index 9db8090d09461a0d2f4ca162382fc4d025d0a013..e55e23768613f123a1f18c3b9f147d36731651e6 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -483,8 +483,15 @@ class AnalysisServer {
if (change.offset == null) {
analysisContext.setContents(source, change.content);
} else {
- analysisContext.setChangedContents(source, change.content,
- change.offset, change.oldLength, change.newLength);
+ // TODO(paulberry): an error should be generated if source is not
+ // currently in the content cache.
+ TimestampedData<String> oldContents = analysisContext.getContents(
+ source);
+ int offsetEnd = change.offset + change.oldLength;
+ String newContents = oldContents.data.substring(0, change.offset) +
+ change.content + oldContents.data.substring(offsetEnd);
+ analysisContext.setChangedContents(source, newContents, change.offset,
+ change.oldLength, change.content.length);
}
schedulePerformAnalysisOperation(analysisContext);
}

Powered by Google App Engine
This is Rietveld 408576698