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

Side by Side Diff: pkg/analysis_server/lib/src/provisional/refactoring/refactoring_core.dart

Issue 1387703003: Move refactoring APIs into provisional (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.edit.refactoring.refactoring_core;
6
7 import 'dart:async';
8
9 import 'package:analysis_server/src/protocol.dart';
10 import 'package:analyzer/src/generated/engine.dart';
11 import 'package:analyzer/src/generated/source.dart';
12
13 /**
14 * Abstract interface for all refactorings.
15 */
16 abstract class Refactoring {
17 /**
18 * Return the ids of source edits that are not known to be valid.
19 *
20 * An edit is not known to be valid if there was insufficient type information
21 * for the server to be able to determine whether or not the code needs to be
22 * modified, such as when a member is being renamed and there is a reference
23 * to a member from an unknown type. This field will be omitted if the change
24 * field is omitted or if there are no potential edits for the refactoring.
25 */
26 List<String> get potentialEditIds;
27
28 /**
29 * Return the human readable name of this refactoring.
30 */
31 String get refactoringName;
32
33 /**
34 * Checks all conditions - [checkInitialConditions] and
35 * [checkFinalConditions] to decide if refactoring can be performed.
36 */
37 Future<RefactoringStatus> checkAllConditions();
38
39 /**
40 * Validates environment to check if this refactoring can be performed.
41 *
42 * This check may be slow, because many refactorings use search engine.
43 */
44 Future<RefactoringStatus> checkFinalConditions();
45
46 /**
47 * Validates arguments to check if this refactoring can be performed.
48 *
49 * This check should be quick because it is used often as arguments change.
50 */
51 Future<RefactoringStatus> checkInitialConditions();
52
53 /**
54 * Return the [Change] to apply to perform this refactoring.
55 */
56 Future<SourceChange> createChange();
57
58 /**
59 * Return `true` if the [Change] created by refactoring may be unsafe,
60 * so we want user to review the [Change] to ensure that he understands it.
61 */
62 bool requiresPreview();
63 }
64
65 /**
66 *
67 *
68 * Clients are expected to subtype this class when implementing plugins.
69 */
70 abstract class RefactoringContributor {
71 /**
72 *
73 */
74 Refactoring createRefactoring(AnalysisContext context, RefactoringKind kind,
75 Source source, int offset, int length);
76
77 /**
78 *
79 */
80 List<RefactoringKind> getAvailableRefactorings(
81 AnalysisContext context, Source source, int offset, int length);
82 }
83
84 /**
85 *
86 *
87 * Clients are not expected to subtype this class.
88 */
89 abstract class RefactoringKind {
90 factory RefactoringKind(String name, bool requiresOptions) {
91 } // TODO(brianwilkerson) Redirect to impl class.
92 bool get requiresOptions;
93 }
94
95 /**
96 *
97 *
98 * Clients are not expected to subtype this class.
99 */
100 abstract class RefactoringStatus {
101 // TODO(brianwilkerson) Fill this in.
102 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698