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

Side by Side Diff: pkg/analysis_server/lib/src/services/completion/imported_computer.dart

Issue 580623002: add element to completion suggestions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 6 years, 3 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
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/services/completion/local_computer.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 services.completion.computer.dart.toplevel; 5 library services.completion.computer.dart.toplevel;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/protocol.dart' hide Element; 9 import 'package:analysis_server/src/protocol.dart' as protocol show Element, Ele mentKind;
10 import 'package:analysis_server/src/protocol.dart' hide Element, ElementKind;
10 import 'package:analysis_server/src/services/completion/dart_completion_manager. dart'; 11 import 'package:analysis_server/src/services/completion/dart_completion_manager. dart';
11 import 'package:analysis_server/src/services/completion/suggestion_builder.dart' ; 12 import 'package:analysis_server/src/services/completion/suggestion_builder.dart' ;
12 import 'package:analysis_server/src/services/search/search_engine.dart'; 13 import 'package:analysis_server/src/services/search/search_engine.dart';
13 import 'package:analyzer/src/generated/ast.dart'; 14 import 'package:analyzer/src/generated/ast.dart';
14 import 'package:analyzer/src/generated/element.dart'; 15 import 'package:analyzer/src/generated/element.dart';
15 16
16 /** 17 /**
17 * A computer for calculating imported class and top level variable 18 * A computer for calculating imported class and top level variable
18 * `completion.getSuggestions` request results. 19 * `completion.getSuggestions` request results.
19 */ 20 */
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 155
155 CompletionSuggestion suggestion = new CompletionSuggestion( 156 CompletionSuggestion suggestion = new CompletionSuggestion(
156 kind, 157 kind,
157 relevance, 158 relevance,
158 completion, 159 completion,
159 completion.length, 160 completion.length,
160 0, 161 0,
161 element.isDeprecated, 162 element.isDeprecated,
162 false); 163 false);
163 164
165 suggestion.element = new protocol.Element.fromEngine(element);
166
164 DartType type; 167 DartType type;
165 if (element is TopLevelVariableElement) { 168 if (element is TopLevelVariableElement) {
166 type = element.type; 169 type = element.type;
167 } else if (element is FunctionElement) { 170 } else if (element is FunctionElement) {
168 type = element.returnType; 171 type = element.returnType;
169 } 172 }
170 if (type != null) { 173 if (type != null) {
171 String name = type.displayName; 174 String name = type.displayName;
172 if (name != null && name.length > 0 && name != 'dynamic') { 175 if (name != null && name.length > 0 && name != 'dynamic') {
173 suggestion.returnType = name; 176 suggestion.returnType = name;
174 } 177 }
175 } 178 }
176 179
177 request.suggestions.add(suggestion); 180 request.suggestions.add(suggestion);
178 } 181 }
179 } 182 }
180 } 183 }
181 }); 184 });
182 return true; 185 return true;
183 }); 186 });
184 } 187 }
185 } 188 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/services/completion/local_computer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698