| OLD | NEW |
| 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' |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 token = token.previous; | 477 token = token.previous; |
| 478 } | 478 } |
| 479 if (token != null && isKeywordOrIdentifier(token)) { | 479 if (token != null && isKeywordOrIdentifier(token)) { |
| 480 if (token.offset <= requestOffset && requestOffset <= token.end) { | 480 if (token.offset <= requestOffset && requestOffset <= token.end) { |
| 481 // Replacement range for typical identifier completion | 481 // Replacement range for typical identifier completion |
| 482 return new ReplacementRange(token.offset, token.length); | 482 return new ReplacementRange(token.offset, token.length); |
| 483 } | 483 } |
| 484 } | 484 } |
| 485 if (token is StringToken) { | 485 if (token is StringToken) { |
| 486 SimpleStringLiteral uri = new SimpleStringLiteral(token, token.lexeme); | 486 SimpleStringLiteral uri = new SimpleStringLiteral(token, token.lexeme); |
| 487 Token previous = token.previous; | 487 Keyword keyword = token.previous?.keyword; |
| 488 if (previous is KeywordToken) { | 488 if (keyword == Keyword.IMPORT || |
| 489 Keyword keyword = previous.keyword; | 489 keyword == Keyword.EXPORT || |
| 490 if (keyword == Keyword.IMPORT || | 490 keyword == Keyword.PART) { |
| 491 keyword == Keyword.EXPORT || | 491 int start = uri.contentsOffset; |
| 492 keyword == Keyword.PART) { | 492 var end = uri.contentsEnd; |
| 493 int start = uri.contentsOffset; | 493 if (start <= requestOffset && requestOffset <= end) { |
| 494 var end = uri.contentsEnd; | 494 // Replacement range for import URI |
| 495 if (start <= requestOffset && requestOffset <= end) { | 495 return new ReplacementRange(start, end - start); |
| 496 // Replacement range for import URI | |
| 497 return new ReplacementRange(start, end - start); | |
| 498 } | |
| 499 } | 496 } |
| 500 } | 497 } |
| 501 } | 498 } |
| 502 } | 499 } |
| 503 return new ReplacementRange(requestOffset, 0); | 500 return new ReplacementRange(requestOffset, 0); |
| 504 } | 501 } |
| 505 } | 502 } |
| OLD | NEW |