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

Side by Side Diff: pkg/analysis_server/lib/src/computer/import_elements_computer.dart

Issue 2972833002: Initial implementation of copy/paste support (Closed)
Patch Set: Created 3 years, 5 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) 2017, 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 import 'package:analysis_server/protocol/protocol_generated.dart';
6 import 'package:analyzer/dart/analysis/results.dart';
7 import 'package:analyzer/dart/analysis/session.dart';
8 import 'package:analyzer/dart/element/element.dart';
9 import 'package:analyzer_plugin/protocol/protocol_common.dart';
10 import 'package:analyzer_plugin/utilities/change_builder/change_builder_dart.dar t';
11
12 /**
13 * An object used to compute the edits required to ensure that a list of
14 * elements is imported into a given library.
15 */
16 class ImportElementsComputer {
17 /**
18 * The analysis session used to compute the unit.
19 */
20 final AnalysisSession session;
21
22 /**
23 * The library element representing the library to which the imports are to be
24 * added.
25 */
26 final LibraryElement libraryElement;
27
28 /**
29 * The path of the defining compilation unit of the library.
30 */
31 final String path;
32
33 /**
34 * The elements that are to be imported into the library.
35 */
36 final List<ImportedElements> elements;
37
38 /**
39 * Initialize a newly created computer to compute the edits required to ensure
40 * that the given list of [elements] is imported into a given [library].
41 */
42 ImportElementsComputer(ResolveResult result, this.path, this.elements)
43 : session = result.session,
44 libraryElement = result.libraryElement;
45
46 /**
47 * Compute and return the list of edits.
48 */
49 List<SourceEdit> compute() {
50 DartChangeBuilder builder = new DartChangeBuilder(session);
51 builder.addFileEdit(path, (DartFileEditBuilder builder) {});
devoncarew 2017/07/05 20:54:59 This is the stub implementation? Perhaps provide a
Brian Wilkerson 2017/07/05 21:01:50 Done
52 return <SourceEdit>[]; // builder.sourceChange
53 }
54 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698