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

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

Issue 2542753002: Revert "Transition analyzer and analysis_server to new astFactory; remove old AST factory methods." (Closed)
Patch Set: Created 4 years 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/lib/src/services/completion/dart/label_contributor.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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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.dart.manager; 5 library services.completion.dart.manager;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/plugin/protocol/protocol.dart'; 9 import 'package:analysis_server/plugin/protocol/protocol.dart';
10 import 'package:analysis_server/src/provisional/completion/completion_core.dart' 10 import 'package:analysis_server/src/provisional/completion/completion_core.dart'
11 show CompletionContributor, CompletionRequest; 11 show CompletionContributor, CompletionRequest;
12 import 'package:analysis_server/src/provisional/completion/dart/completion_dart. dart'; 12 import 'package:analysis_server/src/provisional/completion/dart/completion_dart. dart';
13 import 'package:analysis_server/src/provisional/completion/dart/completion_plugi n.dart'; 13 import 'package:analysis_server/src/provisional/completion/dart/completion_plugi n.dart';
14 import 'package:analysis_server/src/provisional/completion/dart/completion_targe t.dart'; 14 import 'package:analysis_server/src/provisional/completion/dart/completion_targe t.dart';
15 import 'package:analysis_server/src/services/completion/completion_core.dart'; 15 import 'package:analysis_server/src/services/completion/completion_core.dart';
16 import 'package:analysis_server/src/services/completion/completion_performance.d art'; 16 import 'package:analysis_server/src/services/completion/completion_performance.d art';
17 import 'package:analysis_server/src/services/completion/dart/common_usage_sorter .dart'; 17 import 'package:analysis_server/src/services/completion/dart/common_usage_sorter .dart';
18 import 'package:analysis_server/src/services/completion/dart/contribution_sorter .dart'; 18 import 'package:analysis_server/src/services/completion/dart/contribution_sorter .dart';
19 import 'package:analysis_server/src/services/completion/dart/optype.dart'; 19 import 'package:analysis_server/src/services/completion/dart/optype.dart';
20 import 'package:analysis_server/src/services/search/search_engine.dart'; 20 import 'package:analysis_server/src/services/search/search_engine.dart';
21 import 'package:analyzer/dart/ast/ast.dart'; 21 import 'package:analyzer/dart/ast/ast.dart';
22 import 'package:analyzer/dart/ast/standard_ast_factory.dart';
23 import 'package:analyzer/dart/ast/token.dart'; 22 import 'package:analyzer/dart/ast/token.dart';
24 import 'package:analyzer/dart/element/element.dart'; 23 import 'package:analyzer/dart/element/element.dart';
25 import 'package:analyzer/dart/element/type.dart'; 24 import 'package:analyzer/dart/element/type.dart';
26 import 'package:analyzer/exception/exception.dart'; 25 import 'package:analyzer/exception/exception.dart';
27 import 'package:analyzer/file_system/file_system.dart'; 26 import 'package:analyzer/file_system/file_system.dart';
28 import 'package:analyzer/src/context/context.dart' show AnalysisFutureHelper; 27 import 'package:analyzer/src/context/context.dart' show AnalysisFutureHelper;
29 import 'package:analyzer/src/dart/analysis/driver.dart'; 28 import 'package:analyzer/src/dart/analysis/driver.dart';
30 import 'package:analyzer/src/dart/ast/token.dart'; 29 import 'package:analyzer/src/dart/ast/token.dart';
31 import 'package:analyzer/src/generated/engine.dart' hide AnalysisResult; 30 import 'package:analyzer/src/generated/engine.dart' hide AnalysisResult;
32 import 'package:analyzer/src/generated/source.dart'; 31 import 'package:analyzer/src/generated/source.dart';
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 // then check the previous token to see if it should be replaced 509 // then check the previous token to see if it should be replaced
511 token = token.previous; 510 token = token.previous;
512 } 511 }
513 if (token != null && isKeywordOrIdentifier(token)) { 512 if (token != null && isKeywordOrIdentifier(token)) {
514 if (token.offset <= requestOffset && requestOffset <= token.end) { 513 if (token.offset <= requestOffset && requestOffset <= token.end) {
515 // Replacement range for typical identifier completion 514 // Replacement range for typical identifier completion
516 return new ReplacementRange(token.offset, token.length); 515 return new ReplacementRange(token.offset, token.length);
517 } 516 }
518 } 517 }
519 if (token is StringToken) { 518 if (token is StringToken) {
520 SimpleStringLiteral uri = 519 SimpleStringLiteral uri = new SimpleStringLiteral(token, token.lexeme);
521 astFactory.simpleStringLiteral(token, token.lexeme);
522 Keyword keyword = token.previous?.keyword; 520 Keyword keyword = token.previous?.keyword;
523 if (keyword == Keyword.IMPORT || 521 if (keyword == Keyword.IMPORT ||
524 keyword == Keyword.EXPORT || 522 keyword == Keyword.EXPORT ||
525 keyword == Keyword.PART) { 523 keyword == Keyword.PART) {
526 int start = uri.contentsOffset; 524 int start = uri.contentsOffset;
527 var end = uri.contentsEnd; 525 var end = uri.contentsEnd;
528 if (start <= requestOffset && requestOffset <= end) { 526 if (start <= requestOffset && requestOffset <= end) {
529 // Replacement range for import URI 527 // Replacement range for import URI
530 return new ReplacementRange(start, end - start); 528 return new ReplacementRange(start, end - start);
531 } 529 }
532 } 530 }
533 } 531 }
534 } 532 }
535 return new ReplacementRange(requestOffset, 0); 533 return new ReplacementRange(requestOffset, 0);
536 } 534 }
537 } 535 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/services/completion/dart/label_contributor.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698