| Index: pkg/analysis_services/lib/src/completion/top_level_computer.dart
|
| diff --git a/pkg/analysis_services/lib/src/completion/top_level_computer.dart b/pkg/analysis_services/lib/src/completion/top_level_computer.dart
|
| deleted file mode 100644
|
| index 536e473776bea44f0408ba9b16fc4e65c540f7a8..0000000000000000000000000000000000000000
|
| --- a/pkg/analysis_services/lib/src/completion/top_level_computer.dart
|
| +++ /dev/null
|
| @@ -1,65 +0,0 @@
|
| -// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
|
| -// for details. All rights reserved. Use of this source code is governed by a
|
| -// BSD-style license that can be found in the LICENSE file.
|
| -
|
| -library services.completion.computer.dart.toplevel;
|
| -
|
| -import 'dart:async';
|
| -
|
| -import 'package:analysis_services/completion/completion_computer.dart';
|
| -import 'package:analysis_services/completion/completion_suggestion.dart';
|
| -import 'package:analysis_services/search/search_engine.dart';
|
| -import 'package:analyzer/src/generated/ast.dart';
|
| -import 'package:analyzer/src/generated/element.dart';
|
| -
|
| -/**
|
| - * A computer for calculating class and top level variable
|
| - * `completion.getSuggestions` request results
|
| - */
|
| -class TopLevelComputer extends CompletionComputer {
|
| -
|
| - @override
|
| - bool computeFast(CompilationUnit unit,
|
| - List<CompletionSuggestion> suggestions) {
|
| - // TODO: implement computeFast
|
| - return false;
|
| - }
|
| -
|
| - @override
|
| - Future<bool> computeFull(CompilationUnit unit,
|
| - List<CompletionSuggestion> suggestions) {
|
| - var future = searchEngine.searchTopLevelDeclarations('');
|
| - return future.then((List<SearchMatch> matches) {
|
| -
|
| - // Compute the set of visible libraries to determine relevance
|
| - var visibleLibraries = new Set<LibraryElement>();
|
| - var unitLibrary = unit.element.library;
|
| - visibleLibraries.add(unitLibrary);
|
| - visibleLibraries.addAll(unitLibrary.importedLibraries);
|
| -
|
| - // Compute the set of possible classes and top level variables
|
| - matches.forEach((SearchMatch match) {
|
| - if (match.kind == MatchKind.DECLARATION) {
|
| - Element element = match.element;
|
| - if (element.isPublic || element.library == unitLibrary) {
|
| - String completion = element.displayName;
|
| - var relevance = visibleLibraries.contains(element.library) ?
|
| - CompletionRelevance.DEFAULT :
|
| - CompletionRelevance.LOW;
|
| - suggestions.add(
|
| - new CompletionSuggestion(
|
| - CompletionSuggestionKind.fromElementKind(element.kind),
|
| - relevance,
|
| - completion,
|
| - completion.length,
|
| - 0,
|
| - element.isDeprecated,
|
| - false // isPotential
|
| - ));
|
| - }
|
| - }
|
| - });
|
| - return true;
|
| - });
|
| - }
|
| -}
|
|
|