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

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

Issue 1276273003: suggest import uris when import is only text in file (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: merge Created 5 years, 4 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/lib/src/services/completion/keyword_contributor.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 574931b90149738f5d7565e4991c0c2df7d3030a..65ed8df54cd6fe49303a8dc6ab303de8da5ed520 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
@@ -49,6 +49,20 @@ class _ImportUriSuggestionBuilder extends SimpleAstVisitor {
}
@override
+ visitImportDirective(ImportDirective node) {
+ StringLiteral uri = node.uri;
+ if (uri is SimpleStringLiteral) {
+ int offset = request.offset;
+ if (uri.offset < offset &&
+ (offset < uri.end || offset == uri.offset + 1)) {
+ // Handle degenerate case where import is only line in file
+ // and there is no semicolon
+ visitSimpleStringLiteral(uri);
+ }
+ }
+ }
+
+ @override
visitSimpleStringLiteral(SimpleStringLiteral node) {
AstNode parent = node.parent;
if (parent is ImportDirective && parent.uri == node) {
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/services/completion/keyword_contributor.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698