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

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

Issue 1092653002: Fix "edit.format" to follow protocol when there is no selection. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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
« no previous file with comments | « no previous file | pkg/analysis_server/test/edit/format_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/edit/edit_domain.dart
diff --git a/pkg/analysis_server/lib/src/edit/edit_domain.dart b/pkg/analysis_server/lib/src/edit/edit_domain.dart
index 32effe1899dac203bf77adf4eefb3d8a285fd891..73ae0d428d2316d3ba8f304c21cbbb266459db17 100644
--- a/pkg/analysis_server/lib/src/edit/edit_domain.dart
+++ b/pkg/analysis_server/lib/src/edit/edit_domain.dart
@@ -110,8 +110,20 @@ class EditDomainHandler implements RequestHandler {
edits.add(edit);
}
- return new EditFormatResult(edits, formattedResult.selectionStart,
- formattedResult.selectionLength).toResponse(request.id);
+ int newStart = formattedResult.selectionStart;
+ int newLength = formattedResult.selectionLength;
+
+ // Sending null start/length values would violate protocol, so convert back
+ // to 0.
+ if (newStart == null) {
+ newStart = 0;
+ }
+ if (newLength == null) {
+ newLength = 0;
+ }
+
+ return new EditFormatResult(edits, newStart,
+ newLength).toResponse(request.id);
}
Response getAssists(Request request) {
« no previous file with comments | « no previous file | pkg/analysis_server/test/edit/format_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698