| OLD | NEW |
| 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 } | 196 } |
| 197 } | 197 } |
| 198 | 198 |
| 199 @override | 199 @override |
| 200 visitImportDirective(ImportDirective node) { | 200 visitImportDirective(ImportDirective node) { |
| 201 if (entity == node.asKeyword) { | 201 if (entity == node.asKeyword) { |
| 202 if (node.deferredKeyword == null) { | 202 if (node.deferredKeyword == null) { |
| 203 _addSuggestion(Keyword.DEFERRED, DART_RELEVANCE_HIGH); | 203 _addSuggestion(Keyword.DEFERRED, DART_RELEVANCE_HIGH); |
| 204 } | 204 } |
| 205 } | 205 } |
| 206 if (entity == node.semicolon || node.combinators.contains(entity)) { | 206 // Handle degenerate case where import statement does not have a semicolon |
| 207 // and the cursor is in the uri string |
| 208 if ((entity == node.semicolon && |
| 209 node.uri != null && |
| 210 node.uri.offset + 1 != request.offset) || |
| 211 node.combinators.contains(entity)) { |
| 207 _addImportDirectiveKeywords(node); | 212 _addImportDirectiveKeywords(node); |
| 208 } | 213 } |
| 209 } | 214 } |
| 210 | 215 |
| 211 @override | 216 @override |
| 212 visitInstanceCreationExpression(InstanceCreationExpression node) { | 217 visitInstanceCreationExpression(InstanceCreationExpression node) { |
| 213 if (entity == node.constructorName) { | 218 if (entity == node.constructorName) { |
| 214 // no keywords in 'new ^' expression | 219 // no keywords in 'new ^' expression |
| 215 } else { | 220 } else { |
| 216 super.visitInstanceCreationExpression(node); | 221 super.visitInstanceCreationExpression(node); |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 return false; | 441 return false; |
| 437 } | 442 } |
| 438 AstNode parent = body.parent; | 443 AstNode parent = body.parent; |
| 439 if (parent is ConstructorDeclaration || parent is MethodDeclaration) { | 444 if (parent is ConstructorDeclaration || parent is MethodDeclaration) { |
| 440 return true; | 445 return true; |
| 441 } | 446 } |
| 442 node = parent; | 447 node = parent; |
| 443 } | 448 } |
| 444 } | 449 } |
| 445 } | 450 } |
| OLD | NEW |