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

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

Issue 1410893002: Disable completion in comment text. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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; 5 library services.completion.contributor.dart.local;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/plugin/protocol/protocol.dart' as protocol 9 import 'package:analysis_server/plugin/protocol/protocol.dart' as protocol
10 show Element, ElementKind; 10 show Element, ElementKind;
11 import 'package:analysis_server/plugin/protocol/protocol.dart' 11 import 'package:analysis_server/plugin/protocol/protocol.dart'
12 hide Element, ElementKind; 12 hide Element, ElementKind;
13 import 'package:analysis_server/src/services/completion/dart_completion_manager. dart'; 13 import 'package:analysis_server/src/services/completion/dart_completion_manager. dart';
14 import 'package:analysis_server/src/services/completion/local_declaration_visito r.dart'; 14 import 'package:analysis_server/src/services/completion/local_declaration_visito r.dart';
15 import 'package:analysis_server/src/services/completion/local_suggestion_builder .dart'; 15 import 'package:analysis_server/src/services/completion/local_suggestion_builder .dart';
16 import 'package:analysis_server/src/services/completion/optype.dart'; 16 import 'package:analysis_server/src/services/completion/optype.dart';
17 import 'package:analyzer/src/generated/ast.dart'; 17 import 'package:analyzer/src/generated/ast.dart';
18 import 'package:analyzer/src/generated/utilities_dart.dart'; 18 import 'package:analyzer/src/generated/utilities_dart.dart';
19 19
20 /** 20 /**
21 * A contributor for calculating `completion.getSuggestions` request results 21 * A contributor for calculating `completion.getSuggestions` request results
22 * for the local library in which the completion is requested. 22 * for the local library in which the completion is requested.
23 */ 23 */
24 class LocalReferenceContributor extends DartCompletionContributor { 24 class LocalReferenceContributor extends DartCompletionContributor {
25 @override 25 @override
26 bool computeFast(DartCompletionRequest request) { 26 bool computeFast(DartCompletionRequest request) {
27 // Don't suggest in comments.
28 if (request.target.isCommentText) {
29 return true;
30 }
31
27 OpType optype = request.optype; 32 OpType optype = request.optype;
28 33
29 // Collect suggestions from the specific child [AstNode] that contains 34 // Collect suggestions from the specific child [AstNode] that contains
30 // the completion offset and all of its parents recursively. 35 // the completion offset and all of its parents recursively.
31 if (!optype.isPrefixed) { 36 if (!optype.isPrefixed) {
32 if (optype.includeReturnValueSuggestions || 37 if (optype.includeReturnValueSuggestions ||
33 optype.includeTypeNameSuggestions || 38 optype.includeTypeNameSuggestions ||
34 optype.includeVoidReturnSuggestions) { 39 optype.includeVoidReturnSuggestions) {
35 _LocalVisitor localVisitor = 40 _LocalVisitor localVisitor =
36 new _LocalVisitor(request, request.offset, optype); 41 new _LocalVisitor(request, request.offset, optype);
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 bool _isVoid(TypeName returnType) { 592 bool _isVoid(TypeName returnType) {
588 if (returnType != null) { 593 if (returnType != null) {
589 Identifier id = returnType.name; 594 Identifier id = returnType.name;
590 if (id != null && id.name == 'void') { 595 if (id != null && id.name == 'void') {
591 return true; 596 return true;
592 } 597 }
593 } 598 }
594 return false; 599 return false;
595 } 600 }
596 } 601 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698