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

Side by Side Diff: pkg/analysis_server/lib/completion/completion_dart.dart

Issue 1383313002: Move completion APIs to a private location (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: formatting Created 5 years, 2 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 library analysis_server.completion.completion_dart;
6
7 import 'package:analysis_server/completion/completion_core.dart';
8 import 'package:analysis_server/src/protocol.dart';
9 import 'package:analyzer/src/generated/ast.dart';
10 import 'package:analyzer/src/generated/engine.dart';
11 import 'package:analyzer/src/generated/source.dart';
12 import 'package:analysis_server/completion/dart/completion_target.dart';
13
14 /**
15 * An object used to produce completions for a specific error within a Dart
16 * file. Completion contributors are long-lived objects and must not retain any
17 * state between invocations of [computeSuggestions].
18 *
19 * Clients are expected to subtype this class when implementing plugins.
20 */
21 abstract class DartCompletionContributor extends CompletionContributor {
22 @override
23 List<CompletionSuggestion> computeSuggestions(CompletionRequest request) {
24 if (request is DartCompletionRequest) {
25 return internalComputeSuggestions(request);
26 }
27 AnalysisContext context = request.context;
28 Source source = request.source;
29 List<Source> libraries = context.getLibrariesContaining(source);
30 if (libraries.length < 1) {
31 return null;
32 }
33 // CompilationUnit unit =
34 // context.getResolvedCompilationUnit2(source, libraries[0]);
35 // bool isResolved = true;
36 // if (unit == null) {
37 // // TODO(brianwilkerson) Implement a method for getting a parsed
38 // // compilation unit without parsing the unit if it hasn't been parsed.
39 // unit = context.getParsedCompilationUnit(source);
40 // if (unit == null) {
41 // return null;
42 // }
43 // isResolved = false;
44 // }
45 // DartCompletionRequest dartRequest =
46 // new DartCompletionRequestImpl(request, unit, isResolved);
47 // return internalComputeSuggestions(dartRequest);
48 return null;
49 }
50
51 /**
52 * Compute a list of completion suggestions based on the given completion
53 * [request]. Return the suggestions that were computed.
54 */
55 List<CompletionSuggestion> internalComputeSuggestions(
56 DartCompletionRequest request);
57 }
58
59 /**
60 * The information about a requested list of completions within a Dart file.
61 */
62 abstract class DartCompletionRequest extends CompletionRequest {
63 /**
64 * Return `true` if the compilation [unit] is resolved.
65 */
66 bool get isResolved;
67
68 /**
69 * Return the compilation unit in which the completion was requested.
70 */
71 CompilationUnit get unit;
72
73 /**
74 * Cached information from a prior code completion operation.
75 */
76 //DartCompletionCache get cache;
77
78 /**
79 * Return the completion target. This determines what part of the parse tree
80 * will receive the newly inserted text.
81 */
82 CompletionTarget get target;
83
84 /**
85 * Information about the types of suggestions that should be included.
86 */
87 //OpType get _optype;
88 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698