| 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/src/analysis_server.dart'; |
| 9 import 'package:analysis_server/src/collections.dart'; | 10 import 'package:analysis_server/src/collections.dart'; |
| 10 import 'package:analysis_server/src/analysis_server.dart'; | |
| 11 import 'package:analysis_server/src/constants.dart'; | 11 import 'package:analysis_server/src/constants.dart'; |
| 12 import 'package:analysis_server/src/protocol.dart' hide Element; | 12 import 'package:analysis_server/src/protocol_server.dart' hide Element; |
| 13 import 'package:analysis_server/src/services/correction/assist.dart'; | 13 import 'package:analysis_server/src/services/correction/assist.dart'; |
| 14 import 'package:analysis_server/src/services/correction/fix.dart'; | 14 import 'package:analysis_server/src/services/correction/fix.dart'; |
| 15 import 'package:analysis_server/src/services/correction/sort_members.dart'; | 15 import 'package:analysis_server/src/services/correction/sort_members.dart'; |
| 16 import 'package:analysis_server/src/services/correction/status.dart'; | 16 import 'package:analysis_server/src/services/correction/status.dart'; |
| 17 import 'package:analysis_server/src/services/refactoring/refactoring.dart'; | 17 import 'package:analysis_server/src/services/refactoring/refactoring.dart'; |
| 18 import 'package:analysis_server/src/services/search/search_engine.dart'; | 18 import 'package:analysis_server/src/services/search/search_engine.dart'; |
| 19 import 'package:analyzer/src/generated/ast.dart'; | 19 import 'package:analyzer/src/generated/ast.dart'; |
| 20 import 'package:analyzer/src/generated/element.dart'; | 20 import 'package:analyzer/src/generated/element.dart'; |
| 21 import 'package:analyzer/src/generated/engine.dart' as engine; | 21 import 'package:analyzer/src/generated/engine.dart' as engine; |
| 22 import 'package:analyzer/src/generated/error.dart' as engine; | 22 import 'package:analyzer/src/generated/error.dart' as engine; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 engine.AnalysisErrorInfo errorInfo = server.getErrors(file); | 106 engine.AnalysisErrorInfo errorInfo = server.getErrors(file); |
| 107 if (errorInfo != null) { | 107 if (errorInfo != null) { |
| 108 LineInfo lineInfo = errorInfo.lineInfo; | 108 LineInfo lineInfo = errorInfo.lineInfo; |
| 109 int requestLine = lineInfo.getLocation(offset).lineNumber; | 109 int requestLine = lineInfo.getLocation(offset).lineNumber; |
| 110 for (engine.AnalysisError error in errorInfo.errors) { | 110 for (engine.AnalysisError error in errorInfo.errors) { |
| 111 int errorLine = lineInfo.getLocation(error.offset).lineNumber; | 111 int errorLine = lineInfo.getLocation(error.offset).lineNumber; |
| 112 if (errorLine == requestLine) { | 112 if (errorLine == requestLine) { |
| 113 List<Fix> fixes = computeFixes(searchEngine, unit, error); | 113 List<Fix> fixes = computeFixes(searchEngine, unit, error); |
| 114 if (fixes.isNotEmpty) { | 114 if (fixes.isNotEmpty) { |
| 115 AnalysisError serverError = | 115 AnalysisError serverError = |
| 116 new AnalysisError.fromEngine(lineInfo, error); | 116 newAnalysisError_fromEngine(lineInfo, error); |
| 117 AnalysisErrorFixes errorFixes = | 117 AnalysisErrorFixes errorFixes = |
| 118 new AnalysisErrorFixes(serverError); | 118 new AnalysisErrorFixes(serverError); |
| 119 errorFixesList.add(errorFixes); | 119 errorFixesList.add(errorFixes); |
| 120 fixes.forEach((fix) { | 120 fixes.forEach((fix) { |
| 121 errorFixes.addFix(fix); | 121 errorFixes.fixes.add(fix.change); |
| 122 }); | 122 }); |
| 123 } | 123 } |
| 124 } | 124 } |
| 125 } | 125 } |
| 126 } | 126 } |
| 127 } | 127 } |
| 128 // respond | 128 // respond |
| 129 return new EditGetFixesResult(errorFixesList).toResponse(request.id); | 129 return new EditGetFixesResult(errorFixesList).toResponse(request.id); |
| 130 } | 130 } |
| 131 | 131 |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 } | 491 } |
| 492 if (refactoring is RenameRefactoring) { | 492 if (refactoring is RenameRefactoring) { |
| 493 RenameRefactoring renameRefactoring = refactoring; | 493 RenameRefactoring renameRefactoring = refactoring; |
| 494 RenameOptions renameOptions = params.options; | 494 RenameOptions renameOptions = params.options; |
| 495 renameRefactoring.newName = renameOptions.newName; | 495 renameRefactoring.newName = renameOptions.newName; |
| 496 return renameRefactoring.checkNewName(); | 496 return renameRefactoring.checkNewName(); |
| 497 } | 497 } |
| 498 return new RefactoringStatus(); | 498 return new RefactoringStatus(); |
| 499 } | 499 } |
| 500 } | 500 } |
| OLD | NEW |