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

Unified Diff: dart/site/try/src/interaction_manager.dart

Issue 345143002: Handle incremental diagnostics. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Merged with r37595. Created 6 years, 6 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 | « dart/site/try/src/editor.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/site/try/src/interaction_manager.dart
diff --git a/dart/site/try/src/interaction_manager.dart b/dart/site/try/src/interaction_manager.dart
index 4fc39a9f836ff8a9c6a470aba274e4cf9496fff4..7f9e44c3f1ba633f8139b7ecab78abf3c0a27b6a 100644
--- a/dart/site/try/src/interaction_manager.dart
+++ b/dart/site/try/src/interaction_manager.dart
@@ -108,6 +108,9 @@ abstract class InteractionManager {
InteractionManager.internal();
+ // TODO(ahe): Remove this.
+ Set<AnchorElement> get oldDiagnostics;
+
void onInput(Event event);
// TODO(ahe): Rename to onKeyDown (as it is called in response to keydown
@@ -134,6 +137,12 @@ abstract class InteractionManager {
/// Called by [:window.onMessage.listen:].
void onMessage(MessageEvent event);
+
+ void onCompilationDone();
+
+ /// Called when a compilation is starting, but just before sending the
+ /// initiating message to the compiler isolate.
+ void compilationStarting();
}
/**
@@ -160,6 +169,8 @@ class InteractionContext extends InteractionManager {
Completer<String> completeSaveOperation;
+ final Set<AnchorElement> oldDiagnostics = new Set<AnchorElement>();
+
InteractionContext()
: super.internal() {
state = new InitialState(this);
@@ -219,11 +230,20 @@ class InteractionContext extends InteractionManager {
void onHeartbeat(Timer timer) => state.onHeartbeat(timer);
void onMessage(MessageEvent event) => state.onMessage(event);
+
+ void onCompilationDone() => state.onCompilationDone();
+
+ void compilationStarting() => state.compilationStarting();
}
abstract class InteractionState implements InteractionManager {
InteractionContext get context;
+ // TODO(ahe): Remove this.
+ Set<AnchorElement> get oldDiagnostics {
+ throw 'Use context.oldDiagnostics instead';
+ }
+
void set state(InteractionState newState);
void onStateChanged(InteractionState previous) {
@@ -584,6 +604,23 @@ class InitialState extends InteractionState {
void consolePrintLine(data) {
outputDiv.appendText('$data\n');
}
+
+ void onCompilationDone() {
+ for (AnchorElement diagnostic in context.oldDiagnostics) {
+ if (diagnostic.parent != null) {
+ // Problem fixed, remove the diagnostic.
+ diagnostic.replaceWith(new Text(getText(diagnostic)));
+ }
+ }
+ context.oldDiagnostics.clear();
+ observer.takeRecords(); // Discard mutations.
+ }
+
+ void compilationStarting() {
+ context.oldDiagnostics
+ ..clear()
+ ..addAll(mainEditorPane.querySelectorAll('a.diagnostic'));
+ }
}
Future<String> getString(uri) {
« no previous file with comments | « dart/site/try/src/editor.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698