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

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

Issue 1963323003: More tweaks for 'for' completion. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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
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.contributor.dart.local_lib; 5 library services.completion.contributor.dart.local_lib;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/provisional/completion/dart/completion_dart. dart'; 9 import 'package:analysis_server/src/provisional/completion/dart/completion_dart. dart';
10 import 'package:analysis_server/src/services/completion/dart/completion_manager. dart'; 10 import 'package:analysis_server/src/services/completion/dart/completion_manager. dart';
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 } 105 }
106 } 106 }
107 107
108 @override 108 @override
109 void visitLibraryElement(LibraryElement element) { 109 void visitLibraryElement(LibraryElement element) {
110 element.visitChildren(this); 110 element.visitChildren(this);
111 } 111 }
112 112
113 @override 113 @override
114 void visitPropertyAccessorElement(PropertyAccessorElement element) { 114 void visitPropertyAccessorElement(PropertyAccessorElement element) {
115 int relevance; 115 if (optype.includeReturnValueSuggestions) {
116 if (element.library == containingLibrary) { 116 int relevance;
117 if (element.enclosingElement is ClassElement) { 117 if (element.library == containingLibrary) {
118 relevance = DART_RELEVANCE_LOCAL_FIELD; 118 if (element.enclosingElement is ClassElement) {
119 relevance = DART_RELEVANCE_LOCAL_FIELD;
120 } else {
121 relevance = DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE;
122 }
119 } else { 123 } else {
120 relevance = DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE; 124 relevance = DART_RELEVANCE_DEFAULT;
121 } 125 }
122 } else { 126 addSuggestion(element, prefix: prefix, relevance: relevance);
123 relevance = DART_RELEVANCE_DEFAULT;
124 } 127 }
125 addSuggestion(element, prefix: prefix, relevance: relevance);
126 } 128 }
127 129
128 @override 130 @override
129 void visitTopLevelVariableElement(TopLevelVariableElement element) { 131 void visitTopLevelVariableElement(TopLevelVariableElement element) {
130 if (optype.includeReturnValueSuggestions) { 132 if (optype.includeReturnValueSuggestions) {
131 int relevance = element.library == containingLibrary 133 int relevance = element.library == containingLibrary
132 ? DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE 134 ? DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE
133 : DART_RELEVANCE_DEFAULT; 135 : DART_RELEVANCE_DEFAULT;
134 addSuggestion(element, prefix: prefix, relevance: relevance); 136 addSuggestion(element, prefix: prefix, relevance: relevance);
135 } 137 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 LibraryElementSuggestionBuilder visitor = 193 LibraryElementSuggestionBuilder visitor =
192 new LibraryElementSuggestionBuilder(request, optype); 194 new LibraryElementSuggestionBuilder(request, optype);
193 for (CompilationUnitElement unit in libraryUnits) { 195 for (CompilationUnitElement unit in libraryUnits) {
194 if (unit != null && unit.source != request.source) { 196 if (unit != null && unit.source != request.source) {
195 unit.accept(visitor); 197 unit.accept(visitor);
196 } 198 }
197 } 199 }
198 return visitor.suggestions; 200 return visitor.suggestions;
199 } 201 }
200 } 202 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698