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

Unified Diff: pkg/analysis_server/test/services/completion/completion_test_util.dart

Issue 820773002: Introduce CompletionTarget to take the place of the Node being completed. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
Index: pkg/analysis_server/test/services/completion/completion_test_util.dart
diff --git a/pkg/analysis_server/test/services/completion/completion_test_util.dart b/pkg/analysis_server/test/services/completion/completion_test_util.dart
index cf4a551335b1231c1fcb9bb3a8acaa7805f13f13..d597ffaff0c61c1d1fa10b00b5ee6a84c1af78e5 100644
--- a/pkg/analysis_server/test/services/completion/completion_test_util.dart
+++ b/pkg/analysis_server/test/services/completion/completion_test_util.dart
@@ -10,6 +10,7 @@ import 'package:analysis_server/src/protocol.dart' as protocol show Element,
ElementKind;
import 'package:analysis_server/src/protocol.dart' hide Element, ElementKind;
import 'package:analysis_server/src/services/completion/completion_manager.dart';
+import 'package:analysis_server/src/services/completion/completion_target.dart';
import 'package:analysis_server/src/services/completion/dart_completion_cache.dart';
import 'package:analysis_server/src/services/completion/dart_completion_manager.dart';
import 'package:analysis_server/src/services/completion/imported_computer.dart';
@@ -421,6 +422,7 @@ abstract class AbstractCompletionTest extends AbstractContextTest {
new NodeLocator.con1(completionOffset).searchWithin(testUnit);
request.unit = testUnit;
request.node = completionNode;
+ request.target = new CompletionTarget.forOffset(testUnit, completionOffset);
return computer.computeFast(request);
}
@@ -949,46 +951,46 @@ abstract class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
});
}
- test_AssignmentExpression_type_partial() {
+ test_AssignmentExpression_type_newline() {
// SimpleIdentifier TypeName VariableDeclarationList
// VariableDeclarationStatement Block
addTestSource('''
class A {} main() {
int a;
- int^ b = 1;}''');
+ ^
+ b = 1;}''');
computeFast();
return computeFull((bool result) {
assertSuggestLocalClass('A');
assertSuggestImportedClass('int');
- // TODO (danrubel) When entering 1st of 2 identifiers on assignment LHS
- // the user may be either (1) entering a type for the assignment
- // or (2) starting a new statement.
- // Consider suggesting only types
- // if only spaces separates the 1st and 2nd identifiers.
- //assertNotSuggested('a');
- //assertNotSuggested('main');
- //assertNotSuggested('identical');
+ // Allow non-types preceding an identifier on LHS of assignment
+ // if newline follows first identifier
+ // because user is probably starting a new statement
+ assertSuggestLocalVariable('a', 'int');
+ assertSuggestLocalFunction('main', null);
+ assertSuggestImportedFunction('identical', 'bool');
});
}
- test_AssignmentExpression_type_newline() {
+ test_AssignmentExpression_type_partial() {
// SimpleIdentifier TypeName VariableDeclarationList
// VariableDeclarationStatement Block
addTestSource('''
class A {} main() {
int a;
- ^
- b = 1;}''');
+ int^ b = 1;}''');
computeFast();
return computeFull((bool result) {
assertSuggestLocalClass('A');
assertSuggestImportedClass('int');
- // Allow non-types preceding an identifier on LHS of assignment
- // if newline follows first identifier
- // because user is probably starting a new statement
- assertSuggestLocalVariable('a', 'int');
- assertSuggestLocalFunction('main', null);
- assertSuggestImportedFunction('identical', 'bool');
+ // TODO (danrubel) When entering 1st of 2 identifiers on assignment LHS
+ // the user may be either (1) entering a type for the assignment
+ // or (2) starting a new statement.
+ // Consider suggesting only types
+ // if only spaces separates the 1st and 2nd identifiers.
+ //assertNotSuggested('a');
+ //assertNotSuggested('main');
+ //assertNotSuggested('identical');
});
}

Powered by Google App Engine
This is Rietveld 408576698