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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 _addSuggestions([Keyword.SUPER, Keyword.THIS,]); | 368 _addSuggestions([Keyword.SUPER, Keyword.THIS,]); |
369 } | 369 } |
370 if (_inAsyncMethodOrFunction(node)) { | 370 if (_inAsyncMethodOrFunction(node)) { |
371 _addSuggestion2(AWAIT); | 371 _addSuggestion2(AWAIT); |
372 } | 372 } |
373 _addSuggestions([ | 373 _addSuggestions([ |
374 Keyword.ASSERT, | 374 Keyword.ASSERT, |
375 Keyword.CONTINUE, | 375 Keyword.CONTINUE, |
376 Keyword.DO, | 376 Keyword.DO, |
377 Keyword.FINAL, | 377 Keyword.FINAL, |
378 Keyword.FOR, | 378 //Keyword.FOR, |
379 Keyword.IF, | 379 Keyword.IF, |
380 Keyword.NEW, | 380 Keyword.NEW, |
381 Keyword.RETURN, | 381 Keyword.RETURN, |
382 Keyword.SWITCH, | 382 Keyword.SWITCH, |
383 Keyword.THROW, | 383 Keyword.THROW, |
384 Keyword.TRY, | 384 Keyword.TRY, |
385 Keyword.VAR, | 385 Keyword.VAR, |
386 Keyword.VOID, | 386 Keyword.VOID, |
387 Keyword.WHILE | 387 Keyword.WHILE |
388 ]); | 388 ]); |
| 389 _addSuggestion2('for ()', offset: 5); |
389 _addSuggestion(Keyword.RETHROW, DART_RELEVANCE_KEYWORD - 1); | 390 _addSuggestion(Keyword.RETHROW, DART_RELEVANCE_KEYWORD - 1); |
390 } | 391 } |
391 | 392 |
392 void _addSuggestion(Keyword keyword, | 393 void _addSuggestion(Keyword keyword, |
393 [int relevance = DART_RELEVANCE_KEYWORD]) { | 394 [int relevance = DART_RELEVANCE_KEYWORD]) { |
394 _addSuggestion2(keyword.syntax, relevance: relevance); | 395 _addSuggestion2(keyword.syntax, relevance: relevance); |
395 } | 396 } |
396 | 397 |
397 void _addSuggestion2(String completion, | 398 void _addSuggestion2(String completion, |
398 {int offset, int relevance: DART_RELEVANCE_KEYWORD}) { | 399 {int offset, int relevance: DART_RELEVANCE_KEYWORD}) { |
(...skipping 24 matching lines...) Expand all Loading... |
423 return false; | 424 return false; |
424 } | 425 } |
425 AstNode parent = body.parent; | 426 AstNode parent = body.parent; |
426 if (parent is ConstructorDeclaration || parent is MethodDeclaration) { | 427 if (parent is ConstructorDeclaration || parent is MethodDeclaration) { |
427 return true; | 428 return true; |
428 } | 429 } |
429 node = parent; | 430 node = parent; |
430 } | 431 } |
431 } | 432 } |
432 } | 433 } |
OLD | NEW |