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

Side by Side Diff: pkg/analysis_services/lib/src/completion/dart_completion_manager.dart

Issue 471143002: first incomplete cut at invocation/accessor suggestions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library test.services.completion.dart; 5 library test.services.completion.dart;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_services/completion/completion_computer.dart'; 9 import 'package:analysis_services/completion/completion_computer.dart';
10 import 'package:analysis_services/completion/completion_suggestion.dart'; 10 import 'package:analysis_services/completion/completion_suggestion.dart';
11 import 'package:analysis_services/search/search_engine.dart'; 11 import 'package:analysis_services/search/search_engine.dart';
12 import 'package:analysis_services/src/completion/imported_type_computer.dart'; 12 import 'package:analysis_services/src/completion/imported_type_computer.dart';
13 import 'package:analysis_services/src/completion/invocation_computer.dart';
14 import 'package:analysis_services/src/completion/local_computer.dart';
13 import 'package:analyzer/src/generated/ast.dart'; 15 import 'package:analyzer/src/generated/ast.dart';
14 import 'package:analyzer/src/generated/element.dart'; 16 import 'package:analyzer/src/generated/element.dart';
15 import 'package:analyzer/src/generated/engine.dart'; 17 import 'package:analyzer/src/generated/engine.dart';
16 import 'package:analyzer/src/generated/source.dart'; 18 import 'package:analyzer/src/generated/source.dart';
17 import 'package:analysis_services/src/completion/local_computer.dart';
18 19
19 /** 20 /**
20 * Manages code completion for a given Dart file completion request. 21 * Manages code completion for a given Dart file completion request.
21 */ 22 */
22 class DartCompletionManager extends CompletionManager { 23 class DartCompletionManager extends CompletionManager {
23 final AnalysisContext context; 24 final AnalysisContext context;
24 final Source source; 25 final Source source;
25 final int offset; 26 final int offset;
26 final SearchEngine searchEngine; 27 final SearchEngine searchEngine;
27 final List<CompletionSuggestion> suggestions = []; 28 final List<CompletionSuggestion> suggestions = [];
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 }); 72 });
72 }); 73 });
73 }); 74 });
74 } 75 }
75 76
76 /** 77 /**
77 * Build and initialize the list of completion computers 78 * Build and initialize the list of completion computers
78 */ 79 */
79 void initComputers() { 80 void initComputers() {
80 if (computers == null) { 81 if (computers == null) {
81 computers = [new LocalComputer(), new ImportedTypeComputer()]; 82 computers = [
83 new LocalComputer(),
84 new ImportedTypeComputer(),
85 new InvocationComputer()];
82 } 86 }
83 computers.forEach((CompletionComputer c) { 87 computers.forEach((CompletionComputer c) {
84 c.context = context; 88 c.context = context;
85 c.source = source; 89 c.source = source;
86 c.offset = offset; 90 c.offset = offset;
87 c.searchEngine = searchEngine; 91 c.searchEngine = searchEngine;
88 }); 92 });
89 } 93 }
90 94
91 /** 95 /**
(...skipping 15 matching lines...) Expand all
107 if (library != null) { 111 if (library != null) {
108 var unit = context.getResolvedCompilationUnit(source, library); 112 var unit = context.getResolvedCompilationUnit(source, library);
109 if (unit != null) { 113 if (unit != null) {
110 return new Future.value(unit); 114 return new Future.value(unit);
111 } 115 }
112 } 116 }
113 //TODO (danrubel) Determine if analysis is complete but unit not resolved 117 //TODO (danrubel) Determine if analysis is complete but unit not resolved
114 return new Future(waitForAnalysis); 118 return new Future(waitForAnalysis);
115 } 119 }
116 } 120 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698