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

Unified Diff: pkg/analysis_server/lib/src/edit/edit_domain.dart

Issue 526183002: Integrate EXTRACT_LOCAL_VARIABLE into the server. (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
« no previous file with comments | « no previous file | pkg/analysis_server/test/edit/refactoring_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/edit/edit_domain.dart
diff --git a/pkg/analysis_server/lib/src/edit/edit_domain.dart b/pkg/analysis_server/lib/src/edit/edit_domain.dart
index 6f2de75aa8ec58347f24841b5a083e423244f536..759db8dcb3b3322e73f818265657d80ccffa7365 100644
--- a/pkg/analysis_server/lib/src/edit/edit_domain.dart
+++ b/pkg/analysis_server/lib/src/edit/edit_domain.dart
@@ -239,6 +239,13 @@ class _RefactoringManager {
this.offset = offset;
this.length = length;
// create a new Refactoring instance
+ if (kind == RefactoringKind.EXTRACT_LOCAL_VARIABLE) {
+ List<CompilationUnit> units = server.getResolvedCompilationUnits(file);
+ if (units.isNotEmpty) {
+ refactoring = new ExtractLocalRefactoring(units[0], offset, length);
+ feedback = new ExtractLocalVariableFeedback([], [], []);
+ }
+ }
if (kind == RefactoringKind.RENAME) {
List<AstNode> nodes = server.getNodesAtOffset(file, offset);
List<Element> elements = server.getElementsAtOffset(file, offset);
@@ -257,6 +264,13 @@ class _RefactoringManager {
// check initial conditions
return refactoring.checkInitialConditions().then((status) {
initStatus = status;
+ if (refactoring is ExtractLocalRefactoring) {
+ ExtractLocalRefactoring refactoring = this.refactoring;
+ ExtractLocalVariableFeedback feedback = this.feedback;
+ feedback.names = refactoring.names;
+ feedback.offsets = refactoring.offsets;
+ feedback.lengths = refactoring.lengths;
+ }
return initStatus;
});
}
@@ -287,11 +301,17 @@ class _RefactoringManager {
}
RefactoringStatus _setOptions(Object options) {
+ if (refactoring is ExtractLocalRefactoring) {
+ ExtractLocalRefactoring extractRefactoring = refactoring;
+ ExtractLocalVariableOptions extractOptions = options;
+ extractRefactoring.name = extractOptions.name;
+ extractRefactoring.extractAll = extractOptions.extractAll;
+ return extractRefactoring.checkName();
+ }
if (refactoring is RenameRefactoring) {
RenameRefactoring renameRefactoring = refactoring;
RenameOptions renameOptions = options;
- String newName = renameOptions.newName;
- renameRefactoring.newName = newName;
+ renameRefactoring.newName = renameOptions.newName;
return renameRefactoring.checkNewName();
}
return new RefactoringStatus();
« no previous file with comments | « no previous file | pkg/analysis_server/test/edit/refactoring_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698