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' hide Resource; | 8 import 'dart:core' hide Resource; |
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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 114 |
115 String dirPath = resContext.normalize(parentUri); | 115 String dirPath = resContext.normalize(parentUri); |
116 if (resContext.isRelative(dirPath)) { | 116 if (resContext.isRelative(dirPath)) { |
117 String sourceDirPath = resContext.dirname(source.fullName); | 117 String sourceDirPath = resContext.dirname(source.fullName); |
118 if (resContext.isAbsolute(sourceDirPath)) { | 118 if (resContext.isAbsolute(sourceDirPath)) { |
119 dirPath = resContext.join(sourceDirPath, dirPath); | 119 dirPath = resContext.join(sourceDirPath, dirPath); |
120 } else { | 120 } else { |
121 return; | 121 return; |
122 } | 122 } |
123 } | 123 } |
| 124 if (dirPath.endsWith('\\.')) { |
| 125 dirPath = dirPath.substring(0, dirPath.length - 1); |
| 126 } |
124 | 127 |
125 Resource dir = resProvider.getResource(dirPath); | 128 Resource dir = resProvider.getResource(dirPath); |
126 if (dir is Folder) { | 129 if (dir is Folder) { |
127 for (Resource child in dir.getChildren()) { | 130 for (Resource child in dir.getChildren()) { |
128 String completion; | 131 String completion; |
129 if (child is Folder) { | 132 if (child is Folder) { |
130 completion = '$uriPrefix${child.shortName}/'; | 133 completion = '$uriPrefix${child.shortName}/'; |
131 } else { | 134 } else { |
132 completion = '$uriPrefix${child.shortName}'; | 135 completion = '$uriPrefix${child.shortName}'; |
133 } | 136 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 } | 180 } |
178 | 181 |
179 String _extractPartialUri(SimpleStringLiteral node) { | 182 String _extractPartialUri(SimpleStringLiteral node) { |
180 if (request.offset < node.contentsOffset) { | 183 if (request.offset < node.contentsOffset) { |
181 return null; | 184 return null; |
182 } | 185 } |
183 return node.literal.lexeme.substring( | 186 return node.literal.lexeme.substring( |
184 node.contentsOffset - node.offset, request.offset - node.offset); | 187 node.contentsOffset - node.offset, request.offset - node.offset); |
185 } | 188 } |
186 } | 189 } |
OLD | NEW |