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

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

Issue 465843002: respect show/hide combinators when generating suggestions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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';
(...skipping 27 matching lines...) Expand all
38 computeFull(); 38 computeFull();
39 } 39 }
40 } 40 }
41 41
42 /** 42 /**
43 * Compute suggestions based upon cached information only 43 * Compute suggestions based upon cached information only
44 * then send an initial response to the client. 44 * then send an initial response to the client.
45 */ 45 */
46 void computeFast() { 46 void computeFast() {
47 CompilationUnit unit = context.parseCompilationUnit(source); 47 CompilationUnit unit = context.parseCompilationUnit(source);
48 computers.removeWhere((c) => c.computeFast(unit, suggestions)); 48 AstNode node = new NodeLocator.con1(offset).searchWithin(unit);
49 computers.removeWhere((c) => c.computeFast(unit, node, suggestions));
49 sendResults(computers.isEmpty); 50 sendResults(computers.isEmpty);
50 } 51 }
51 52
52 /** 53 /**
53 * If there is remaining work to be done, then wait for the unit to be 54 * If there is remaining work to be done, then wait for the unit to be
54 * resolved and request that each remaining computer finish their work. 55 * resolved and request that each remaining computer finish their work.
55 */ 56 */
56 void computeFull() { 57 void computeFull() {
57 waitForAnalysis().then((CompilationUnit unit) { 58 waitForAnalysis().then((CompilationUnit unit) {
58 if (unit == null) { 59 if (unit == null) {
59 sendResults(true); 60 sendResults(true);
60 return; 61 return;
61 } 62 }
63 AstNode node = new NodeLocator.con1(offset).searchWithin(unit);
62 int count = computers.length; 64 int count = computers.length;
63 computers.forEach((c) { 65 computers.forEach((c) {
64 c.computeFull(unit, suggestions).then((bool changed) { 66 c.computeFull(unit, node, suggestions).then((bool changed) {
65 var last = --count == 0; 67 var last = --count == 0;
66 if (changed || last) { 68 if (changed || last) {
67 sendResults(last); 69 sendResults(last);
68 } 70 }
69 }); 71 });
70 }); 72 });
71 }); 73 });
72 } 74 }
73 75
74 /** 76 /**
(...skipping 30 matching lines...) Expand all
105 if (library != null) { 107 if (library != null) {
106 var unit = context.getResolvedCompilationUnit(source, library); 108 var unit = context.getResolvedCompilationUnit(source, library);
107 if (unit != null) { 109 if (unit != null) {
108 return new Future.value(unit); 110 return new Future.value(unit);
109 } 111 }
110 } 112 }
111 //TODO (danrubel) Determine if analysis is complete but unit not resolved 113 //TODO (danrubel) Determine if analysis is complete but unit not resolved
112 return new Future(waitForAnalysis); 114 return new Future(waitForAnalysis);
113 } 115 }
114 } 116 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698