2
2
// for details. All rights reserved. Use of this source code is governed by a
3
3
// BSD-style license that can be found in the LICENSE file.
4
4
5
- // @dart = 2.9
6
-
7
5
import 'package:analysis_server/src/protocol_server.dart' ;
8
6
import 'package:analysis_server/src/services/completion/completion_core.dart' ;
9
7
import 'package:analysis_server/src/services/completion/completion_performance.dart' ;
@@ -35,7 +33,7 @@ class CiderCompletionComputer {
35
33
final OperationPerformanceImpl _performanceRoot =
36
34
OperationPerformanceImpl ('<root>' );
37
35
38
- DartCompletionRequestImpl _dartCompletionRequest;
36
+ late DartCompletionRequestImpl _dartCompletionRequest;
39
37
40
38
/// Paths of imported libraries for which suggestions were (re)computed
41
39
/// during processing of this request. Does not include libraries that were
@@ -53,10 +51,10 @@ class CiderCompletionComputer {
53
51
///
54
52
/// The [line] and [column] are zero based.
55
53
Future <CiderCompletionResult > compute ({
56
- @ required String path,
57
- @ required int line,
58
- @ required int column,
59
- @visibleForTesting void Function (ResolvedUnitResult ) testResolvedUnit,
54
+ required String path,
55
+ required int line,
56
+ required int column,
57
+ @visibleForTesting void Function (ResolvedUnitResult )? testResolvedUnit,
60
58
}) async {
61
59
return _performanceRoot.runAsync ('completion' , (performance) async {
62
60
var resolvedUnit = performance.run ('resolution' , (performance) {
@@ -147,9 +145,9 @@ class CiderCompletionComputer {
147
145
suggestions: suggestions,
148
146
performance: CiderCompletionPerformance ._(
149
147
file: Duration .zero,
150
- imports: performance.getChild ('imports' ).elapsed,
151
- resolution: performance.getChild ('resolution' ).elapsed,
152
- suggestions: performance.getChild ('suggestions' ).elapsed,
148
+ imports: performance.getChild ('imports' )! .elapsed,
149
+ resolution: performance.getChild ('resolution' )! .elapsed,
150
+ suggestions: performance.getChild ('suggestions' )! .elapsed,
153
151
operations: _performanceRoot.children.first,
154
152
),
155
153
prefixStart: CiderPosition (line, column - filter._pattern.length),
@@ -161,9 +159,9 @@ class CiderCompletionComputer {
161
159
162
160
@Deprecated ('Use compute' )
163
161
Future <CiderCompletionResult > compute2 ({
164
- @ required String path,
165
- @ required int line,
166
- @ required int column,
162
+ required String path,
163
+ required int line,
164
+ required int column,
167
165
}) async {
168
166
return compute (path: path, line: line, column: column);
169
167
}
@@ -184,8 +182,8 @@ class CiderCompletionComputer {
184
182
/// TODO(scheglov) Implement show / hide combinators.
185
183
/// TODO(scheglov) Implement prefixes.
186
184
List <CompletionSuggestion > _importedLibrariesSuggestions ({
187
- @ required LibraryElement target,
188
- @ required OperationPerformanceImpl performance,
185
+ required LibraryElement target,
186
+ required OperationPerformanceImpl performance,
189
187
}) {
190
188
var suggestions = < CompletionSuggestion > [];
191
189
for (var importedLibrary in target.importedLibraries) {
@@ -202,8 +200,8 @@ class CiderCompletionComputer {
202
200
/// Return cached, or compute unprefixed suggestions for all elements
203
201
/// exported from the library.
204
202
List <CompletionSuggestion > _importedLibrarySuggestions ({
205
- @ required LibraryElement element,
206
- @ required OperationPerformanceImpl performance,
203
+ required LibraryElement element,
204
+ required OperationPerformanceImpl performance,
207
205
}) {
208
206
performance.getDataInt ('libraryCount' ).increment ();
209
207
@@ -262,11 +260,11 @@ class CiderCompletionPerformance {
262
260
final OperationPerformance operations;
263
261
264
262
CiderCompletionPerformance ._({
265
- @ required this .file,
266
- @ required this .imports,
267
- @ required this .resolution,
268
- @ required this .suggestions,
269
- @ required this .operations,
263
+ required this .file,
264
+ required this .imports,
265
+ required this .resolution,
266
+ required this .suggestions,
267
+ required this .operations,
270
268
});
271
269
}
272
270
@@ -281,9 +279,9 @@ class CiderCompletionResult {
281
279
final CiderPosition prefixStart;
282
280
283
281
CiderCompletionResult ._({
284
- @ required this .suggestions,
285
- @ required this .performance,
286
- @ required this .prefixStart,
282
+ required this .suggestions,
283
+ required this .performance,
284
+ required this .prefixStart,
287
285
});
288
286
}
289
287
@@ -305,8 +303,8 @@ class _FilterSort {
305
303
final DartCompletionRequestImpl _request;
306
304
final List <CompletionSuggestion > _suggestions;
307
305
308
- FuzzyMatcher _matcher;
309
- String _pattern;
306
+ late FuzzyMatcher _matcher;
307
+ late String _pattern;
310
308
311
309
_FilterSort (this ._request, this ._suggestions);
312
310
0 commit comments