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

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

Issue 454403003: local code completion suggestions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge and address comments 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/top_level_computer.dart'; 12 import 'package:analysis_services/src/completion/top_level_computer.dart';
13 import 'package:analyzer/src/generated/ast.dart'; 13 import 'package:analyzer/src/generated/ast.dart';
14 import 'package:analyzer/src/generated/element.dart'; 14 import 'package:analyzer/src/generated/element.dart';
15 import 'package:analyzer/src/generated/engine.dart'; 15 import 'package:analyzer/src/generated/engine.dart';
16 import 'package:analyzer/src/generated/source.dart'; 16 import 'package:analyzer/src/generated/source.dart';
17 import 'package:analysis_services/src/completion/local_computer.dart';
17 18
18 /** 19 /**
19 * Manages code completion for a given Dart file completion request. 20 * Manages code completion for a given Dart file completion request.
20 */ 21 */
21 class DartCompletionManager extends CompletionManager { 22 class DartCompletionManager extends CompletionManager {
22 final AnalysisContext context; 23 final AnalysisContext context;
23 final Source source; 24 final Source source;
24 final int offset; 25 final int offset;
25 final SearchEngine searchEngine; 26 final SearchEngine searchEngine;
26 final List<CompletionSuggestion> suggestions = []; 27 final List<CompletionSuggestion> suggestions = [];
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 }); 69 });
69 }); 70 });
70 }); 71 });
71 } 72 }
72 73
73 /** 74 /**
74 * Build and initialize the list of completion computers 75 * Build and initialize the list of completion computers
75 */ 76 */
76 void initComputers() { 77 void initComputers() {
77 if (computers == null) { 78 if (computers == null) {
78 computers = [new TopLevelComputer()]; 79 computers = [new LocalComputer(), new TopLevelComputer()];
79 } 80 }
80 computers.forEach((CompletionComputer c) { 81 computers.forEach((CompletionComputer c) {
81 c.context = context; 82 c.context = context;
82 c.source = source; 83 c.source = source;
83 c.offset = offset; 84 c.offset = offset;
84 c.searchEngine = searchEngine; 85 c.searchEngine = searchEngine;
85 }); 86 });
86 } 87 }
87 88
88 /** 89 /**
(...skipping 15 matching lines...) Expand all
104 if (library != null) { 105 if (library != null) {
105 var unit = context.getResolvedCompilationUnit(source, library); 106 var unit = context.getResolvedCompilationUnit(source, library);
106 if (unit != null) { 107 if (unit != null) {
107 return new Future.value(unit); 108 return new Future.value(unit);
108 } 109 }
109 } 110 }
110 //TODO (danrubel) Determine if analysis is complete but unit not resolved 111 //TODO (danrubel) Determine if analysis is complete but unit not resolved
111 return new Future(waitForAnalysis); 112 return new Future(waitForAnalysis);
112 } 113 }
113 } 114 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/domain_completion_test.dart ('k') | pkg/analysis_services/lib/src/completion/local_computer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698