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

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

Issue 1084233003: suggest this keyword in constructor param list (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 5 years, 8 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/test/services/completion/keyword_contributor_test.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.contributor.dart.keyword; 5 library services.completion.contributor.dart.keyword;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/protocol.dart'; 9 import 'package:analysis_server/src/protocol.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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 Keyword.DYNAMIC, 111 Keyword.DYNAMIC,
112 Keyword.FINAL, 112 Keyword.FINAL,
113 Keyword.TYPEDEF, 113 Keyword.TYPEDEF,
114 Keyword.VAR, 114 Keyword.VAR,
115 Keyword.VOID 115 Keyword.VOID
116 ], DART_RELEVANCE_HIGH); 116 ], DART_RELEVANCE_HIGH);
117 } 117 }
118 } 118 }
119 119
120 @override 120 @override
121 visitFormalParameterList(FormalParameterList node) {
122 AstNode constructorDecl =
123 node.getAncestor((p) => p is ConstructorDeclaration);
124 if (constructorDecl != null) {
125 _addSuggestions([Keyword.THIS]);
126 }
127 }
128
129 @override
121 visitIfStatement(IfStatement node) { 130 visitIfStatement(IfStatement node) {
122 if (entity == node.thenStatement) { 131 if (entity == node.thenStatement) {
123 _addStatementKeywords(node); 132 _addStatementKeywords(node);
124 } 133 }
125 } 134 }
126 135
127 @override 136 @override
128 visitImportDirective(ImportDirective node) { 137 visitImportDirective(ImportDirective node) {
129 if (entity == node.asKeyword) { 138 if (entity == node.asKeyword) {
130 if (node.deferredKeyword == null) { 139 if (node.deferredKeyword == null) {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 return false; 213 return false;
205 } 214 }
206 AstNode parent = body.parent; 215 AstNode parent = body.parent;
207 if (parent is ConstructorDeclaration || parent is MethodDeclaration) { 216 if (parent is ConstructorDeclaration || parent is MethodDeclaration) {
208 return true; 217 return true;
209 } 218 }
210 node = parent; 219 node = parent;
211 } 220 }
212 } 221 }
213 } 222 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/completion/keyword_contributor_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698