| 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 errorFixes.fixes.add(fix.change); | 198 errorFixes.fixes.add(fix.change); |
| 199 }); | 199 }); |
| 200 } | 200 } |
| 201 } | 201 } |
| 202 } | 202 } |
| 203 } else { | 203 } else { |
| 204 CompilationUnit unit = await server.getResolvedCompilationUnit(file); | 204 CompilationUnit unit = await server.getResolvedCompilationUnit(file); |
| 205 engine.AnalysisErrorInfo errorInfo = server.getErrors(file); | 205 engine.AnalysisErrorInfo errorInfo = server.getErrors(file); |
| 206 if (errorInfo != null) { | 206 if (errorInfo != null) { |
| 207 LineInfo lineInfo = errorInfo.lineInfo; | 207 LineInfo lineInfo = errorInfo.lineInfo; |
| 208 int requestLine = lineInfo.getLocation(offset).lineNumber; | 208 if (lineInfo != null) { |
| 209 for (engine.AnalysisError error in errorInfo.errors) { | 209 int requestLine = lineInfo.getLocation(offset).lineNumber; |
| 210 int errorLine = lineInfo.getLocation(error.offset).lineNumber; | 210 for (engine.AnalysisError error in errorInfo.errors) { |
| 211 if (errorLine == requestLine) { | 211 int errorLine = lineInfo.getLocation(error.offset).lineNumber; |
| 212 List<Fix> fixes = await computeFixes(server.serverPlugin, | 212 if (errorLine == requestLine) { |
| 213 server.resourceProvider, unit.element.context, error); | 213 List<Fix> fixes = await computeFixes(server.serverPlugin, |
| 214 if (fixes.isNotEmpty) { | 214 server.resourceProvider, unit.element.context, error); |
| 215 AnalysisError serverError = | 215 if (fixes.isNotEmpty) { |
| 216 newAnalysisError_fromEngine(lineInfo, error); | 216 AnalysisError serverError = |
| 217 AnalysisErrorFixes errorFixes = | 217 newAnalysisError_fromEngine(lineInfo, error); |
| 218 new AnalysisErrorFixes(serverError); | 218 AnalysisErrorFixes errorFixes = |
| 219 errorFixesList.add(errorFixes); | 219 new AnalysisErrorFixes(serverError); |
| 220 fixes.forEach((fix) { | 220 errorFixesList.add(errorFixes); |
| 221 errorFixes.fixes.add(fix.change); | 221 fixes.forEach((fix) { |
| 222 }); | 222 errorFixes.fixes.add(fix.change); |
| 223 }); |
| 224 } |
| 223 } | 225 } |
| 224 } | 226 } |
| 225 } | 227 } |
| 226 } | 228 } |
| 227 } | 229 } |
| 228 | 230 |
| 229 // Send the response. | 231 // Send the response. |
| 230 server.sendResponse( | 232 server.sendResponse( |
| 231 new EditGetFixesResult(errorFixesList).toResponse(request.id)); | 233 new EditGetFixesResult(errorFixesList).toResponse(request.id)); |
| 232 } | 234 } |
| (...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 } | 936 } |
| 935 return new RefactoringStatus(); | 937 return new RefactoringStatus(); |
| 936 } | 938 } |
| 937 } | 939 } |
| 938 | 940 |
| 939 /** | 941 /** |
| 940 * [_RefactoringManager] throws instances of this class internally to stop | 942 * [_RefactoringManager] throws instances of this class internally to stop |
| 941 * processing in a manager that was reset. | 943 * processing in a manager that was reset. |
| 942 */ | 944 */ |
| 943 class _ResetError {} | 945 class _ResetError {} |
| OLD | NEW |