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.importuri; | 5 library services.completion.contributor.dart.importuri; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:core'; | 8 import 'dart:core'; |
9 | 9 |
10 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.
dart'; | 10 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.
dart'; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 int end = uri.end; | 59 int end = uri.end; |
60 if (offset > start) { | 60 if (offset > start) { |
61 if (offset < end) { | 61 if (offset < end) { |
62 // Quoted non-empty string | 62 // Quoted non-empty string |
63 visitSimpleStringLiteral(uri); | 63 visitSimpleStringLiteral(uri); |
64 } else if (offset == end) { | 64 } else if (offset == end) { |
65 if (end == start + 1) { | 65 if (end == start + 1) { |
66 // Quoted empty string | 66 // Quoted empty string |
67 visitSimpleStringLiteral(uri); | 67 visitSimpleStringLiteral(uri); |
68 } else { | 68 } else { |
69 String data = request.source.contents.data; | 69 String data = request.sourceContents; |
70 if (end == data.length) { | 70 if (end == data.length) { |
71 String ch = data[end - 1]; | 71 String ch = data[end - 1]; |
72 if (ch != '"' && ch != "'") { | 72 if (ch != '"' && ch != "'") { |
73 // Insertion point at end of file | 73 // Insertion point at end of file |
74 // and missing closing quote on non-empty string | 74 // and missing closing quote on non-empty string |
75 visitSimpleStringLiteral(uri); | 75 visitSimpleStringLiteral(uri); |
76 } | 76 } |
77 } | 77 } |
78 } | 78 } |
79 } | 79 } |
80 } else if (offset == start && offset == end) { | 80 } else if (offset == start && offset == end) { |
81 String data = request.source.contents.data; | 81 String data = request.sourceContents; |
82 if (end == data.length) { | 82 if (end == data.length) { |
83 String ch = data[end - 1]; | 83 String ch = data[end - 1]; |
84 if (ch == '"' || ch == "'") { | 84 if (ch == '"' || ch == "'") { |
85 // Insertion point at end of file | 85 // Insertion point at end of file |
86 // and missing closing quote on empty string | 86 // and missing closing quote on empty string |
87 visitSimpleStringLiteral(uri); | 87 visitSimpleStringLiteral(uri); |
88 } | 88 } |
89 } | 89 } |
90 } | 90 } |
91 } | 91 } |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 } | 214 } |
215 | 215 |
216 String _extractPartialUri(SimpleStringLiteral node) { | 216 String _extractPartialUri(SimpleStringLiteral node) { |
217 if (request.offset < node.contentsOffset) { | 217 if (request.offset < node.contentsOffset) { |
218 return null; | 218 return null; |
219 } | 219 } |
220 return node.literal.lexeme.substring( | 220 return node.literal.lexeme.substring( |
221 node.contentsOffset - node.offset, request.offset - node.offset); | 221 node.contentsOffset - node.offset, request.offset - node.offset); |
222 } | 222 } |
223 } | 223 } |
OLD | NEW |