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

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

Issue 484733003: Import analysis_services.dart into analysis_server.dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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/keyword_computer.dart
diff --git a/pkg/analysis_services/lib/src/completion/keyword_computer.dart b/pkg/analysis_services/lib/src/completion/keyword_computer.dart
deleted file mode 100644
index 2d5b120b936c7fc30c09fbab8d4779b5b61a5906..0000000000000000000000000000000000000000
--- a/pkg/analysis_services/lib/src/completion/keyword_computer.dart
+++ /dev/null
@@ -1,80 +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.keyword;
-
-import 'dart:async';
-
-import 'package:analysis_services/completion/completion_suggestion.dart';
-import 'package:analysis_services/src/completion/dart_completion_manager.dart';
-import 'package:analyzer/src/generated/ast.dart';
-import 'package:analyzer/src/generated/scanner.dart';
-
-/**
- * A computer for calculating `completion.getSuggestions` request results
- * for the local library in which the completion is requested.
- */
-class KeywordComputer extends DartCompletionComputer {
-
- @override
- bool computeFast(DartCompletionRequest request) {
- request.node.accept(new _KeywordVisitor(request));
- return true;
- }
-
- @override
- Future<bool> computeFull(DartCompletionRequest request) {
- return new Future.value(false);
- }
-}
-
-/**
- * A vistor for generating keyword suggestions.
- */
-class _KeywordVisitor extends GeneralizingAstVisitor {
- final DartCompletionRequest request;
-
- _KeywordVisitor(this.request);
-
- @override
- visitClassDeclaration(ClassDeclaration node) {
- _addSuggestions([Keyword.EXTENDS, Keyword.IMPLEMENTS, Keyword.WITH]);
- }
-
- @override
- visitCompilationUnit(CompilationUnit node) {
- _addSuggestions(
- [
- Keyword.ABSTRACT,
- Keyword.CLASS,
- Keyword.CONST,
- Keyword.EXPORT,
- Keyword.FINAL,
- Keyword.IMPORT,
- Keyword.LIBRARY,
- Keyword.PART,
- Keyword.TYPEDEF,
- Keyword.VAR]);
- }
-
- @override
- visitNode(AstNode node) {
- // ignored
- }
-
- void _addSuggestions(List<Keyword> keywords) {
- keywords.forEach((Keyword keyword) {
- String completion = keyword.syntax;
- request.suggestions.add(
- new CompletionSuggestion(
- CompletionSuggestionKind.KEYWORD,
- CompletionRelevance.DEFAULT,
- completion,
- completion.length,
- 0,
- false,
- false));
- });
- }
-}

Powered by Google App Engine
This is Rietveld 408576698