| 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 library edit.domain; | 5 library edit.domain; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/plugin/edit/assist/assist_core.dart'; | 9 import 'package:analysis_server/plugin/edit/assist/assist_core.dart'; |
| 10 import 'package:analysis_server/plugin/edit/assist/assist_dart.dart'; | 10 import 'package:analysis_server/plugin/edit/assist/assist_dart.dart'; |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 List<AnalysisErrorFixes> errorFixesList = <AnalysisErrorFixes>[]; | 181 List<AnalysisErrorFixes> errorFixesList = <AnalysisErrorFixes>[]; |
| 182 if (server.options.enableNewAnalysisDriver) { | 182 if (server.options.enableNewAnalysisDriver) { |
| 183 AnalysisResult result = await server.getAnalysisResult(file); | 183 AnalysisResult result = await server.getAnalysisResult(file); |
| 184 if (result != null) { | 184 if (result != null) { |
| 185 CompilationUnit unit = result.unit; | 185 CompilationUnit unit = result.unit; |
| 186 LineInfo lineInfo = result.lineInfo; | 186 LineInfo lineInfo = result.lineInfo; |
| 187 int requestLine = lineInfo.getLocation(offset).lineNumber; | 187 int requestLine = lineInfo.getLocation(offset).lineNumber; |
| 188 for (engine.AnalysisError error in result.errors) { | 188 for (engine.AnalysisError error in result.errors) { |
| 189 int errorLine = lineInfo.getLocation(error.offset).lineNumber; | 189 int errorLine = lineInfo.getLocation(error.offset).lineNumber; |
| 190 if (errorLine == requestLine) { | 190 if (errorLine == requestLine) { |
| 191 var context = new _DartFixContextImpl(server.resourceProvider, | 191 var context = new _DartFixContextImpl( |
| 192 (String name) async { | 192 server.resourceProvider, |
| 193 // TODO(scheglov) implement for the new driver | 193 result.driver.getTopLevelNameDeclarations, |
| 194 return []; | 194 unit.element.context, |
| 195 }, unit.element.context, unit, error); | 195 unit, |
| 196 error); |
| 196 List<Fix> fixes = | 197 List<Fix> fixes = |
| 197 await new DefaultFixContributor().internalComputeFixes(context); | 198 await new DefaultFixContributor().internalComputeFixes(context); |
| 198 if (fixes.isNotEmpty) { | 199 if (fixes.isNotEmpty) { |
| 199 AnalysisError serverError = | 200 AnalysisError serverError = |
| 200 newAnalysisError_fromEngine(lineInfo, error); | 201 newAnalysisError_fromEngine(lineInfo, error); |
| 201 AnalysisErrorFixes errorFixes = | 202 AnalysisErrorFixes errorFixes = |
| 202 new AnalysisErrorFixes(serverError); | 203 new AnalysisErrorFixes(serverError); |
| 203 errorFixesList.add(errorFixes); | 204 errorFixesList.add(errorFixes); |
| 204 fixes.forEach((fix) { | 205 fixes.forEach((fix) { |
| 205 errorFixes.fixes.add(fix.change); | 206 errorFixes.fixes.add(fix.change); |
| (...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 959 } | 960 } |
| 960 return new RefactoringStatus(); | 961 return new RefactoringStatus(); |
| 961 } | 962 } |
| 962 } | 963 } |
| 963 | 964 |
| 964 /** | 965 /** |
| 965 * [_RefactoringManager] throws instances of this class internally to stop | 966 * [_RefactoringManager] throws instances of this class internally to stop |
| 966 * processing in a manager that was reset. | 967 * processing in a manager that was reset. |
| 967 */ | 968 */ |
| 968 class _ResetError {} | 969 class _ResetError {} |
| OLD | NEW |