Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 30151a6

Browse files
pqcommit-bot@chromium.org
authored andcommitted
wait for SDK suggestions
Change-Id: I7439daff3bf828406520a5a3c061928695258c84 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135240 Commit-Queue: Phil Quitslund <pquitslund@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
1 parent f352f9e commit 30151a6

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

pkg/analysis_server/test/client/completion_driver_test.dart

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,21 @@ abstract class AbstractCompletionDriverTest with ResourceProviderMixin {
4747
}
4848

4949
Future<List<CompletionSuggestion>> getSuggestions() async {
50+
if (supportsAvailableSuggestions) {
51+
// todo (pq): consider moving
52+
const internalLibs = [
53+
'dart:async2',
54+
'dart:_interceptors',
55+
'dart:_internal',
56+
];
57+
for (var lib in driver.sdk.sdkLibraries) {
58+
var uri = lib.shortName;
59+
if (!internalLibs.contains(uri)) {
60+
await driver.waitForSetWithUri(uri);
61+
}
62+
}
63+
}
64+
5065
suggestions = await driver.getSuggestions();
5166
return suggestions;
5267
}
@@ -177,7 +192,26 @@ void main() {
177192
}
178193
''');
179194

180-
// todo (pq): replace with a "real test"; this just proves we're getting end to end.
195+
// A set of SDK suggestions.
196+
expect(
197+
// from dart:async (StreamSubscription)
198+
suggestionWith(
199+
completion: 'asFuture', kind: CompletionSuggestionKind.INVOCATION),
200+
isNotNull);
201+
202+
expect(
203+
// from dart:core
204+
suggestionWith(
205+
completion: 'print', kind: CompletionSuggestionKind.INVOCATION),
206+
isNotNull);
207+
208+
expect(
209+
// from dart:collection (ListMixin)
210+
suggestionWith(
211+
completion: 'firstWhere',
212+
kind: CompletionSuggestionKind.INVOCATION),
213+
isNotNull);
214+
181215
expect(
182216
// from dart:math
183217
suggestionWith(

pkg/analysis_server/test/client/impl/abstract_client.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ abstract class AbstractClient {
3535
final String testFilePath;
3636
String testCode;
3737

38+
MockSdk sdk;
39+
3840
AbstractClient({
3941
@required this.projectPath,
4042
@required this.testFilePath,
@@ -100,7 +102,7 @@ abstract class AbstractClient {
100102

101103
/// Create an analysis server with the given [sdkPath].
102104
AnalysisServer createAnalysisServer(String sdkPath) {
103-
MockSdk(resourceProvider: resourceProvider);
105+
sdk = MockSdk(resourceProvider: resourceProvider);
104106
var options = AnalysisServerOptions();
105107
return AnalysisServer(serverChannel, resourceProvider, options,
106108
DartSdkManager(sdkPath, true), InstrumentationService.NULL_SERVICE);

0 commit comments

Comments
 (0)