| 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 'package:analysis_server/src/analysis_server.dart'; | 7 import 'package:analysis_server/src/analysis_server.dart'; |
| 8 import 'package:analysis_server/src/constants.dart'; | 8 import 'package:analysis_server/src/constants.dart'; |
| 9 import 'package:analysis_server/src/edit/fix.dart'; | 9 import 'package:analysis_server/src/edit/fix.dart'; |
| 10 import 'package:analysis_server/src/protocol.dart'; | 10 import 'package:analysis_server/src/protocol.dart'; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 if (elements.isNotEmpty) { | 83 if (elements.isNotEmpty) { |
| 84 Element element = elements[0]; | 84 Element element = elements[0]; |
| 85 RenameRefactoring renameRefactoring = | 85 RenameRefactoring renameRefactoring = |
| 86 new RenameRefactoring(searchEngine, element); | 86 new RenameRefactoring(searchEngine, element); |
| 87 if (renameRefactoring != null) { | 87 if (renameRefactoring != null) { |
| 88 kinds.add(RefactoringKind.RENAME); | 88 kinds.add(RefactoringKind.RENAME); |
| 89 } | 89 } |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 // respond | 92 // respond |
| 93 return new EditGetAvailableRefactoringsResult(kinds).toResponse(request.id); | 93 return new EditGetAvailableRefactoringsResult(kinds: kinds).toResponse( |
| 94 request.id); |
| 94 } | 95 } |
| 95 | 96 |
| 96 Response getFixes(Request request) { | 97 Response getFixes(Request request) { |
| 97 var params = new EditGetFixesParams.fromRequest(request); | 98 var params = new EditGetFixesParams.fromRequest(request); |
| 98 String file = params.file; | 99 String file = params.file; |
| 99 int offset = params.offset; | 100 int offset = params.offset; |
| 100 // add fixes | 101 // add fixes |
| 101 List<ErrorFixes> errorFixesList = <ErrorFixes>[]; | 102 List<ErrorFixes> errorFixesList = <ErrorFixes>[]; |
| 102 List<CompilationUnit> units = server.getResolvedCompilationUnits(file); | 103 List<CompilationUnit> units = server.getResolvedCompilationUnits(file); |
| 103 for (CompilationUnit unit in units) { | 104 for (CompilationUnit unit in units) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 return getAssists(request); | 137 return getAssists(request); |
| 137 } else if (requestName == EDIT_GET_FIXES) { | 138 } else if (requestName == EDIT_GET_FIXES) { |
| 138 return getFixes(request); | 139 return getFixes(request); |
| 139 } | 140 } |
| 140 } on RequestFailure catch (exception) { | 141 } on RequestFailure catch (exception) { |
| 141 return exception.response; | 142 return exception.response; |
| 142 } | 143 } |
| 143 return null; | 144 return null; |
| 144 } | 145 } |
| 145 } | 146 } |
| OLD | NEW |