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

Unified Diff: pkg/analysis_server/lib/src/services/completion/dart_completion_manager.dart

Issue 807743003: refactor optype to be computed once per refactoring request (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge and address comment Created 6 years 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/lib/src/services/completion/imported_computer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/services/completion/dart_completion_manager.dart
diff --git a/pkg/analysis_server/lib/src/services/completion/dart_completion_manager.dart b/pkg/analysis_server/lib/src/services/completion/dart_completion_manager.dart
index 1264d3064a7a561fb418445167236fa8f99ae57c..5426d294ad60a3b8deefd78f3bc2b8e9779ef4d0 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart_completion_manager.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart_completion_manager.dart
@@ -15,6 +15,7 @@ import 'package:analysis_server/src/services/completion/imported_computer.dart';
import 'package:analysis_server/src/services/completion/invocation_computer.dart';
import 'package:analysis_server/src/services/completion/keyword_computer.dart';
import 'package:analysis_server/src/services/completion/local_computer.dart';
+import 'package:analysis_server/src/services/completion/optype.dart';
import 'package:analysis_server/src/services/search/search_engine.dart';
import 'package:analyzer/src/generated/ast.dart';
import 'package:analyzer/src/generated/engine.dart';
@@ -237,6 +238,11 @@ class DartCompletionRequest extends CompletionRequest {
AstNode node;
/**
+ * Information about the types of suggestions that should be included.
+ */
+ OpType _optype;
+
+ /**
* The offset of the start of the text to be replaced.
* This will be different than the offset used to request the completion
* suggestions if there was a portion of an identifier before the original
@@ -269,6 +275,17 @@ class DartCompletionRequest extends CompletionRequest {
return context.getContents(
source).data.substring(replacementOffset, offset);
}
+
+ /**
+ * Information about the types of suggestions that should be included.
+ * This will return `null` if the [node] has not been set.
+ */
+ OpType get optype {
+ if (_optype == null && node != null) {
+ _optype = new OpType.forCompletion(node, offset);
+ }
+ return _optype;
+ }
}
/**
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/services/completion/imported_computer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698