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

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

Issue 1276843007: suggest "deferred as" rather than "deferred" (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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
« 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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 _addSuggestions([Keyword.FALSE, Keyword.NEW, Keyword.NULL, Keyword.TRUE,]); 348 _addSuggestions([Keyword.FALSE, Keyword.NEW, Keyword.NULL, Keyword.TRUE,]);
349 if (_inClassMemberBody(node)) { 349 if (_inClassMemberBody(node)) {
350 _addSuggestions([Keyword.SUPER, Keyword.THIS,]); 350 _addSuggestions([Keyword.SUPER, Keyword.THIS,]);
351 } 351 }
352 if (_inAsyncMethodOrFunction(node)) { 352 if (_inAsyncMethodOrFunction(node)) {
353 _addSuggestion2(AWAIT); 353 _addSuggestion2(AWAIT);
354 } 354 }
355 } 355 }
356 356
357 void _addImportDirectiveKeywords(ImportDirective node) { 357 void _addImportDirectiveKeywords(ImportDirective node) {
358 if (node.asKeyword == null) { 358 bool hasDeferredKeyword = node.deferredKeyword != null;
359 bool hasAsKeyword = node.asKeyword != null;
360 if (!hasAsKeyword) {
359 _addSuggestion(Keyword.AS, DART_RELEVANCE_HIGH); 361 _addSuggestion(Keyword.AS, DART_RELEVANCE_HIGH);
360 if (node.deferredKeyword == null) { 362 }
363 if (!hasDeferredKeyword) {
364 if (!hasAsKeyword) {
365 _addSuggestion2('deferred as', relevance: DART_RELEVANCE_HIGH);
366 } else if (entity == node.asKeyword) {
361 _addSuggestion(Keyword.DEFERRED, DART_RELEVANCE_HIGH); 367 _addSuggestion(Keyword.DEFERRED, DART_RELEVANCE_HIGH);
362 } 368 }
363 } 369 }
370 if (!hasDeferredKeyword || hasAsKeyword) {
371 if (node.combinators.isEmpty) {
372 _addSuggestion2('show', relevance: DART_RELEVANCE_HIGH);
373 _addSuggestion2('hide', relevance: DART_RELEVANCE_HIGH);
374 }
375 }
364 } 376 }
365 377
366 void _addStatementKeywords(AstNode node) { 378 void _addStatementKeywords(AstNode node) {
367 if (_inClassMemberBody(node)) { 379 if (_inClassMemberBody(node)) {
368 _addSuggestions([Keyword.SUPER, Keyword.THIS,]); 380 _addSuggestions([Keyword.SUPER, Keyword.THIS,]);
369 } 381 }
370 if (_inAsyncMethodOrFunction(node)) { 382 if (_inAsyncMethodOrFunction(node)) {
371 _addSuggestion2(AWAIT); 383 _addSuggestion2(AWAIT);
372 } 384 }
373 _addSuggestions([ 385 _addSuggestions([
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 return false; 436 return false;
425 } 437 }
426 AstNode parent = body.parent; 438 AstNode parent = body.parent;
427 if (parent is ConstructorDeclaration || parent is MethodDeclaration) { 439 if (parent is ConstructorDeclaration || parent is MethodDeclaration) {
428 return true; 440 return true;
429 } 441 }
430 node = parent; 442 node = parent;
431 } 443 }
432 } 444 }
433 } 445 }
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