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

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

Issue 2466703002: Get code to format from 'overlayState' or from the Source. (Closed)
Patch Set: Created 4 years, 1 month 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/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 c0323a442e28d1f050e60f3ef16bab71d8810bd0..7e1a9883219b4ab1d2d70456620de87957e4116f 100644
--- a/pkg/analysis_server/lib/src/edit/edit_domain.dart
+++ b/pkg/analysis_server/lib/src/edit/edit_domain.dart
@@ -69,23 +69,15 @@ class EditDomainHandler implements RequestHandler {
EditFormatParams params = new EditFormatParams.fromRequest(request);
String file = params.file;
- ContextSourcePair contextSource = server.getContextSourcePair(file);
-
- engine.AnalysisContext context = contextSource.context;
- if (context == null) {
- return new Response.formatInvalidFile(request);
- }
-
- Source source = contextSource.source;
- engine.TimestampedData<String> contents;
+ String unformattedSource;
try {
- contents = context.getContents(source);
+ Source source = server.resourceProvider.getFile(file).createSource();
+ unformattedSource = server.overlayState.getContents(source);
+ unformattedSource ??= source.contents.data;
} catch (e) {
return new Response.formatInvalidFile(request);
}
- String unformattedSource = contents.data;
-
int start = params.selectionOffset;
int length = params.selectionLength;
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/dart/analysis/driver.dart » ('j') | pkg/analyzer/lib/src/dart/analysis/driver.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698