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

Unified Diff: pkg/analysis_server/lib/src/services/completion/import_uri_contributor.dart

Issue 1120113002: fix file uri suggestions on Windows (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/completion/import_uri_contributor_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/services/completion/import_uri_contributor.dart
diff --git a/pkg/analysis_server/lib/src/services/completion/import_uri_contributor.dart b/pkg/analysis_server/lib/src/services/completion/import_uri_contributor.dart
index 4219d900c66a4ad803f5697709691c9b7cf6b400..855185287347f864ff9db1d4ad0e777d2a0d1826 100644
--- a/pkg/analysis_server/lib/src/services/completion/import_uri_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/import_uri_contributor.dart
@@ -85,7 +85,9 @@ class _ImportUriSuggestionBuilder extends SimpleAstVisitor {
Source source = request.source;
String sourceFullName = source.fullName;
String sourceShortName = source.shortName;
- String dirPath = partial.endsWith('/') ? partial : dirname(partial);
+ String dirPath = (partial.endsWith('/') || partial.endsWith(separator))
+ ? partial
+ : dirname(partial);
String prefix = dirPath == '.' ? '' : dirPath;
if (isRelative(dirPath)) {
String sourceDir = dirname(sourceFullName);
@@ -111,13 +113,14 @@ class _ImportUriSuggestionBuilder extends SimpleAstVisitor {
}
}
- void _addFolderSuggestions(String partial, String prefix, Folder folder) {
+ void _addPackageFolderSuggestions(
+ String partial, String prefix, Folder folder) {
for (Resource child in folder.getChildren()) {
if (child is Folder) {
String childPrefix = '$prefix${child.shortName}/';
_addSuggestion(childPrefix);
if (partial.startsWith(childPrefix)) {
- _addFolderSuggestions(partial, childPrefix, child);
+ _addPackageFolderSuggestions(partial, childPrefix, child);
}
} else {
_addSuggestion('$prefix${child.shortName}');
@@ -134,7 +137,7 @@ class _ImportUriSuggestionBuilder extends SimpleAstVisitor {
String prefix = 'package:$pkgName/';
_addSuggestion(prefix);
for (Folder folder in folders) {
- _addFolderSuggestions(partial, prefix, folder);
+ _addPackageFolderSuggestions(partial, prefix, folder);
}
});
}
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/completion/import_uri_contributor_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698