| Index: pkg/analysis_server/lib/src/services/completion/dart/uri_contributor.dart
|
| diff --git a/pkg/analysis_server/lib/src/services/completion/dart/uri_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/uri_contributor.dart
|
| index b2b624df2ae4e1064e51b0ddcc5c039fefd38081..d299a8ff560b803402bd5da97da7020f26924c3c 100644
|
| --- a/pkg/analysis_server/lib/src/services/completion/dart/uri_contributor.dart
|
| +++ b/pkg/analysis_server/lib/src/services/completion/dart/uri_contributor.dart
|
| @@ -7,6 +7,8 @@ library services.completion.contributor.dart.importuri;
|
| import 'dart:async';
|
| import 'dart:core';
|
|
|
| +import 'package:analysis_server/src/protocol_server.dart'
|
| + show CompletionSuggestion, CompletionSuggestionKind;
|
| import 'package:analysis_server/src/provisional/completion/dart/completion_dart.dart';
|
| import 'package:analyzer/dart/ast/ast.dart';
|
| import 'package:analyzer/dart/ast/visitor.dart';
|
| @@ -16,9 +18,6 @@ import 'package:analyzer/src/generated/source.dart';
|
| import 'package:path/path.dart' show posix;
|
| import 'package:path/src/context.dart';
|
|
|
| -import '../../../protocol_server.dart'
|
| - show CompletionSuggestion, CompletionSuggestionKind;
|
| -
|
| /**
|
| * A contributor for calculating uri suggestions
|
| * for import and part directives.
|
| @@ -161,32 +160,41 @@ class _UriSuggestionBuilder extends SimpleAstVisitor {
|
|
|
| Resource dir = resProvider.getResource(dirPath);
|
| if (dir is Folder) {
|
| - for (Resource child in dir.getChildren()) {
|
| - String completion;
|
| - if (child is Folder) {
|
| - completion = '$uriPrefix${child.shortName}/';
|
| - } else {
|
| - completion = '$uriPrefix${child.shortName}';
|
| - }
|
| - if (completion != source.shortName) {
|
| - _addSuggestion(completion);
|
| + try {
|
| + for (Resource child in dir.getChildren()) {
|
| + String completion;
|
| + if (child is Folder) {
|
| + completion = '$uriPrefix${child.shortName}/';
|
| + } else {
|
| + completion = '$uriPrefix${child.shortName}';
|
| + }
|
| + if (completion != source.shortName) {
|
| + _addSuggestion(completion);
|
| + }
|
| }
|
| + } on FileSystemException {
|
| + // Guard against I/O exceptions.
|
| }
|
| }
|
| }
|
|
|
| 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)) {
|
| - _addPackageFolderSuggestions(partial, childPrefix, child);
|
| + try {
|
| + for (Resource child in folder.getChildren()) {
|
| + if (child is Folder) {
|
| + String childPrefix = '$prefix${child.shortName}/';
|
| + _addSuggestion(childPrefix);
|
| + if (partial.startsWith(childPrefix)) {
|
| + _addPackageFolderSuggestions(partial, childPrefix, child);
|
| + }
|
| + } else {
|
| + _addSuggestion('$prefix${child.shortName}');
|
| }
|
| - } else {
|
| - _addSuggestion('$prefix${child.shortName}');
|
| }
|
| + } on FileSystemException {
|
| + // Guard against I/O exceptions.
|
| + return;
|
| }
|
| }
|
|
|
|
|