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

Unified Diff: pkg/analysis_services/lib/src/completion/top_level_computer.dart

Issue 458073002: rename and improve imported completion computer (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 6 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
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;
- });
- }
-}

Powered by Google App Engine
This is Rietveld 408576698