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

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

Issue 465843002: respect show/hide combinators when generating suggestions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 services.completion.computer.dart.local; 5 library services.completion.computer.dart.local;
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:analyzer/src/generated/ast.dart'; 11 import 'package:analyzer/src/generated/ast.dart';
12 12
13 /** 13 /**
14 * A computer for calculating `completion.getSuggestions` request results 14 * A computer for calculating `completion.getSuggestions` request results
15 * for the local library in which the completion is requested. 15 * for the local library in which the completion is requested.
16 */ 16 */
17 class LocalComputer extends CompletionComputer { 17 class LocalComputer extends CompletionComputer {
18 18
19 @override 19 @override
20 bool computeFast(CompilationUnit unit, 20 bool computeFast(CompilationUnit unit, AstNode node,
21 List<CompletionSuggestion> suggestions) { 21 List<CompletionSuggestion> suggestions) {
22 22
23 // Find the specific child [AstNode] that contains the completion offset 23 // Find the specific child [AstNode] that contains the completion offset
24 // and collect suggestions starting with that node 24 // and collect suggestions starting with that node
25 AstNode node = new NodeLocator.con1(offset).searchWithin(unit);
26 if (node != null) { 25 if (node != null) {
27 node.accept(new _LocalVisitor(offset, suggestions)); 26 node.accept(new _LocalVisitor(offset, suggestions));
28 } 27 }
29 28
30 // If the unit is not a part and does not reference any parts 29 // If the unit is not a part and does not reference any parts
31 // then work is complete 30 // then work is complete
32 return !unit.directives.any( 31 return !unit.directives.any(
33 (Directive directive) => 32 (Directive directive) =>
34 directive is PartOfDirective || directive is PartDirective); 33 directive is PartOfDirective || directive is PartDirective);
35 } 34 }
36 35
37 @override 36 @override
38 Future<bool> computeFull(CompilationUnit unit, 37 Future<bool> computeFull(CompilationUnit unit, AstNode node,
39 List<CompletionSuggestion> suggestions) { 38 List<CompletionSuggestion> suggestions) {
40 // TODO: implement computeFull 39 // TODO: implement computeFull
41 // include results from part files that are included in the library 40 // include results from part files that are included in the library
42 return new Future.value(false); 41 return new Future.value(false);
43 } 42 }
44 } 43 }
45 44
46 /** 45 /**
47 * A visitor for collecting suggestions from the most specific child [AstNode] 46 * A visitor for collecting suggestions from the most specific child [AstNode]
48 * that contains the completion offset to the [CompilationUnit]. 47 * that contains the completion offset to the [CompilationUnit].
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 addSuggestion(param.identifier, CompletionSuggestionKind.PARAMETER); 172 addSuggestion(param.identifier, CompletionSuggestionKind.PARAMETER);
174 } 173 }
175 }); 174 });
176 visitNode(node); 175 visitNode(node);
177 } 176 }
178 177
179 visitNode(AstNode node) { 178 visitNode(AstNode node) {
180 node.parent.accept(this); 179 node.parent.accept(this);
181 } 180 }
182 } 181 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698