| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 library domain.analysis; |
| 6 |
| 7 import 'package:analysis_server/src/analysis_server.dart'; |
| 8 import 'package:analysis_server/src/protocol.dart'; |
| 9 |
| 10 /** |
| 11 * Instances of the class [AnalysisDomainHandler] implement a [RequestHandler] |
| 12 * that handles requests in the `analysis` domain. |
| 13 */ |
| 14 class AnalysisDomainHandler implements RequestHandler { |
| 15 /** |
| 16 * The name of the `analysis.getFixes` request. |
| 17 */ |
| 18 static const String GET_FIXES_METHOD = 'analysis.getFixes'; |
| 19 |
| 20 /** |
| 21 * The name of the `analysis.getMinorRefactorings` request. |
| 22 */ |
| 23 static const String GET_MINOR_REFACTORINGS_METHOD = 'analysis.getMinorRefactor
ings'; |
| 24 |
| 25 /** |
| 26 * The name of the `analysis.setAnalysisRoots` request. |
| 27 */ |
| 28 static const String SET_ANALYSIS_ROOTS_METHOD = 'analysis.setAnalysisRoots'; |
| 29 |
| 30 /** |
| 31 * The name of the `analysis.setPriorityFiles` request. |
| 32 */ |
| 33 static const String SET_PRIORITY_FILES_METHOD = 'analysis.setPriorityFiles'; |
| 34 |
| 35 /** |
| 36 * The name of the `analysis.setSubscriptions` request. |
| 37 */ |
| 38 static const String SET_SUBSCRIPTIONS_METHOD = 'analysis.setSubscriptions'; |
| 39 |
| 40 /** |
| 41 * The name of the `analysis.updateContent` request. |
| 42 */ |
| 43 static const String UPDATE_CONTENT_METHOD = 'analysis.updateContent'; |
| 44 |
| 45 /** |
| 46 * The name of the `analysis.updateOptions` request. |
| 47 */ |
| 48 static const String UPDATE_OPTIONS_METHOD = 'analysis.updateOptions'; |
| 49 |
| 50 /** |
| 51 * The name of the `analysis.updateSdks` request. |
| 52 */ |
| 53 static const String UPDATE_SDKS_METHOD = 'analysis.updateSdks'; |
| 54 |
| 55 /** |
| 56 * The name of the `analysis.errors` notification. |
| 57 */ |
| 58 static const String ERRORS_NOTIFICATION = 'analysis.errors'; |
| 59 |
| 60 /** |
| 61 * The name of the `analysis.highlights` notification. |
| 62 */ |
| 63 static const String HIGHLIGHTS_NOTIFICATION = 'analysis.highlights'; |
| 64 |
| 65 /** |
| 66 * The name of the `analysis.navigation` notification. |
| 67 */ |
| 68 static const String NAVIGATION_NOTIFICATION = 'analysis.navigation'; |
| 69 |
| 70 /** |
| 71 * The name of the `analysis.outline` notification. |
| 72 */ |
| 73 static const String OUTLINE_NOTIFICATION = 'analysis.outline'; |
| 74 |
| 75 /** |
| 76 * The name of the `aadded` parameter. |
| 77 */ |
| 78 static const String ADDED_PARAM = 'added'; |
| 79 |
| 80 /** |
| 81 * The name of the `default` parameter. |
| 82 */ |
| 83 static const String DEFAULT_PARAM = 'default'; |
| 84 |
| 85 /** |
| 86 * The name of the `errors` parameter. |
| 87 */ |
| 88 static const String ERRORS_PARAM = 'errors'; |
| 89 |
| 90 /** |
| 91 * The name of the `excluded` parameter. |
| 92 */ |
| 93 static const String EXCLUDED_PARAM = 'excluded'; |
| 94 |
| 95 /** |
| 96 * The name of the `file` parameter. |
| 97 */ |
| 98 static const String FILE_PARAM = 'file'; |
| 99 |
| 100 /** |
| 101 * The name of the `files` parameter. |
| 102 */ |
| 103 static const String FILES_PARAM = 'files'; |
| 104 |
| 105 /** |
| 106 * The name of the `fixes` parameter. |
| 107 */ |
| 108 static const String FIXES_PARAM = 'fixes'; |
| 109 |
| 110 /** |
| 111 * The name of the `included` parameter. |
| 112 */ |
| 113 static const String INCLUDED_PARAM = 'included'; |
| 114 |
| 115 /** |
| 116 * The name of the `length` parameter. |
| 117 */ |
| 118 static const String LENGTH_PARAM = 'length'; |
| 119 |
| 120 /** |
| 121 * The name of the `offset` parameter. |
| 122 */ |
| 123 static const String OFFSET_PARAM = 'offset'; |
| 124 |
| 125 /** |
| 126 * The name of the `options` parameter. |
| 127 */ |
| 128 static const String OPTIONS_PARAM = 'options'; |
| 129 |
| 130 /** |
| 131 * The name of the `outline` parameter. |
| 132 */ |
| 133 static const String OUTLINE_PARAM = 'outline'; |
| 134 |
| 135 /** |
| 136 * The name of the `refactorings` parameter. |
| 137 */ |
| 138 static const String REFACTORINGS_PARAM = 'refactorings'; |
| 139 |
| 140 /** |
| 141 * The name of the `regions` parameter. |
| 142 */ |
| 143 static const String REGIONS_PARAM = 'regions'; |
| 144 |
| 145 /** |
| 146 * The name of the `removed` parameter. |
| 147 */ |
| 148 static const String REMOVED_PARAM = 'removed'; |
| 149 |
| 150 /** |
| 151 * The name of the `subscriptions` parameter. |
| 152 */ |
| 153 static const String SUBSCRIPTIONS_PARAM = 'subscriptions'; |
| 154 |
| 155 /** |
| 156 * The analysis server that is using this handler to process requests. |
| 157 */ |
| 158 final AnalysisServer server; |
| 159 |
| 160 /** |
| 161 * Initialize a newly created handler to handle requests for the given [server
]. |
| 162 */ |
| 163 AnalysisDomainHandler(this.server); |
| 164 |
| 165 @override |
| 166 Response handleRequest(Request request) { |
| 167 try { |
| 168 String requestName = request.method; |
| 169 if (requestName == GET_FIXES_METHOD) { |
| 170 return getFixes(request); |
| 171 } else if (requestName == GET_MINOR_REFACTORINGS_METHOD) { |
| 172 return getMinorRefactorings(request); |
| 173 } else if (requestName == SET_ANALYSIS_ROOTS_METHOD) { |
| 174 return setAnalysisRoots(request); |
| 175 } else if (requestName == SET_PRIORITY_FILES_METHOD) { |
| 176 return setPriorityFiles(request); |
| 177 } else if (requestName == SET_SUBSCRIPTIONS_METHOD) { |
| 178 return setSubscriptions(request); |
| 179 } else if (requestName == UPDATE_CONTENT_METHOD) { |
| 180 return updateContent(request); |
| 181 } else if (requestName == UPDATE_OPTIONS_METHOD) { |
| 182 return updateOptions(request); |
| 183 } else if (requestName == UPDATE_SDKS_METHOD) { |
| 184 return updateSdks(request); |
| 185 } |
| 186 } on RequestFailure catch (exception) { |
| 187 return exception.response; |
| 188 } |
| 189 return null; |
| 190 } |
| 191 |
| 192 Response getFixes(Request request) { |
| 193 // TODO(scheglov) implement |
| 194 return null; |
| 195 } |
| 196 |
| 197 Response getMinorRefactorings(Request request) { |
| 198 // TODO(scheglov) implement |
| 199 return null; |
| 200 } |
| 201 |
| 202 Response setAnalysisRoots(Request request) { |
| 203 // TODO(scheglov) implement |
| 204 return null; |
| 205 } |
| 206 |
| 207 Response setPriorityFiles(Request request) { |
| 208 // TODO(scheglov) implement |
| 209 return null; |
| 210 } |
| 211 |
| 212 Response setSubscriptions(Request request) { |
| 213 // TODO(scheglov) implement |
| 214 return null; |
| 215 } |
| 216 |
| 217 Response updateContent(Request request) { |
| 218 // TODO(scheglov) implement |
| 219 return null; |
| 220 } |
| 221 |
| 222 Response updateOptions(Request request) { |
| 223 // TODO(scheglov) implement |
| 224 return null; |
| 225 } |
| 226 |
| 227 Response updateSdks(Request request) { |
| 228 // TODO(scheglov) implement |
| 229 return null; |
| 230 } |
| 231 } |
| OLD | NEW |