| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import 'dart:async'; | 5 import 'dart:async'; |
| 6 | 6 |
| 7 import 'package:analysis_server/plugin/edit/assist/assist_core.dart'; | 7 import 'package:analysis_server/plugin/edit/assist/assist_core.dart'; |
| 8 import 'package:analysis_server/plugin/edit/assist/assist_dart.dart'; | 8 import 'package:analysis_server/plugin/edit/assist/assist_dart.dart'; |
| 9 import 'package:analysis_server/plugin/edit/fix/fix_core.dart'; | 9 import 'package:analysis_server/plugin/edit/fix/fix_core.dart'; |
| 10 import 'package:analysis_server/plugin/edit/fix/fix_dart.dart'; | 10 import 'package:analysis_server/plugin/edit/fix/fix_dart.dart'; |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 AnalysisResult result = await server.getAnalysisResult(file); | 168 AnalysisResult result = await server.getAnalysisResult(file); |
| 169 if (result != null) { | 169 if (result != null) { |
| 170 CompilationUnit unit = result.unit; | 170 CompilationUnit unit = result.unit; |
| 171 CompilationUnitElement compilationUnitElement = | 171 CompilationUnitElement compilationUnitElement = |
| 172 resolutionMap.elementDeclaredByCompilationUnit(unit); | 172 resolutionMap.elementDeclaredByCompilationUnit(unit); |
| 173 DartAssistContext dartAssistContext = new _DartAssistContextForValues( | 173 DartAssistContext dartAssistContext = new _DartAssistContextForValues( |
| 174 compilationUnitElement.source, | 174 compilationUnitElement.source, |
| 175 offset, | 175 offset, |
| 176 length, | 176 length, |
| 177 compilationUnitElement.context, | 177 compilationUnitElement.context, |
| 178 server.getAstProvider(file), |
| 178 unit); | 179 unit); |
| 179 try { | 180 try { |
| 180 AssistProcessor processor = new AssistProcessor(dartAssistContext); | 181 AssistProcessor processor = new AssistProcessor(dartAssistContext); |
| 181 List<Assist> assists = await processor.compute(); | 182 List<Assist> assists = await processor.compute(); |
| 182 for (Assist assist in assists) { | 183 for (Assist assist in assists) { |
| 183 changes.add(assist.change); | 184 changes.add(assist.change); |
| 184 } | 185 } |
| 185 } catch (_) {} | 186 } catch (_) {} |
| 186 } | 187 } |
| 187 // | 188 // |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 @override | 593 @override |
| 593 final int selectionOffset; | 594 final int selectionOffset; |
| 594 | 595 |
| 595 @override | 596 @override |
| 596 final int selectionLength; | 597 final int selectionLength; |
| 597 | 598 |
| 598 @override | 599 @override |
| 599 final engine.AnalysisContext analysisContext; | 600 final engine.AnalysisContext analysisContext; |
| 600 | 601 |
| 601 @override | 602 @override |
| 603 final AstProvider astProvider; |
| 604 |
| 605 @override |
| 602 final CompilationUnit unit; | 606 final CompilationUnit unit; |
| 603 | 607 |
| 604 _DartAssistContextForValues(this.source, this.selectionOffset, | 608 _DartAssistContextForValues(this.source, this.selectionOffset, |
| 605 this.selectionLength, this.analysisContext, this.unit); | 609 this.selectionLength, this.analysisContext, this.astProvider, this.unit); |
| 606 } | 610 } |
| 607 | 611 |
| 608 /** | 612 /** |
| 609 * And implementation of [DartFixContext]. | 613 * And implementation of [DartFixContext]. |
| 610 */ | 614 */ |
| 611 class _DartFixContextImpl implements DartFixContext { | 615 class _DartFixContextImpl implements DartFixContext { |
| 612 @override | 616 @override |
| 613 final ResourceProvider resourceProvider; | 617 final ResourceProvider resourceProvider; |
| 614 | 618 |
| 615 @override | 619 @override |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1078 } | 1082 } |
| 1079 return new RefactoringStatus(); | 1083 return new RefactoringStatus(); |
| 1080 } | 1084 } |
| 1081 } | 1085 } |
| 1082 | 1086 |
| 1083 /** | 1087 /** |
| 1084 * [_RefactoringManager] throws instances of this class internally to stop | 1088 * [_RefactoringManager] throws instances of this class internally to stop |
| 1085 * processing in a manager that was reset. | 1089 * processing in a manager that was reset. |
| 1086 */ | 1090 */ |
| 1087 class _ResetError {} | 1091 class _ResetError {} |
| OLD | NEW |