| 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 // This file has been automatically generated. Please do not edit it manually. | |
| 6 // To regenerate the file, use the script | |
| 7 // "pkg/analysis_server/tool/spec/generate_files". | |
| 8 | |
| 9 /** | |
| 10 * Convenience methods for running integration tests | |
| 11 */ | |
| 12 library test.integration.methods; | |
| 13 | |
| 14 import 'dart:async'; | |
| 15 | |
| 16 import 'package:analysis_server/plugin/protocol/protocol.dart'; | |
| 17 import 'package:analysis_server/src/protocol/protocol_internal.dart'; | |
| 18 import 'package:test/test.dart'; | |
| 19 | |
| 20 import 'integration_tests.dart'; | |
| 21 import 'protocol_matchers.dart'; | |
| 22 | |
| 23 /** | |
| 24 * Convenience methods for running integration tests | |
| 25 */ | |
| 26 abstract class IntegrationTestMixin { | |
| 27 Server get server; | |
| 28 | |
| 29 /** | |
| 30 * Return the version number of the analysis server. | |
| 31 * | |
| 32 * Returns | |
| 33 * | |
| 34 * version: String | |
| 35 * | |
| 36 * The version number of the analysis server. | |
| 37 */ | |
| 38 Future<ServerGetVersionResult> sendServerGetVersion() async { | |
| 39 var result = await server.send("server.getVersion", null); | |
| 40 ResponseDecoder decoder = new ResponseDecoder(null); | |
| 41 return new ServerGetVersionResult.fromJson(decoder, 'result', result); | |
| 42 } | |
| 43 | |
| 44 /** | |
| 45 * Cleanly shutdown the analysis server. Requests that are received after | |
| 46 * this request will not be processed. Requests that were received before | |
| 47 * this request, but for which a response has not yet been sent, will not be | |
| 48 * responded to. No further responses or notifications will be sent after the | |
| 49 * response to this request has been sent. | |
| 50 */ | |
| 51 Future sendServerShutdown() async { | |
| 52 var result = await server.send("server.shutdown", null); | |
| 53 outOfTestExpect(result, isNull); | |
| 54 return null; | |
| 55 } | |
| 56 | |
| 57 /** | |
| 58 * Subscribe for services. All previous subscriptions are replaced by the | |
| 59 * given set of services. | |
| 60 * | |
| 61 * It is an error if any of the elements in the list are not valid services. | |
| 62 * If there is an error, then the current subscriptions will remain | |
| 63 * unchanged. | |
| 64 * | |
| 65 * Parameters | |
| 66 * | |
| 67 * subscriptions: List<ServerService> | |
| 68 * | |
| 69 * A list of the services being subscribed to. | |
| 70 */ | |
| 71 Future sendServerSetSubscriptions(List<ServerService> subscriptions) async { | |
| 72 var params = new ServerSetSubscriptionsParams(subscriptions).toJson(); | |
| 73 var result = await server.send("server.setSubscriptions", params); | |
| 74 outOfTestExpect(result, isNull); | |
| 75 return null; | |
| 76 } | |
| 77 | |
| 78 /** | |
| 79 * Reports that the server is running. This notification is issued once after | |
| 80 * the server has started running but before any requests are processed to | |
| 81 * let the client know that it started correctly. | |
| 82 * | |
| 83 * It is not possible to subscribe to or unsubscribe from this notification. | |
| 84 * | |
| 85 * Parameters | |
| 86 * | |
| 87 * version: String | |
| 88 * | |
| 89 * The version number of the analysis server. | |
| 90 * | |
| 91 * pid: int | |
| 92 * | |
| 93 * The process id of the analysis server process. | |
| 94 * | |
| 95 * sessionId: String (optional) | |
| 96 * | |
| 97 * The session id for this session. | |
| 98 */ | |
| 99 Stream<ServerConnectedParams> onServerConnected; | |
| 100 | |
| 101 /** | |
| 102 * Stream controller for [onServerConnected]. | |
| 103 */ | |
| 104 StreamController<ServerConnectedParams> _onServerConnected; | |
| 105 | |
| 106 /** | |
| 107 * Reports that an unexpected error has occurred while executing the server. | |
| 108 * This notification is not used for problems with specific requests (which | |
| 109 * are returned as part of the response) but is used for exceptions that | |
| 110 * occur while performing other tasks, such as analysis or preparing | |
| 111 * notifications. | |
| 112 * | |
| 113 * It is not possible to subscribe to or unsubscribe from this notification. | |
| 114 * | |
| 115 * Parameters | |
| 116 * | |
| 117 * isFatal: bool | |
| 118 * | |
| 119 * True if the error is a fatal error, meaning that the server will | |
| 120 * shutdown automatically after sending this notification. | |
| 121 * | |
| 122 * message: String | |
| 123 * | |
| 124 * The error message indicating what kind of error was encountered. | |
| 125 * | |
| 126 * stackTrace: String | |
| 127 * | |
| 128 * The stack trace associated with the generation of the error, used for | |
| 129 * debugging the server. | |
| 130 */ | |
| 131 Stream<ServerErrorParams> onServerError; | |
| 132 | |
| 133 /** | |
| 134 * Stream controller for [onServerError]. | |
| 135 */ | |
| 136 StreamController<ServerErrorParams> _onServerError; | |
| 137 | |
| 138 /** | |
| 139 * Reports the current status of the server. Parameters are omitted if there | |
| 140 * has been no change in the status represented by that parameter. | |
| 141 * | |
| 142 * This notification is not subscribed to by default. Clients can subscribe | |
| 143 * by including the value "STATUS" in the list of services passed in a | |
| 144 * server.setSubscriptions request. | |
| 145 * | |
| 146 * Parameters | |
| 147 * | |
| 148 * analysis: AnalysisStatus (optional) | |
| 149 * | |
| 150 * The current status of analysis, including whether analysis is being | |
| 151 * performed and if so what is being analyzed. | |
| 152 * | |
| 153 * pub: PubStatus (optional) | |
| 154 * | |
| 155 * The current status of pub execution, indicating whether we are currently | |
| 156 * running pub. | |
| 157 */ | |
| 158 Stream<ServerStatusParams> onServerStatus; | |
| 159 | |
| 160 /** | |
| 161 * Stream controller for [onServerStatus]. | |
| 162 */ | |
| 163 StreamController<ServerStatusParams> _onServerStatus; | |
| 164 | |
| 165 /** | |
| 166 * Return the errors associated with the given file. If the errors for the | |
| 167 * given file have not yet been computed, or the most recently computed | |
| 168 * errors for the given file are out of date, then the response for this | |
| 169 * request will be delayed until they have been computed. If some or all of | |
| 170 * the errors for the file cannot be computed, then the subset of the errors | |
| 171 * that can be computed will be returned and the response will contain an | |
| 172 * error to indicate why the errors could not be computed. If the content of | |
| 173 * the file changes after this request was received but before a response | |
| 174 * could be sent, then an error of type CONTENT_MODIFIED will be generated. | |
| 175 * | |
| 176 * This request is intended to be used by clients that cannot asynchronously | |
| 177 * apply updated error information. Clients that can apply error information | |
| 178 * as it becomes available should use the information provided by the | |
| 179 * 'analysis.errors' notification. | |
| 180 * | |
| 181 * If a request is made for a file which does not exist, or which is not | |
| 182 * currently subject to analysis (e.g. because it is not associated with any | |
| 183 * analysis root specified to analysis.setAnalysisRoots), an error of type | |
| 184 * GET_ERRORS_INVALID_FILE will be generated. | |
| 185 * | |
| 186 * Parameters | |
| 187 * | |
| 188 * file: FilePath | |
| 189 * | |
| 190 * The file for which errors are being requested. | |
| 191 * | |
| 192 * Returns | |
| 193 * | |
| 194 * errors: List<AnalysisError> | |
| 195 * | |
| 196 * The errors associated with the file. | |
| 197 */ | |
| 198 Future<AnalysisGetErrorsResult> sendAnalysisGetErrors(String file) async { | |
| 199 var params = new AnalysisGetErrorsParams(file).toJson(); | |
| 200 var result = await server.send("analysis.getErrors", params); | |
| 201 ResponseDecoder decoder = new ResponseDecoder(null); | |
| 202 return new AnalysisGetErrorsResult.fromJson(decoder, 'result', result); | |
| 203 } | |
| 204 | |
| 205 /** | |
| 206 * Return the hover information associate with the given location. If some or | |
| 207 * all of the hover information is not available at the time this request is | |
| 208 * processed the information will be omitted from the response. | |
| 209 * | |
| 210 * Parameters | |
| 211 * | |
| 212 * file: FilePath | |
| 213 * | |
| 214 * The file in which hover information is being requested. | |
| 215 * | |
| 216 * offset: int | |
| 217 * | |
| 218 * The offset for which hover information is being requested. | |
| 219 * | |
| 220 * Returns | |
| 221 * | |
| 222 * hovers: List<HoverInformation> | |
| 223 * | |
| 224 * The hover information associated with the location. The list will be | |
| 225 * empty if no information could be determined for the location. The list | |
| 226 * can contain multiple items if the file is being analyzed in multiple | |
| 227 * contexts in conflicting ways (such as a part that is included in | |
| 228 * multiple libraries). | |
| 229 */ | |
| 230 Future<AnalysisGetHoverResult> sendAnalysisGetHover( | |
| 231 String file, int offset) async { | |
| 232 var params = new AnalysisGetHoverParams(file, offset).toJson(); | |
| 233 var result = await server.send("analysis.getHover", params); | |
| 234 ResponseDecoder decoder = new ResponseDecoder(null); | |
| 235 return new AnalysisGetHoverResult.fromJson(decoder, 'result', result); | |
| 236 } | |
| 237 | |
| 238 /** | |
| 239 * Return the transitive closure of reachable sources for a given file. | |
| 240 * | |
| 241 * If a request is made for a file which does not exist, or which is not | |
| 242 * currently subject to analysis (e.g. because it is not associated with any | |
| 243 * analysis root specified to analysis.setAnalysisRoots), an error of type | |
| 244 * GET_REACHABLE_SOURCES_INVALID_FILE will be generated. | |
| 245 * | |
| 246 * Parameters | |
| 247 * | |
| 248 * file: FilePath | |
| 249 * | |
| 250 * The file for which reachable source information is being requested. | |
| 251 * | |
| 252 * Returns | |
| 253 * | |
| 254 * sources: Map<String, List<String>> | |
| 255 * | |
| 256 * A mapping from source URIs to directly reachable source URIs. For | |
| 257 * example, a file "foo.dart" that imports "bar.dart" would have the | |
| 258 * corresponding mapping { "file:///foo.dart" : ["file:///bar.dart"] }. If | |
| 259 * "bar.dart" has further imports (or exports) there will be a mapping from | |
| 260 * the URI "file:///bar.dart" to them. To check if a specific URI is | |
| 261 * reachable from a given file, clients can check for its presence in the | |
| 262 * resulting key set. | |
| 263 */ | |
| 264 Future<AnalysisGetReachableSourcesResult> sendAnalysisGetReachableSources( | |
| 265 String file) async { | |
| 266 var params = new AnalysisGetReachableSourcesParams(file).toJson(); | |
| 267 var result = await server.send("analysis.getReachableSources", params); | |
| 268 ResponseDecoder decoder = new ResponseDecoder(null); | |
| 269 return new AnalysisGetReachableSourcesResult.fromJson( | |
| 270 decoder, 'result', result); | |
| 271 } | |
| 272 | |
| 273 /** | |
| 274 * Return library dependency information for use in client-side indexing and | |
| 275 * package URI resolution. | |
| 276 * | |
| 277 * Clients that are only using the libraries field should consider using the | |
| 278 * analyzedFiles notification instead. | |
| 279 * | |
| 280 * Returns | |
| 281 * | |
| 282 * libraries: List<FilePath> | |
| 283 * | |
| 284 * A list of the paths of library elements referenced by files in existing | |
| 285 * analysis roots. | |
| 286 * | |
| 287 * packageMap: Map<String, Map<String, List<FilePath>>> | |
| 288 * | |
| 289 * A mapping from context source roots to package maps which map package | |
| 290 * names to source directories for use in client-side package URI | |
| 291 * resolution. | |
| 292 */ | |
| 293 Future<AnalysisGetLibraryDependenciesResult> | |
| 294 sendAnalysisGetLibraryDependencies() async { | |
| 295 var result = await server.send("analysis.getLibraryDependencies", null); | |
| 296 ResponseDecoder decoder = new ResponseDecoder(null); | |
| 297 return new AnalysisGetLibraryDependenciesResult.fromJson( | |
| 298 decoder, 'result', result); | |
| 299 } | |
| 300 | |
| 301 /** | |
| 302 * Return the navigation information associated with the given region of the | |
| 303 * given file. If the navigation information for the given file has not yet | |
| 304 * been computed, or the most recently computed navigation information for | |
| 305 * the given file is out of date, then the response for this request will be | |
| 306 * delayed until it has been computed. If the content of the file changes | |
| 307 * after this request was received but before a response could be sent, then | |
| 308 * an error of type CONTENT_MODIFIED will be generated. | |
| 309 * | |
| 310 * If a navigation region overlaps (but extends either before or after) the | |
| 311 * given region of the file it will be included in the result. This means | |
| 312 * that it is theoretically possible to get the same navigation region in | |
| 313 * response to multiple requests. Clients can avoid this by always choosing a | |
| 314 * region that starts at the beginning of a line and ends at the end of a | |
| 315 * (possibly different) line in the file. | |
| 316 * | |
| 317 * If a request is made for a file which does not exist, or which is not | |
| 318 * currently subject to analysis (e.g. because it is not associated with any | |
| 319 * analysis root specified to analysis.setAnalysisRoots), an error of type | |
| 320 * GET_NAVIGATION_INVALID_FILE will be generated. | |
| 321 * | |
| 322 * Parameters | |
| 323 * | |
| 324 * file: FilePath | |
| 325 * | |
| 326 * The file in which navigation information is being requested. | |
| 327 * | |
| 328 * offset: int | |
| 329 * | |
| 330 * The offset of the region for which navigation information is being | |
| 331 * requested. | |
| 332 * | |
| 333 * length: int | |
| 334 * | |
| 335 * The length of the region for which navigation information is being | |
| 336 * requested. | |
| 337 * | |
| 338 * Returns | |
| 339 * | |
| 340 * files: List<FilePath> | |
| 341 * | |
| 342 * A list of the paths of files that are referenced by the navigation | |
| 343 * targets. | |
| 344 * | |
| 345 * targets: List<NavigationTarget> | |
| 346 * | |
| 347 * A list of the navigation targets that are referenced by the navigation | |
| 348 * regions. | |
| 349 * | |
| 350 * regions: List<NavigationRegion> | |
| 351 * | |
| 352 * A list of the navigation regions within the requested region of the | |
| 353 * file. | |
| 354 */ | |
| 355 Future<AnalysisGetNavigationResult> sendAnalysisGetNavigation( | |
| 356 String file, int offset, int length) async { | |
| 357 var params = new AnalysisGetNavigationParams(file, offset, length).toJson(); | |
| 358 var result = await server.send("analysis.getNavigation", params); | |
| 359 ResponseDecoder decoder = new ResponseDecoder(null); | |
| 360 return new AnalysisGetNavigationResult.fromJson(decoder, 'result', result); | |
| 361 } | |
| 362 | |
| 363 /** | |
| 364 * Force the re-analysis of everything contained in the specified analysis | |
| 365 * roots. This will cause all previously computed analysis results to be | |
| 366 * discarded and recomputed, and will cause all subscribed notifications to | |
| 367 * be re-sent. | |
| 368 * | |
| 369 * If no analysis roots are provided, then all current analysis roots will be | |
| 370 * re-analyzed. If an empty list of analysis roots is provided, then nothing | |
| 371 * will be re-analyzed. If the list contains one or more paths that are not | |
| 372 * currently analysis roots, then an error of type INVALID_ANALYSIS_ROOT will | |
| 373 * be generated. | |
| 374 * | |
| 375 * Parameters | |
| 376 * | |
| 377 * roots: List<FilePath> (optional) | |
| 378 * | |
| 379 * A list of the analysis roots that are to be re-analyzed. | |
| 380 */ | |
| 381 Future sendAnalysisReanalyze({List<String> roots}) async { | |
| 382 var params = new AnalysisReanalyzeParams(roots: roots).toJson(); | |
| 383 var result = await server.send("analysis.reanalyze", params); | |
| 384 outOfTestExpect(result, isNull); | |
| 385 return null; | |
| 386 } | |
| 387 | |
| 388 /** | |
| 389 * Sets the root paths used to determine which files to analyze. The set of | |
| 390 * files to be analyzed are all of the files in one of the root paths that | |
| 391 * are not either explicitly or implicitly excluded. A file is explicitly | |
| 392 * excluded if it is in one of the excluded paths. A file is implicitly | |
| 393 * excluded if it is in a subdirectory of one of the root paths where the | |
| 394 * name of the subdirectory starts with a period (that is, a hidden | |
| 395 * directory). | |
| 396 * | |
| 397 * Note that this request determines the set of requested analysis roots. The | |
| 398 * actual set of analysis roots at any given time is the intersection of this | |
| 399 * set with the set of files and directories actually present on the | |
| 400 * filesystem. When the filesystem changes, the actual set of analysis roots | |
| 401 * is automatically updated, but the set of requested analysis roots is | |
| 402 * unchanged. This means that if the client sets an analysis root before the | |
| 403 * root becomes visible to server in the filesystem, there is no error; once | |
| 404 * the server sees the root in the filesystem it will start analyzing it. | |
| 405 * Similarly, server will stop analyzing files that are removed from the file | |
| 406 * system but they will remain in the set of requested roots. | |
| 407 * | |
| 408 * If an included path represents a file, then server will look in the | |
| 409 * directory containing the file for a pubspec.yaml file. If none is found, | |
| 410 * then the parents of the directory will be searched until such a file is | |
| 411 * found or the root of the file system is reached. If such a file is found, | |
| 412 * it will be used to resolve package: URI’s within the file. | |
| 413 * | |
| 414 * Parameters | |
| 415 * | |
| 416 * included: List<FilePath> | |
| 417 * | |
| 418 * A list of the files and directories that should be analyzed. | |
| 419 * | |
| 420 * excluded: List<FilePath> | |
| 421 * | |
| 422 * A list of the files and directories within the included directories that | |
| 423 * should not be analyzed. | |
| 424 * | |
| 425 * packageRoots: Map<FilePath, FilePath> (optional) | |
| 426 * | |
| 427 * A mapping from source directories to package roots that should override | |
| 428 * the normal package: URI resolution mechanism. | |
| 429 * | |
| 430 * If a package root is a directory, then the analyzer will behave as | |
| 431 * though the associated source directory in the map contains a special | |
| 432 * pubspec.yaml file which resolves any package: URI to the corresponding | |
| 433 * path within that package root directory. The effect is the same as | |
| 434 * specifying the package root directory as a "--package_root" parameter to | |
| 435 * the Dart VM when executing any Dart file inside the source directory. | |
| 436 * | |
| 437 * If a package root is a file, then the analyzer will behave as though | |
| 438 * that file is a ".packages" file in the source directory. The effect is | |
| 439 * the same as specifying the file as a "--packages" parameter to the Dart | |
| 440 * VM when executing any Dart file inside the source directory. | |
| 441 * | |
| 442 * Files in any directories that are not overridden by this mapping have | |
| 443 * their package: URI's resolved using the normal pubspec.yaml mechanism. | |
| 444 * If this field is absent, or the empty map is specified, that indicates | |
| 445 * that the normal pubspec.yaml mechanism should always be used. | |
| 446 */ | |
| 447 Future sendAnalysisSetAnalysisRoots( | |
| 448 List<String> included, List<String> excluded, | |
| 449 {Map<String, String> packageRoots}) async { | |
| 450 var params = new AnalysisSetAnalysisRootsParams(included, excluded, | |
| 451 packageRoots: packageRoots) | |
| 452 .toJson(); | |
| 453 var result = await server.send("analysis.setAnalysisRoots", params); | |
| 454 outOfTestExpect(result, isNull); | |
| 455 return null; | |
| 456 } | |
| 457 | |
| 458 /** | |
| 459 * Subscribe for general services (that is, services that are not specific to | |
| 460 * individual files). All previous subscriptions are replaced by the given | |
| 461 * set of services. | |
| 462 * | |
| 463 * It is an error if any of the elements in the list are not valid services. | |
| 464 * If there is an error, then the current subscriptions will remain | |
| 465 * unchanged. | |
| 466 * | |
| 467 * Parameters | |
| 468 * | |
| 469 * subscriptions: List<GeneralAnalysisService> | |
| 470 * | |
| 471 * A list of the services being subscribed to. | |
| 472 */ | |
| 473 Future sendAnalysisSetGeneralSubscriptions( | |
| 474 List<GeneralAnalysisService> subscriptions) async { | |
| 475 var params = | |
| 476 new AnalysisSetGeneralSubscriptionsParams(subscriptions).toJson(); | |
| 477 var result = await server.send("analysis.setGeneralSubscriptions", params); | |
| 478 outOfTestExpect(result, isNull); | |
| 479 return null; | |
| 480 } | |
| 481 | |
| 482 /** | |
| 483 * Set the priority files to the files in the given list. A priority file is | |
| 484 * a file that is given priority when scheduling which analysis work to do | |
| 485 * first. The list typically contains those files that are visible to the | |
| 486 * user and those for which analysis results will have the biggest impact on | |
| 487 * the user experience. The order of the files within the list is | |
| 488 * significant: the first file will be given higher priority than the second, | |
| 489 * the second higher priority than the third, and so on. | |
| 490 * | |
| 491 * Note that this request determines the set of requested priority files. The | |
| 492 * actual set of priority files is the intersection of the requested set of | |
| 493 * priority files with the set of files currently subject to analysis. (See | |
| 494 * analysis.setSubscriptions for a description of files that are subject to | |
| 495 * analysis.) | |
| 496 * | |
| 497 * If a requested priority file is a directory it is ignored, but remains in | |
| 498 * the set of requested priority files so that if it later becomes a file it | |
| 499 * can be included in the set of actual priority files. | |
| 500 * | |
| 501 * Parameters | |
| 502 * | |
| 503 * files: List<FilePath> | |
| 504 * | |
| 505 * The files that are to be a priority for analysis. | |
| 506 */ | |
| 507 Future sendAnalysisSetPriorityFiles(List<String> files) async { | |
| 508 var params = new AnalysisSetPriorityFilesParams(files).toJson(); | |
| 509 var result = await server.send("analysis.setPriorityFiles", params); | |
| 510 outOfTestExpect(result, isNull); | |
| 511 return null; | |
| 512 } | |
| 513 | |
| 514 /** | |
| 515 * Subscribe for services that are specific to individual files. All previous | |
| 516 * subscriptions are replaced by the current set of subscriptions. If a given | |
| 517 * service is not included as a key in the map then no files will be | |
| 518 * subscribed to the service, exactly as if the service had been included in | |
| 519 * the map with an explicit empty list of files. | |
| 520 * | |
| 521 * Note that this request determines the set of requested subscriptions. The | |
| 522 * actual set of subscriptions at any given time is the intersection of this | |
| 523 * set with the set of files currently subject to analysis. The files | |
| 524 * currently subject to analysis are the set of files contained within an | |
| 525 * actual analysis root but not excluded, plus all of the files transitively | |
| 526 * reachable from those files via import, export and part directives. (See | |
| 527 * analysis.setAnalysisRoots for an explanation of how the actual analysis | |
| 528 * roots are determined.) When the actual analysis roots change, the actual | |
| 529 * set of subscriptions is automatically updated, but the set of requested | |
| 530 * subscriptions is unchanged. | |
| 531 * | |
| 532 * If a requested subscription is a directory it is ignored, but remains in | |
| 533 * the set of requested subscriptions so that if it later becomes a file it | |
| 534 * can be included in the set of actual subscriptions. | |
| 535 * | |
| 536 * It is an error if any of the keys in the map are not valid services. If | |
| 537 * there is an error, then the existing subscriptions will remain unchanged. | |
| 538 * | |
| 539 * Parameters | |
| 540 * | |
| 541 * subscriptions: Map<AnalysisService, List<FilePath>> | |
| 542 * | |
| 543 * A table mapping services to a list of the files being subscribed to the | |
| 544 * service. | |
| 545 */ | |
| 546 Future sendAnalysisSetSubscriptions( | |
| 547 Map<AnalysisService, List<String>> subscriptions) async { | |
| 548 var params = new AnalysisSetSubscriptionsParams(subscriptions).toJson(); | |
| 549 var result = await server.send("analysis.setSubscriptions", params); | |
| 550 outOfTestExpect(result, isNull); | |
| 551 return null; | |
| 552 } | |
| 553 | |
| 554 /** | |
| 555 * Update the content of one or more files. Files that were previously | |
| 556 * updated but not included in this update remain unchanged. This effectively | |
| 557 * represents an overlay of the filesystem. The files whose content is | |
| 558 * overridden are therefore seen by server as being files with the given | |
| 559 * content, even if the files do not exist on the filesystem or if the file | |
| 560 * path represents the path to a directory on the filesystem. | |
| 561 * | |
| 562 * Parameters | |
| 563 * | |
| 564 * files: Map<FilePath, AddContentOverlay | ChangeContentOverlay | | |
| 565 * RemoveContentOverlay> | |
| 566 * | |
| 567 * A table mapping the files whose content has changed to a description of | |
| 568 * the content change. | |
| 569 * | |
| 570 * Returns | |
| 571 */ | |
| 572 Future<AnalysisUpdateContentResult> sendAnalysisUpdateContent( | |
| 573 Map<String, dynamic> files) async { | |
| 574 var params = new AnalysisUpdateContentParams(files).toJson(); | |
| 575 var result = await server.send("analysis.updateContent", params); | |
| 576 ResponseDecoder decoder = new ResponseDecoder(null); | |
| 577 return new AnalysisUpdateContentResult.fromJson(decoder, 'result', result); | |
| 578 } | |
| 579 | |
| 580 /** | |
| 581 * Deprecated: all of the options can be set by users in an analysis options | |
| 582 * file. | |
| 583 * | |
| 584 * Update the options controlling analysis based on the given set of options. | |
| 585 * Any options that are not included in the analysis options will not be | |
| 586 * changed. If there are options in the analysis options that are not valid, | |
| 587 * they will be silently ignored. | |
| 588 * | |
| 589 * Parameters | |
| 590 * | |
| 591 * options: AnalysisOptions | |
| 592 * | |
| 593 * The options that are to be used to control analysis. | |
| 594 */ | |
| 595 @deprecated | |
| 596 Future sendAnalysisUpdateOptions(AnalysisOptions options) async { | |
| 597 var params = new AnalysisUpdateOptionsParams(options).toJson(); | |
| 598 var result = await server.send("analysis.updateOptions", params); | |
| 599 outOfTestExpect(result, isNull); | |
| 600 return null; | |
| 601 } | |
| 602 | |
| 603 /** | |
| 604 * Reports the paths of the files that are being analyzed. | |
| 605 * | |
| 606 * This notification is not subscribed to by default. Clients can subscribe | |
| 607 * by including the value "ANALYZED_FILES" in the list of services passed in | |
| 608 * an analysis.setGeneralSubscriptions request. | |
| 609 * | |
| 610 * Parameters | |
| 611 * | |
| 612 * directories: List<FilePath> | |
| 613 * | |
| 614 * A list of the paths of the files that are being analyzed. | |
| 615 */ | |
| 616 Stream<AnalysisAnalyzedFilesParams> onAnalysisAnalyzedFiles; | |
| 617 | |
| 618 /** | |
| 619 * Stream controller for [onAnalysisAnalyzedFiles]. | |
| 620 */ | |
| 621 StreamController<AnalysisAnalyzedFilesParams> _onAnalysisAnalyzedFiles; | |
| 622 | |
| 623 /** | |
| 624 * Reports the errors associated with a given file. The set of errors | |
| 625 * included in the notification is always a complete list that supersedes any | |
| 626 * previously reported errors. | |
| 627 * | |
| 628 * Parameters | |
| 629 * | |
| 630 * file: FilePath | |
| 631 * | |
| 632 * The file containing the errors. | |
| 633 * | |
| 634 * errors: List<AnalysisError> | |
| 635 * | |
| 636 * The errors contained in the file. | |
| 637 */ | |
| 638 Stream<AnalysisErrorsParams> onAnalysisErrors; | |
| 639 | |
| 640 /** | |
| 641 * Stream controller for [onAnalysisErrors]. | |
| 642 */ | |
| 643 StreamController<AnalysisErrorsParams> _onAnalysisErrors; | |
| 644 | |
| 645 /** | |
| 646 * Reports that any analysis results that were previously associated with the | |
| 647 * given files should be considered to be invalid because those files are no | |
| 648 * longer being analyzed, either because the analysis root that contained it | |
| 649 * is no longer being analyzed or because the file no longer exists. | |
| 650 * | |
| 651 * If a file is included in this notification and at some later time a | |
| 652 * notification with results for the file is received, clients should assume | |
| 653 * that the file is once again being analyzed and the information should be | |
| 654 * processed. | |
| 655 * | |
| 656 * It is not possible to subscribe to or unsubscribe from this notification. | |
| 657 * | |
| 658 * Parameters | |
| 659 * | |
| 660 * files: List<FilePath> | |
| 661 * | |
| 662 * The files that are no longer being analyzed. | |
| 663 */ | |
| 664 Stream<AnalysisFlushResultsParams> onAnalysisFlushResults; | |
| 665 | |
| 666 /** | |
| 667 * Stream controller for [onAnalysisFlushResults]. | |
| 668 */ | |
| 669 StreamController<AnalysisFlushResultsParams> _onAnalysisFlushResults; | |
| 670 | |
| 671 /** | |
| 672 * Reports the folding regions associated with a given file. Folding regions | |
| 673 * can be nested, but will not be overlapping. Nesting occurs when a foldable | |
| 674 * element, such as a method, is nested inside another foldable element such | |
| 675 * as a class. | |
| 676 * | |
| 677 * This notification is not subscribed to by default. Clients can subscribe | |
| 678 * by including the value "FOLDING" in the list of services passed in an | |
| 679 * analysis.setSubscriptions request. | |
| 680 * | |
| 681 * Parameters | |
| 682 * | |
| 683 * file: FilePath | |
| 684 * | |
| 685 * The file containing the folding regions. | |
| 686 * | |
| 687 * regions: List<FoldingRegion> | |
| 688 * | |
| 689 * The folding regions contained in the file. | |
| 690 */ | |
| 691 Stream<AnalysisFoldingParams> onAnalysisFolding; | |
| 692 | |
| 693 /** | |
| 694 * Stream controller for [onAnalysisFolding]. | |
| 695 */ | |
| 696 StreamController<AnalysisFoldingParams> _onAnalysisFolding; | |
| 697 | |
| 698 /** | |
| 699 * Reports the highlight regions associated with a given file. | |
| 700 * | |
| 701 * This notification is not subscribed to by default. Clients can subscribe | |
| 702 * by including the value "HIGHLIGHTS" in the list of services passed in an | |
| 703 * analysis.setSubscriptions request. | |
| 704 * | |
| 705 * Parameters | |
| 706 * | |
| 707 * file: FilePath | |
| 708 * | |
| 709 * The file containing the highlight regions. | |
| 710 * | |
| 711 * regions: List<HighlightRegion> | |
| 712 * | |
| 713 * The highlight regions contained in the file. Each highlight region | |
| 714 * represents a particular syntactic or semantic meaning associated with | |
| 715 * some range. Note that the highlight regions that are returned can | |
| 716 * overlap other highlight regions if there is more than one meaning | |
| 717 * associated with a particular region. | |
| 718 */ | |
| 719 Stream<AnalysisHighlightsParams> onAnalysisHighlights; | |
| 720 | |
| 721 /** | |
| 722 * Stream controller for [onAnalysisHighlights]. | |
| 723 */ | |
| 724 StreamController<AnalysisHighlightsParams> _onAnalysisHighlights; | |
| 725 | |
| 726 /** | |
| 727 * Reports the classes that are implemented or extended and class members | |
| 728 * that are implemented or overridden in a file. | |
| 729 * | |
| 730 * This notification is not subscribed to by default. Clients can subscribe | |
| 731 * by including the value "IMPLEMENTED" in the list of services passed in an | |
| 732 * analysis.setSubscriptions request. | |
| 733 * | |
| 734 * Parameters | |
| 735 * | |
| 736 * file: FilePath | |
| 737 * | |
| 738 * The file with which the implementations are associated. | |
| 739 * | |
| 740 * classes: List<ImplementedClass> | |
| 741 * | |
| 742 * The classes defined in the file that are implemented or extended. | |
| 743 * | |
| 744 * members: List<ImplementedMember> | |
| 745 * | |
| 746 * The member defined in the file that are implemented or overridden. | |
| 747 */ | |
| 748 Stream<AnalysisImplementedParams> onAnalysisImplemented; | |
| 749 | |
| 750 /** | |
| 751 * Stream controller for [onAnalysisImplemented]. | |
| 752 */ | |
| 753 StreamController<AnalysisImplementedParams> _onAnalysisImplemented; | |
| 754 | |
| 755 /** | |
| 756 * Reports that the navigation information associated with a region of a | |
| 757 * single file has become invalid and should be re-requested. | |
| 758 * | |
| 759 * This notification is not subscribed to by default. Clients can subscribe | |
| 760 * by including the value "INVALIDATE" in the list of services passed in an | |
| 761 * analysis.setSubscriptions request. | |
| 762 * | |
| 763 * Parameters | |
| 764 * | |
| 765 * file: FilePath | |
| 766 * | |
| 767 * The file whose information has been invalidated. | |
| 768 * | |
| 769 * offset: int | |
| 770 * | |
| 771 * The offset of the invalidated region. | |
| 772 * | |
| 773 * length: int | |
| 774 * | |
| 775 * The length of the invalidated region. | |
| 776 * | |
| 777 * delta: int | |
| 778 * | |
| 779 * The delta to be applied to the offsets in information that follows the | |
| 780 * invalidated region in order to update it so that it doesn't need to be | |
| 781 * re-requested. | |
| 782 */ | |
| 783 Stream<AnalysisInvalidateParams> onAnalysisInvalidate; | |
| 784 | |
| 785 /** | |
| 786 * Stream controller for [onAnalysisInvalidate]. | |
| 787 */ | |
| 788 StreamController<AnalysisInvalidateParams> _onAnalysisInvalidate; | |
| 789 | |
| 790 /** | |
| 791 * Reports the navigation targets associated with a given file. | |
| 792 * | |
| 793 * This notification is not subscribed to by default. Clients can subscribe | |
| 794 * by including the value "NAVIGATION" in the list of services passed in an | |
| 795 * analysis.setSubscriptions request. | |
| 796 * | |
| 797 * Parameters | |
| 798 * | |
| 799 * file: FilePath | |
| 800 * | |
| 801 * The file containing the navigation regions. | |
| 802 * | |
| 803 * regions: List<NavigationRegion> | |
| 804 * | |
| 805 * The navigation regions contained in the file. The regions are sorted by | |
| 806 * their offsets. Each navigation region represents a list of targets | |
| 807 * associated with some range. The lists will usually contain a single | |
| 808 * target, but can contain more in the case of a part that is included in | |
| 809 * multiple libraries or in Dart code that is compiled against multiple | |
| 810 * versions of a package. Note that the navigation regions that are | |
| 811 * returned do not overlap other navigation regions. | |
| 812 * | |
| 813 * targets: List<NavigationTarget> | |
| 814 * | |
| 815 * The navigation targets referenced in the file. They are referenced by | |
| 816 * NavigationRegions by their index in this array. | |
| 817 * | |
| 818 * files: List<FilePath> | |
| 819 * | |
| 820 * The files containing navigation targets referenced in the file. They are | |
| 821 * referenced by NavigationTargets by their index in this array. | |
| 822 */ | |
| 823 Stream<AnalysisNavigationParams> onAnalysisNavigation; | |
| 824 | |
| 825 /** | |
| 826 * Stream controller for [onAnalysisNavigation]. | |
| 827 */ | |
| 828 StreamController<AnalysisNavigationParams> _onAnalysisNavigation; | |
| 829 | |
| 830 /** | |
| 831 * Reports the occurrences of references to elements within a single file. | |
| 832 * | |
| 833 * This notification is not subscribed to by default. Clients can subscribe | |
| 834 * by including the value "OCCURRENCES" in the list of services passed in an | |
| 835 * analysis.setSubscriptions request. | |
| 836 * | |
| 837 * Parameters | |
| 838 * | |
| 839 * file: FilePath | |
| 840 * | |
| 841 * The file in which the references occur. | |
| 842 * | |
| 843 * occurrences: List<Occurrences> | |
| 844 * | |
| 845 * The occurrences of references to elements within the file. | |
| 846 */ | |
| 847 Stream<AnalysisOccurrencesParams> onAnalysisOccurrences; | |
| 848 | |
| 849 /** | |
| 850 * Stream controller for [onAnalysisOccurrences]. | |
| 851 */ | |
| 852 StreamController<AnalysisOccurrencesParams> _onAnalysisOccurrences; | |
| 853 | |
| 854 /** | |
| 855 * Reports the outline associated with a single file. | |
| 856 * | |
| 857 * This notification is not subscribed to by default. Clients can subscribe | |
| 858 * by including the value "OUTLINE" in the list of services passed in an | |
| 859 * analysis.setSubscriptions request. | |
| 860 * | |
| 861 * Parameters | |
| 862 * | |
| 863 * file: FilePath | |
| 864 * | |
| 865 * The file with which the outline is associated. | |
| 866 * | |
| 867 * kind: FileKind | |
| 868 * | |
| 869 * The kind of the file. | |
| 870 * | |
| 871 * libraryName: String (optional) | |
| 872 * | |
| 873 * The name of the library defined by the file using a "library" directive, | |
| 874 * or referenced by a "part of" directive. If both "library" and "part of" | |
| 875 * directives are present, then the "library" directive takes precedence. | |
| 876 * This field will be omitted if the file has neither "library" nor "part | |
| 877 * of" directives. | |
| 878 * | |
| 879 * outline: Outline | |
| 880 * | |
| 881 * The outline associated with the file. | |
| 882 */ | |
| 883 Stream<AnalysisOutlineParams> onAnalysisOutline; | |
| 884 | |
| 885 /** | |
| 886 * Stream controller for [onAnalysisOutline]. | |
| 887 */ | |
| 888 StreamController<AnalysisOutlineParams> _onAnalysisOutline; | |
| 889 | |
| 890 /** | |
| 891 * Reports the overriding members in a file. | |
| 892 * | |
| 893 * This notification is not subscribed to by default. Clients can subscribe | |
| 894 * by including the value "OVERRIDES" in the list of services passed in an | |
| 895 * analysis.setSubscriptions request. | |
| 896 * | |
| 897 * Parameters | |
| 898 * | |
| 899 * file: FilePath | |
| 900 * | |
| 901 * The file with which the overrides are associated. | |
| 902 * | |
| 903 * overrides: List<Override> | |
| 904 * | |
| 905 * The overrides associated with the file. | |
| 906 */ | |
| 907 Stream<AnalysisOverridesParams> onAnalysisOverrides; | |
| 908 | |
| 909 /** | |
| 910 * Stream controller for [onAnalysisOverrides]. | |
| 911 */ | |
| 912 StreamController<AnalysisOverridesParams> _onAnalysisOverrides; | |
| 913 | |
| 914 /** | |
| 915 * Request that completion suggestions for the given offset in the given file | |
| 916 * be returned. | |
| 917 * | |
| 918 * Parameters | |
| 919 * | |
| 920 * file: FilePath | |
| 921 * | |
| 922 * The file containing the point at which suggestions are to be made. | |
| 923 * | |
| 924 * offset: int | |
| 925 * | |
| 926 * The offset within the file at which suggestions are to be made. | |
| 927 * | |
| 928 * Returns | |
| 929 * | |
| 930 * id: CompletionId | |
| 931 * | |
| 932 * The identifier used to associate results with this completion request. | |
| 933 */ | |
| 934 Future<CompletionGetSuggestionsResult> sendCompletionGetSuggestions( | |
| 935 String file, int offset) async { | |
| 936 var params = new CompletionGetSuggestionsParams(file, offset).toJson(); | |
| 937 var result = await server.send("completion.getSuggestions", params); | |
| 938 ResponseDecoder decoder = new ResponseDecoder(null); | |
| 939 return new CompletionGetSuggestionsResult.fromJson( | |
| 940 decoder, 'result', result); | |
| 941 } | |
| 942 | |
| 943 /** | |
| 944 * Reports the completion suggestions that should be presented to the user. | |
| 945 * The set of suggestions included in the notification is always a complete | |
| 946 * list that supersedes any previously reported suggestions. | |
| 947 * | |
| 948 * Parameters | |
| 949 * | |
| 950 * id: CompletionId | |
| 951 * | |
| 952 * The id associated with the completion. | |
| 953 * | |
| 954 * replacementOffset: int | |
| 955 * | |
| 956 * The offset of the start of the text to be replaced. This will be | |
| 957 * different than the offset used to request the completion suggestions if | |
| 958 * there was a portion of an identifier before the original offset. In | |
| 959 * particular, the replacementOffset will be the offset of the beginning of | |
| 960 * said identifier. | |
| 961 * | |
| 962 * replacementLength: int | |
| 963 * | |
| 964 * The length of the text to be replaced if the remainder of the identifier | |
| 965 * containing the cursor is to be replaced when the suggestion is applied | |
| 966 * (that is, the number of characters in the existing identifier). | |
| 967 * | |
| 968 * results: List<CompletionSuggestion> | |
| 969 * | |
| 970 * The completion suggestions being reported. The notification contains all | |
| 971 * possible completions at the requested cursor position, even those that | |
| 972 * do not match the characters the user has already typed. This allows the | |
| 973 * client to respond to further keystrokes from the user without having to | |
| 974 * make additional requests. | |
| 975 * | |
| 976 * isLast: bool | |
| 977 * | |
| 978 * True if this is that last set of results that will be returned for the | |
| 979 * indicated completion. | |
| 980 */ | |
| 981 Stream<CompletionResultsParams> onCompletionResults; | |
| 982 | |
| 983 /** | |
| 984 * Stream controller for [onCompletionResults]. | |
| 985 */ | |
| 986 StreamController<CompletionResultsParams> _onCompletionResults; | |
| 987 | |
| 988 /** | |
| 989 * Perform a search for references to the element defined or referenced at | |
| 990 * the given offset in the given file. | |
| 991 * | |
| 992 * An identifier is returned immediately, and individual results will be | |
| 993 * returned via the search.results notification as they become available. | |
| 994 * | |
| 995 * Parameters | |
| 996 * | |
| 997 * file: FilePath | |
| 998 * | |
| 999 * The file containing the declaration of or reference to the element used | |
| 1000 * to define the search. | |
| 1001 * | |
| 1002 * offset: int | |
| 1003 * | |
| 1004 * The offset within the file of the declaration of or reference to the | |
| 1005 * element. | |
| 1006 * | |
| 1007 * includePotential: bool | |
| 1008 * | |
| 1009 * True if potential matches are to be included in the results. | |
| 1010 * | |
| 1011 * Returns | |
| 1012 * | |
| 1013 * id: SearchId (optional) | |
| 1014 * | |
| 1015 * The identifier used to associate results with this search request. | |
| 1016 * | |
| 1017 * If no element was found at the given location, this field will be | |
| 1018 * absent, and no results will be reported via the search.results | |
| 1019 * notification. | |
| 1020 * | |
| 1021 * element: Element (optional) | |
| 1022 * | |
| 1023 * The element referenced or defined at the given offset and whose | |
| 1024 * references will be returned in the search results. | |
| 1025 * | |
| 1026 * If no element was found at the given location, this field will be | |
| 1027 * absent. | |
| 1028 */ | |
| 1029 Future<SearchFindElementReferencesResult> sendSearchFindElementReferences( | |
| 1030 String file, int offset, bool includePotential) async { | |
| 1031 var params = | |
| 1032 new SearchFindElementReferencesParams(file, offset, includePotential) | |
| 1033 .toJson(); | |
| 1034 var result = await server.send("search.findElementReferences", params); | |
| 1035 ResponseDecoder decoder = new ResponseDecoder(null); | |
| 1036 return new SearchFindElementReferencesResult.fromJson( | |
| 1037 decoder, 'result', result); | |
| 1038 } | |
| 1039 | |
| 1040 /** | |
| 1041 * Perform a search for declarations of members whose name is equal to the | |
| 1042 * given name. | |
| 1043 * | |
| 1044 * An identifier is returned immediately, and individual results will be | |
| 1045 * returned via the search.results notification as they become available. | |
| 1046 * | |
| 1047 * Parameters | |
| 1048 * | |
| 1049 * name: String | |
| 1050 * | |
| 1051 * The name of the declarations to be found. | |
| 1052 * | |
| 1053 * Returns | |
| 1054 * | |
| 1055 * id: SearchId | |
| 1056 * | |
| 1057 * The identifier used to associate results with this search request. | |
| 1058 */ | |
| 1059 Future<SearchFindMemberDeclarationsResult> sendSearchFindMemberDeclarations( | |
| 1060 String name) async { | |
| 1061 var params = new SearchFindMemberDeclarationsParams(name).toJson(); | |
| 1062 var result = await server.send("search.findMemberDeclarations", params); | |
| 1063 ResponseDecoder decoder = new ResponseDecoder(null); | |
| 1064 return new SearchFindMemberDeclarationsResult.fromJson( | |
| 1065 decoder, 'result', result); | |
| 1066 } | |
| 1067 | |
| 1068 /** | |
| 1069 * Perform a search for references to members whose name is equal to the | |
| 1070 * given name. This search does not check to see that there is a member | |
| 1071 * defined with the given name, so it is able to find references to undefined | |
| 1072 * members as well. | |
| 1073 * | |
| 1074 * An identifier is returned immediately, and individual results will be | |
| 1075 * returned via the search.results notification as they become available. | |
| 1076 * | |
| 1077 * Parameters | |
| 1078 * | |
| 1079 * name: String | |
| 1080 * | |
| 1081 * The name of the references to be found. | |
| 1082 * | |
| 1083 * Returns | |
| 1084 * | |
| 1085 * id: SearchId | |
| 1086 * | |
| 1087 * The identifier used to associate results with this search request. | |
| 1088 */ | |
| 1089 Future<SearchFindMemberReferencesResult> sendSearchFindMemberReferences( | |
| 1090 String name) async { | |
| 1091 var params = new SearchFindMemberReferencesParams(name).toJson(); | |
| 1092 var result = await server.send("search.findMemberReferences", params); | |
| 1093 ResponseDecoder decoder = new ResponseDecoder(null); | |
| 1094 return new SearchFindMemberReferencesResult.fromJson( | |
| 1095 decoder, 'result', result); | |
| 1096 } | |
| 1097 | |
| 1098 /** | |
| 1099 * Perform a search for declarations of top-level elements (classes, | |
| 1100 * typedefs, getters, setters, functions and fields) whose name matches the | |
| 1101 * given pattern. | |
| 1102 * | |
| 1103 * An identifier is returned immediately, and individual results will be | |
| 1104 * returned via the search.results notification as they become available. | |
| 1105 * | |
| 1106 * Parameters | |
| 1107 * | |
| 1108 * pattern: String | |
| 1109 * | |
| 1110 * The regular expression used to match the names of the declarations to be | |
| 1111 * found. | |
| 1112 * | |
| 1113 * Returns | |
| 1114 * | |
| 1115 * id: SearchId | |
| 1116 * | |
| 1117 * The identifier used to associate results with this search request. | |
| 1118 */ | |
| 1119 Future<SearchFindTopLevelDeclarationsResult> | |
| 1120 sendSearchFindTopLevelDeclarations(String pattern) async { | |
| 1121 var params = new SearchFindTopLevelDeclarationsParams(pattern).toJson(); | |
| 1122 var result = await server.send("search.findTopLevelDeclarations", params); | |
| 1123 ResponseDecoder decoder = new ResponseDecoder(null); | |
| 1124 return new SearchFindTopLevelDeclarationsResult.fromJson( | |
| 1125 decoder, 'result', result); | |
| 1126 } | |
| 1127 | |
| 1128 /** | |
| 1129 * Return the type hierarchy of the class declared or referenced at the given | |
| 1130 * location. | |
| 1131 * | |
| 1132 * Parameters | |
| 1133 * | |
| 1134 * file: FilePath | |
| 1135 * | |
| 1136 * The file containing the declaration or reference to the type for which a | |
| 1137 * hierarchy is being requested. | |
| 1138 * | |
| 1139 * offset: int | |
| 1140 * | |
| 1141 * The offset of the name of the type within the file. | |
| 1142 * | |
| 1143 * superOnly: bool (optional) | |
| 1144 * | |
| 1145 * True if the client is only requesting superclasses and interfaces | |
| 1146 * hierarchy. | |
| 1147 * | |
| 1148 * Returns | |
| 1149 * | |
| 1150 * hierarchyItems: List<TypeHierarchyItem> (optional) | |
| 1151 * | |
| 1152 * A list of the types in the requested hierarchy. The first element of the | |
| 1153 * list is the item representing the type for which the hierarchy was | |
| 1154 * requested. The index of other elements of the list is unspecified, but | |
| 1155 * correspond to the integers used to reference supertype and subtype items | |
| 1156 * within the items. | |
| 1157 * | |
| 1158 * This field will be absent if the code at the given file and offset does | |
| 1159 * not represent a type, or if the file has not been sufficiently analyzed | |
| 1160 * to allow a type hierarchy to be produced. | |
| 1161 */ | |
| 1162 Future<SearchGetTypeHierarchyResult> sendSearchGetTypeHierarchy( | |
| 1163 String file, int offset, | |
| 1164 {bool superOnly}) async { | |
| 1165 var params = | |
| 1166 new SearchGetTypeHierarchyParams(file, offset, superOnly: superOnly) | |
| 1167 .toJson(); | |
| 1168 var result = await server.send("search.getTypeHierarchy", params); | |
| 1169 ResponseDecoder decoder = new ResponseDecoder(null); | |
| 1170 return new SearchGetTypeHierarchyResult.fromJson(decoder, 'result', result); | |
| 1171 } | |
| 1172 | |
| 1173 /** | |
| 1174 * Reports some or all of the results of performing a requested search. | |
| 1175 * Unlike other notifications, this notification contains search results that | |
| 1176 * should be added to any previously received search results associated with | |
| 1177 * the same search id. | |
| 1178 * | |
| 1179 * Parameters | |
| 1180 * | |
| 1181 * id: SearchId | |
| 1182 * | |
| 1183 * The id associated with the search. | |
| 1184 * | |
| 1185 * results: List<SearchResult> | |
| 1186 * | |
| 1187 * The search results being reported. | |
| 1188 * | |
| 1189 * isLast: bool | |
| 1190 * | |
| 1191 * True if this is that last set of results that will be returned for the | |
| 1192 * indicated search. | |
| 1193 */ | |
| 1194 Stream<SearchResultsParams> onSearchResults; | |
| 1195 | |
| 1196 /** | |
| 1197 * Stream controller for [onSearchResults]. | |
| 1198 */ | |
| 1199 StreamController<SearchResultsParams> _onSearchResults; | |
| 1200 | |
| 1201 /** | |
| 1202 * Format the contents of a single file. The currently selected region of | |
| 1203 * text is passed in so that the selection can be preserved across the | |
| 1204 * formatting operation. The updated selection will be as close to matching | |
| 1205 * the original as possible, but whitespace at the beginning or end of the | |
| 1206 * selected region will be ignored. If preserving selection information is | |
| 1207 * not required, zero (0) can be specified for both the selection offset and | |
| 1208 * selection length. | |
| 1209 * | |
| 1210 * If a request is made for a file which does not exist, or which is not | |
| 1211 * currently subject to analysis (e.g. because it is not associated with any | |
| 1212 * analysis root specified to analysis.setAnalysisRoots), an error of type | |
| 1213 * FORMAT_INVALID_FILE will be generated. If the source contains syntax | |
| 1214 * errors, an error of type FORMAT_WITH_ERRORS will be generated. | |
| 1215 * | |
| 1216 * Parameters | |
| 1217 * | |
| 1218 * file: FilePath | |
| 1219 * | |
| 1220 * The file containing the code to be formatted. | |
| 1221 * | |
| 1222 * selectionOffset: int | |
| 1223 * | |
| 1224 * The offset of the current selection in the file. | |
| 1225 * | |
| 1226 * selectionLength: int | |
| 1227 * | |
| 1228 * The length of the current selection in the file. | |
| 1229 * | |
| 1230 * lineLength: int (optional) | |
| 1231 * | |
| 1232 * The line length to be used by the formatter. | |
| 1233 * | |
| 1234 * Returns | |
| 1235 * | |
| 1236 * edits: List<SourceEdit> | |
| 1237 * | |
| 1238 * The edit(s) to be applied in order to format the code. The list will be | |
| 1239 * empty if the code was already formatted (there are no changes). | |
| 1240 * | |
| 1241 * selectionOffset: int | |
| 1242 * | |
| 1243 * The offset of the selection after formatting the code. | |
| 1244 * | |
| 1245 * selectionLength: int | |
| 1246 * | |
| 1247 * The length of the selection after formatting the code. | |
| 1248 */ | |
| 1249 Future<EditFormatResult> sendEditFormat( | |
| 1250 String file, int selectionOffset, int selectionLength, | |
| 1251 {int lineLength}) async { | |
| 1252 var params = new EditFormatParams(file, selectionOffset, selectionLength, | |
| 1253 lineLength: lineLength) | |
| 1254 .toJson(); | |
| 1255 var result = await server.send("edit.format", params); | |
| 1256 ResponseDecoder decoder = new ResponseDecoder(null); | |
| 1257 return new EditFormatResult.fromJson(decoder, 'result', result); | |
| 1258 } | |
| 1259 | |
| 1260 /** | |
| 1261 * Return the set of assists that are available at the given location. An | |
| 1262 * assist is distinguished from a refactoring primarily by the fact that it | |
| 1263 * affects a single file and does not require user input in order to be | |
| 1264 * performed. | |
| 1265 * | |
| 1266 * Parameters | |
| 1267 * | |
| 1268 * file: FilePath | |
| 1269 * | |
| 1270 * The file containing the code for which assists are being requested. | |
| 1271 * | |
| 1272 * offset: int | |
| 1273 * | |
| 1274 * The offset of the code for which assists are being requested. | |
| 1275 * | |
| 1276 * length: int | |
| 1277 * | |
| 1278 * The length of the code for which assists are being requested. | |
| 1279 * | |
| 1280 * Returns | |
| 1281 * | |
| 1282 * assists: List<SourceChange> | |
| 1283 * | |
| 1284 * The assists that are available at the given location. | |
| 1285 */ | |
| 1286 Future<EditGetAssistsResult> sendEditGetAssists( | |
| 1287 String file, int offset, int length) async { | |
| 1288 var params = new EditGetAssistsParams(file, offset, length).toJson(); | |
| 1289 var result = await server.send("edit.getAssists", params); | |
| 1290 ResponseDecoder decoder = new ResponseDecoder(null); | |
| 1291 return new EditGetAssistsResult.fromJson(decoder, 'result', result); | |
| 1292 } | |
| 1293 | |
| 1294 /** | |
| 1295 * Get a list of the kinds of refactorings that are valid for the given | |
| 1296 * selection in the given file. | |
| 1297 * | |
| 1298 * Parameters | |
| 1299 * | |
| 1300 * file: FilePath | |
| 1301 * | |
| 1302 * The file containing the code on which the refactoring would be based. | |
| 1303 * | |
| 1304 * offset: int | |
| 1305 * | |
| 1306 * The offset of the code on which the refactoring would be based. | |
| 1307 * | |
| 1308 * length: int | |
| 1309 * | |
| 1310 * The length of the code on which the refactoring would be based. | |
| 1311 * | |
| 1312 * Returns | |
| 1313 * | |
| 1314 * kinds: List<RefactoringKind> | |
| 1315 * | |
| 1316 * The kinds of refactorings that are valid for the given selection. | |
| 1317 */ | |
| 1318 Future<EditGetAvailableRefactoringsResult> sendEditGetAvailableRefactorings( | |
| 1319 String file, int offset, int length) async { | |
| 1320 var params = | |
| 1321 new EditGetAvailableRefactoringsParams(file, offset, length).toJson(); | |
| 1322 var result = await server.send("edit.getAvailableRefactorings", params); | |
| 1323 ResponseDecoder decoder = new ResponseDecoder(null); | |
| 1324 return new EditGetAvailableRefactoringsResult.fromJson( | |
| 1325 decoder, 'result', result); | |
| 1326 } | |
| 1327 | |
| 1328 /** | |
| 1329 * Return the set of fixes that are available for the errors at a given | |
| 1330 * offset in a given file. | |
| 1331 * | |
| 1332 * Parameters | |
| 1333 * | |
| 1334 * file: FilePath | |
| 1335 * | |
| 1336 * The file containing the errors for which fixes are being requested. | |
| 1337 * | |
| 1338 * offset: int | |
| 1339 * | |
| 1340 * The offset used to select the errors for which fixes will be returned. | |
| 1341 * | |
| 1342 * Returns | |
| 1343 * | |
| 1344 * fixes: List<AnalysisErrorFixes> | |
| 1345 * | |
| 1346 * The fixes that are available for the errors at the given offset. | |
| 1347 */ | |
| 1348 Future<EditGetFixesResult> sendEditGetFixes(String file, int offset) async { | |
| 1349 var params = new EditGetFixesParams(file, offset).toJson(); | |
| 1350 var result = await server.send("edit.getFixes", params); | |
| 1351 ResponseDecoder decoder = new ResponseDecoder(null); | |
| 1352 return new EditGetFixesResult.fromJson(decoder, 'result', result); | |
| 1353 } | |
| 1354 | |
| 1355 /** | |
| 1356 * Get the changes required to perform a refactoring. | |
| 1357 * | |
| 1358 * If another refactoring request is received during the processing of this | |
| 1359 * one, an error of type REFACTORING_REQUEST_CANCELLED will be generated. | |
| 1360 * | |
| 1361 * Parameters | |
| 1362 * | |
| 1363 * kind: RefactoringKind | |
| 1364 * | |
| 1365 * The kind of refactoring to be performed. | |
| 1366 * | |
| 1367 * file: FilePath | |
| 1368 * | |
| 1369 * The file containing the code involved in the refactoring. | |
| 1370 * | |
| 1371 * offset: int | |
| 1372 * | |
| 1373 * The offset of the region involved in the refactoring. | |
| 1374 * | |
| 1375 * length: int | |
| 1376 * | |
| 1377 * The length of the region involved in the refactoring. | |
| 1378 * | |
| 1379 * validateOnly: bool | |
| 1380 * | |
| 1381 * True if the client is only requesting that the values of the options be | |
| 1382 * validated and no change be generated. | |
| 1383 * | |
| 1384 * options: RefactoringOptions (optional) | |
| 1385 * | |
| 1386 * Data used to provide values provided by the user. The structure of the | |
| 1387 * data is dependent on the kind of refactoring being performed. The data | |
| 1388 * that is expected is documented in the section titled Refactorings, | |
| 1389 * labeled as "Options". This field can be omitted if the refactoring does | |
| 1390 * not require any options or if the values of those options are not known. | |
| 1391 * | |
| 1392 * Returns | |
| 1393 * | |
| 1394 * initialProblems: List<RefactoringProblem> | |
| 1395 * | |
| 1396 * The initial status of the refactoring, i.e. problems related to the | |
| 1397 * context in which the refactoring is requested. The array will be empty | |
| 1398 * if there are no known problems. | |
| 1399 * | |
| 1400 * optionsProblems: List<RefactoringProblem> | |
| 1401 * | |
| 1402 * The options validation status, i.e. problems in the given options, such | |
| 1403 * as light-weight validation of a new name, flags compatibility, etc. The | |
| 1404 * array will be empty if there are no known problems. | |
| 1405 * | |
| 1406 * finalProblems: List<RefactoringProblem> | |
| 1407 * | |
| 1408 * The final status of the refactoring, i.e. problems identified in the | |
| 1409 * result of a full, potentially expensive validation and / or change | |
| 1410 * creation. The array will be empty if there are no known problems. | |
| 1411 * | |
| 1412 * feedback: RefactoringFeedback (optional) | |
| 1413 * | |
| 1414 * Data used to provide feedback to the user. The structure of the data is | |
| 1415 * dependent on the kind of refactoring being created. The data that is | |
| 1416 * returned is documented in the section titled Refactorings, labeled as | |
| 1417 * "Feedback". | |
| 1418 * | |
| 1419 * change: SourceChange (optional) | |
| 1420 * | |
| 1421 * The changes that are to be applied to affect the refactoring. This field | |
| 1422 * will be omitted if there are problems that prevent a set of changes from | |
| 1423 * being computed, such as having no options specified for a refactoring | |
| 1424 * that requires them, or if only validation was requested. | |
| 1425 * | |
| 1426 * potentialEdits: List<String> (optional) | |
| 1427 * | |
| 1428 * The ids of source edits that are not known to be valid. An edit is not | |
| 1429 * known to be valid if there was insufficient type information for the | |
| 1430 * server to be able to determine whether or not the code needs to be | |
| 1431 * modified, such as when a member is being renamed and there is a | |
| 1432 * reference to a member from an unknown type. This field will be omitted | |
| 1433 * if the change field is omitted or if there are no potential edits for | |
| 1434 * the refactoring. | |
| 1435 */ | |
| 1436 Future<EditGetRefactoringResult> sendEditGetRefactoring(RefactoringKind kind, | |
| 1437 String file, int offset, int length, bool validateOnly, | |
| 1438 {RefactoringOptions options}) async { | |
| 1439 var params = new EditGetRefactoringParams( | |
| 1440 kind, file, offset, length, validateOnly, | |
| 1441 options: options) | |
| 1442 .toJson(); | |
| 1443 var result = await server.send("edit.getRefactoring", params); | |
| 1444 ResponseDecoder decoder = new ResponseDecoder(kind); | |
| 1445 return new EditGetRefactoringResult.fromJson(decoder, 'result', result); | |
| 1446 } | |
| 1447 | |
| 1448 /** | |
| 1449 * Get the changes required to convert the partial statement at the given | |
| 1450 * location into a syntactically valid statement. If the current statement is | |
| 1451 * already valid the change will insert a newline plus appropriate | |
| 1452 * indentation at the end of the line containing the offset. If a change that | |
| 1453 * makes the statement valid cannot be determined (perhaps because it has not | |
| 1454 * yet been implemented) the statement will be considered already valid and | |
| 1455 * the appropriate change returned. | |
| 1456 * | |
| 1457 * Parameters | |
| 1458 * | |
| 1459 * file: FilePath | |
| 1460 * | |
| 1461 * The file containing the statement to be completed. | |
| 1462 * | |
| 1463 * offset: int | |
| 1464 * | |
| 1465 * The offset used to identify the statement to be completed. | |
| 1466 * | |
| 1467 * Returns | |
| 1468 * | |
| 1469 * change: SourceChange | |
| 1470 * | |
| 1471 * The change to be applied in order to complete the statement. | |
| 1472 * | |
| 1473 * whitespaceOnly: bool | |
| 1474 * | |
| 1475 * Will be true if the change contains nothing but whitespace characters, | |
| 1476 * or is empty. | |
| 1477 */ | |
| 1478 Future<EditGetStatementCompletionResult> sendEditGetStatementCompletion( | |
| 1479 String file, int offset) async { | |
| 1480 var params = new EditGetStatementCompletionParams(file, offset).toJson(); | |
| 1481 var result = await server.send("edit.getStatementCompletion", params); | |
| 1482 ResponseDecoder decoder = new ResponseDecoder(null); | |
| 1483 return new EditGetStatementCompletionResult.fromJson( | |
| 1484 decoder, 'result', result); | |
| 1485 } | |
| 1486 | |
| 1487 /** | |
| 1488 * Sort all of the directives, unit and class members of the given Dart file. | |
| 1489 * | |
| 1490 * If a request is made for a file that does not exist, does not belong to an | |
| 1491 * analysis root or is not a Dart file, SORT_MEMBERS_INVALID_FILE will be | |
| 1492 * generated. | |
| 1493 * | |
| 1494 * If the Dart file has scan or parse errors, SORT_MEMBERS_PARSE_ERRORS will | |
| 1495 * be generated. | |
| 1496 * | |
| 1497 * Parameters | |
| 1498 * | |
| 1499 * file: FilePath | |
| 1500 * | |
| 1501 * The Dart file to sort. | |
| 1502 * | |
| 1503 * Returns | |
| 1504 * | |
| 1505 * edit: SourceFileEdit | |
| 1506 * | |
| 1507 * The file edit that is to be applied to the given file to effect the | |
| 1508 * sorting. | |
| 1509 */ | |
| 1510 Future<EditSortMembersResult> sendEditSortMembers(String file) async { | |
| 1511 var params = new EditSortMembersParams(file).toJson(); | |
| 1512 var result = await server.send("edit.sortMembers", params); | |
| 1513 ResponseDecoder decoder = new ResponseDecoder(null); | |
| 1514 return new EditSortMembersResult.fromJson(decoder, 'result', result); | |
| 1515 } | |
| 1516 | |
| 1517 /** | |
| 1518 * Organizes all of the directives - removes unused imports and sorts | |
| 1519 * directives of the given Dart file according to the Dart Style Guide. | |
| 1520 * | |
| 1521 * If a request is made for a file that does not exist, does not belong to an | |
| 1522 * analysis root or is not a Dart file, FILE_NOT_ANALYZED will be generated. | |
| 1523 * | |
| 1524 * If directives of the Dart file cannot be organized, for example because it | |
| 1525 * has scan or parse errors, or by other reasons, ORGANIZE_DIRECTIVES_ERROR | |
| 1526 * will be generated. The message will provide details about the reason. | |
| 1527 * | |
| 1528 * Parameters | |
| 1529 * | |
| 1530 * file: FilePath | |
| 1531 * | |
| 1532 * The Dart file to organize directives in. | |
| 1533 * | |
| 1534 * Returns | |
| 1535 * | |
| 1536 * edit: SourceFileEdit | |
| 1537 * | |
| 1538 * The file edit that is to be applied to the given file to effect the | |
| 1539 * organizing. | |
| 1540 */ | |
| 1541 Future<EditOrganizeDirectivesResult> sendEditOrganizeDirectives( | |
| 1542 String file) async { | |
| 1543 var params = new EditOrganizeDirectivesParams(file).toJson(); | |
| 1544 var result = await server.send("edit.organizeDirectives", params); | |
| 1545 ResponseDecoder decoder = new ResponseDecoder(null); | |
| 1546 return new EditOrganizeDirectivesResult.fromJson(decoder, 'result', result); | |
| 1547 } | |
| 1548 | |
| 1549 /** | |
| 1550 * Create an execution context for the executable file with the given path. | |
| 1551 * The context that is created will persist until execution.deleteContext is | |
| 1552 * used to delete it. Clients, therefore, are responsible for managing the | |
| 1553 * lifetime of execution contexts. | |
| 1554 * | |
| 1555 * Parameters | |
| 1556 * | |
| 1557 * contextRoot: FilePath | |
| 1558 * | |
| 1559 * The path of the Dart or HTML file that will be launched, or the path of | |
| 1560 * the directory containing the file. | |
| 1561 * | |
| 1562 * Returns | |
| 1563 * | |
| 1564 * id: ExecutionContextId | |
| 1565 * | |
| 1566 * The identifier used to refer to the execution context that was created. | |
| 1567 */ | |
| 1568 Future<ExecutionCreateContextResult> sendExecutionCreateContext( | |
| 1569 String contextRoot) async { | |
| 1570 var params = new ExecutionCreateContextParams(contextRoot).toJson(); | |
| 1571 var result = await server.send("execution.createContext", params); | |
| 1572 ResponseDecoder decoder = new ResponseDecoder(null); | |
| 1573 return new ExecutionCreateContextResult.fromJson(decoder, 'result', result); | |
| 1574 } | |
| 1575 | |
| 1576 /** | |
| 1577 * Delete the execution context with the given identifier. The context id is | |
| 1578 * no longer valid after this command. The server is allowed to re-use ids | |
| 1579 * when they are no longer valid. | |
| 1580 * | |
| 1581 * Parameters | |
| 1582 * | |
| 1583 * id: ExecutionContextId | |
| 1584 * | |
| 1585 * The identifier of the execution context that is to be deleted. | |
| 1586 */ | |
| 1587 Future sendExecutionDeleteContext(String id) async { | |
| 1588 var params = new ExecutionDeleteContextParams(id).toJson(); | |
| 1589 var result = await server.send("execution.deleteContext", params); | |
| 1590 outOfTestExpect(result, isNull); | |
| 1591 return null; | |
| 1592 } | |
| 1593 | |
| 1594 /** | |
| 1595 * Map a URI from the execution context to the file that it corresponds to, | |
| 1596 * or map a file to the URI that it corresponds to in the execution context. | |
| 1597 * | |
| 1598 * Exactly one of the file and uri fields must be provided. If both fields | |
| 1599 * are provided, then an error of type INVALID_PARAMETER will be generated. | |
| 1600 * Similarly, if neither field is provided, then an error of type | |
| 1601 * INVALID_PARAMETER will be generated. | |
| 1602 * | |
| 1603 * If the file field is provided and the value is not the path of a file | |
| 1604 * (either the file does not exist or the path references something other | |
| 1605 * than a file), then an error of type INVALID_PARAMETER will be generated. | |
| 1606 * | |
| 1607 * If the uri field is provided and the value is not a valid URI or if the | |
| 1608 * URI references something that is not a file (either a file that does not | |
| 1609 * exist or something other than a file), then an error of type | |
| 1610 * INVALID_PARAMETER will be generated. | |
| 1611 * | |
| 1612 * If the contextRoot used to create the execution context does not exist, | |
| 1613 * then an error of type INVALID_EXECUTION_CONTEXT will be generated. | |
| 1614 * | |
| 1615 * Parameters | |
| 1616 * | |
| 1617 * id: ExecutionContextId | |
| 1618 * | |
| 1619 * The identifier of the execution context in which the URI is to be | |
| 1620 * mapped. | |
| 1621 * | |
| 1622 * file: FilePath (optional) | |
| 1623 * | |
| 1624 * The path of the file to be mapped into a URI. | |
| 1625 * | |
| 1626 * uri: String (optional) | |
| 1627 * | |
| 1628 * The URI to be mapped into a file path. | |
| 1629 * | |
| 1630 * Returns | |
| 1631 * | |
| 1632 * file: FilePath (optional) | |
| 1633 * | |
| 1634 * The file to which the URI was mapped. This field is omitted if the uri | |
| 1635 * field was not given in the request. | |
| 1636 * | |
| 1637 * uri: String (optional) | |
| 1638 * | |
| 1639 * The URI to which the file path was mapped. This field is omitted if the | |
| 1640 * file field was not given in the request. | |
| 1641 */ | |
| 1642 Future<ExecutionMapUriResult> sendExecutionMapUri(String id, | |
| 1643 {String file, String uri}) async { | |
| 1644 var params = new ExecutionMapUriParams(id, file: file, uri: uri).toJson(); | |
| 1645 var result = await server.send("execution.mapUri", params); | |
| 1646 ResponseDecoder decoder = new ResponseDecoder(null); | |
| 1647 return new ExecutionMapUriResult.fromJson(decoder, 'result', result); | |
| 1648 } | |
| 1649 | |
| 1650 /** | |
| 1651 * Deprecated: the analysis server no longer fires LAUNCH_DATA events. | |
| 1652 * | |
| 1653 * Subscribe for services. All previous subscriptions are replaced by the | |
| 1654 * given set of services. | |
| 1655 * | |
| 1656 * It is an error if any of the elements in the list are not valid services. | |
| 1657 * If there is an error, then the current subscriptions will remain | |
| 1658 * unchanged. | |
| 1659 * | |
| 1660 * Parameters | |
| 1661 * | |
| 1662 * subscriptions: List<ExecutionService> | |
| 1663 * | |
| 1664 * A list of the services being subscribed to. | |
| 1665 */ | |
| 1666 @deprecated | |
| 1667 Future sendExecutionSetSubscriptions( | |
| 1668 List<ExecutionService> subscriptions) async { | |
| 1669 var params = new ExecutionSetSubscriptionsParams(subscriptions).toJson(); | |
| 1670 var result = await server.send("execution.setSubscriptions", params); | |
| 1671 outOfTestExpect(result, isNull); | |
| 1672 return null; | |
| 1673 } | |
| 1674 | |
| 1675 /** | |
| 1676 * Reports information needed to allow a single file to be launched. | |
| 1677 * | |
| 1678 * This notification is not subscribed to by default. Clients can subscribe | |
| 1679 * by including the value "LAUNCH_DATA" in the list of services passed in an | |
| 1680 * execution.setSubscriptions request. | |
| 1681 * | |
| 1682 * Parameters | |
| 1683 * | |
| 1684 * file: FilePath | |
| 1685 * | |
| 1686 * The file for which launch data is being provided. This will either be a | |
| 1687 * Dart library or an HTML file. | |
| 1688 * | |
| 1689 * kind: ExecutableKind (optional) | |
| 1690 * | |
| 1691 * The kind of the executable file. This field is omitted if the file is | |
| 1692 * not a Dart file. | |
| 1693 * | |
| 1694 * referencedFiles: List<FilePath> (optional) | |
| 1695 * | |
| 1696 * A list of the Dart files that are referenced by the file. This field is | |
| 1697 * omitted if the file is not an HTML file. | |
| 1698 */ | |
| 1699 Stream<ExecutionLaunchDataParams> onExecutionLaunchData; | |
| 1700 | |
| 1701 /** | |
| 1702 * Stream controller for [onExecutionLaunchData]. | |
| 1703 */ | |
| 1704 StreamController<ExecutionLaunchDataParams> _onExecutionLaunchData; | |
| 1705 | |
| 1706 /** | |
| 1707 * Return server diagnostics. | |
| 1708 * | |
| 1709 * Returns | |
| 1710 * | |
| 1711 * contexts: List<ContextData> | |
| 1712 * | |
| 1713 * The list of analysis contexts. | |
| 1714 */ | |
| 1715 Future<DiagnosticGetDiagnosticsResult> sendDiagnosticGetDiagnostics() async { | |
| 1716 var result = await server.send("diagnostic.getDiagnostics", null); | |
| 1717 ResponseDecoder decoder = new ResponseDecoder(null); | |
| 1718 return new DiagnosticGetDiagnosticsResult.fromJson( | |
| 1719 decoder, 'result', result); | |
| 1720 } | |
| 1721 | |
| 1722 /** | |
| 1723 * Return the port of the diagnostic web server. If the server is not running | |
| 1724 * this call will start the server. If unable to start the diagnostic web | |
| 1725 * server, this call will return an error of DEBUG_PORT_COULD_NOT_BE_OPENED. | |
| 1726 * | |
| 1727 * Returns | |
| 1728 * | |
| 1729 * port: int | |
| 1730 * | |
| 1731 * The diagnostic server port. | |
| 1732 */ | |
| 1733 Future<DiagnosticGetServerPortResult> sendDiagnosticGetServerPort() async { | |
| 1734 var result = await server.send("diagnostic.getServerPort", null); | |
| 1735 ResponseDecoder decoder = new ResponseDecoder(null); | |
| 1736 return new DiagnosticGetServerPortResult.fromJson( | |
| 1737 decoder, 'result', result); | |
| 1738 } | |
| 1739 | |
| 1740 /** | |
| 1741 * Initialize the fields in InttestMixin, and ensure that notifications will | |
| 1742 * be handled. | |
| 1743 */ | |
| 1744 void initializeInttestMixin() { | |
| 1745 _onServerConnected = | |
| 1746 new StreamController<ServerConnectedParams>(sync: true); | |
| 1747 onServerConnected = _onServerConnected.stream.asBroadcastStream(); | |
| 1748 _onServerError = new StreamController<ServerErrorParams>(sync: true); | |
| 1749 onServerError = _onServerError.stream.asBroadcastStream(); | |
| 1750 _onServerStatus = new StreamController<ServerStatusParams>(sync: true); | |
| 1751 onServerStatus = _onServerStatus.stream.asBroadcastStream(); | |
| 1752 _onAnalysisAnalyzedFiles = | |
| 1753 new StreamController<AnalysisAnalyzedFilesParams>(sync: true); | |
| 1754 onAnalysisAnalyzedFiles = | |
| 1755 _onAnalysisAnalyzedFiles.stream.asBroadcastStream(); | |
| 1756 _onAnalysisErrors = new StreamController<AnalysisErrorsParams>(sync: true); | |
| 1757 onAnalysisErrors = _onAnalysisErrors.stream.asBroadcastStream(); | |
| 1758 _onAnalysisFlushResults = | |
| 1759 new StreamController<AnalysisFlushResultsParams>(sync: true); | |
| 1760 onAnalysisFlushResults = _onAnalysisFlushResults.stream.asBroadcastStream(); | |
| 1761 _onAnalysisFolding = | |
| 1762 new StreamController<AnalysisFoldingParams>(sync: true); | |
| 1763 onAnalysisFolding = _onAnalysisFolding.stream.asBroadcastStream(); | |
| 1764 _onAnalysisHighlights = | |
| 1765 new StreamController<AnalysisHighlightsParams>(sync: true); | |
| 1766 onAnalysisHighlights = _onAnalysisHighlights.stream.asBroadcastStream(); | |
| 1767 _onAnalysisImplemented = | |
| 1768 new StreamController<AnalysisImplementedParams>(sync: true); | |
| 1769 onAnalysisImplemented = _onAnalysisImplemented.stream.asBroadcastStream(); | |
| 1770 _onAnalysisInvalidate = | |
| 1771 new StreamController<AnalysisInvalidateParams>(sync: true); | |
| 1772 onAnalysisInvalidate = _onAnalysisInvalidate.stream.asBroadcastStream(); | |
| 1773 _onAnalysisNavigation = | |
| 1774 new StreamController<AnalysisNavigationParams>(sync: true); | |
| 1775 onAnalysisNavigation = _onAnalysisNavigation.stream.asBroadcastStream(); | |
| 1776 _onAnalysisOccurrences = | |
| 1777 new StreamController<AnalysisOccurrencesParams>(sync: true); | |
| 1778 onAnalysisOccurrences = _onAnalysisOccurrences.stream.asBroadcastStream(); | |
| 1779 _onAnalysisOutline = | |
| 1780 new StreamController<AnalysisOutlineParams>(sync: true); | |
| 1781 onAnalysisOutline = _onAnalysisOutline.stream.asBroadcastStream(); | |
| 1782 _onAnalysisOverrides = | |
| 1783 new StreamController<AnalysisOverridesParams>(sync: true); | |
| 1784 onAnalysisOverrides = _onAnalysisOverrides.stream.asBroadcastStream(); | |
| 1785 _onCompletionResults = | |
| 1786 new StreamController<CompletionResultsParams>(sync: true); | |
| 1787 onCompletionResults = _onCompletionResults.stream.asBroadcastStream(); | |
| 1788 _onSearchResults = new StreamController<SearchResultsParams>(sync: true); | |
| 1789 onSearchResults = _onSearchResults.stream.asBroadcastStream(); | |
| 1790 _onExecutionLaunchData = | |
| 1791 new StreamController<ExecutionLaunchDataParams>(sync: true); | |
| 1792 onExecutionLaunchData = _onExecutionLaunchData.stream.asBroadcastStream(); | |
| 1793 } | |
| 1794 | |
| 1795 /** | |
| 1796 * Dispatch the notification named [event], and containing parameters | |
| 1797 * [params], to the appropriate stream. | |
| 1798 */ | |
| 1799 void dispatchNotification(String event, params) { | |
| 1800 ResponseDecoder decoder = new ResponseDecoder(null); | |
| 1801 switch (event) { | |
| 1802 case "server.connected": | |
| 1803 outOfTestExpect(params, isServerConnectedParams); | |
| 1804 _onServerConnected | |
| 1805 .add(new ServerConnectedParams.fromJson(decoder, 'params', params)); | |
| 1806 break; | |
| 1807 case "server.error": | |
| 1808 outOfTestExpect(params, isServerErrorParams); | |
| 1809 _onServerError | |
| 1810 .add(new ServerErrorParams.fromJson(decoder, 'params', params)); | |
| 1811 break; | |
| 1812 case "server.status": | |
| 1813 outOfTestExpect(params, isServerStatusParams); | |
| 1814 _onServerStatus | |
| 1815 .add(new ServerStatusParams.fromJson(decoder, 'params', params)); | |
| 1816 break; | |
| 1817 case "analysis.analyzedFiles": | |
| 1818 outOfTestExpect(params, isAnalysisAnalyzedFilesParams); | |
| 1819 _onAnalysisAnalyzedFiles.add(new AnalysisAnalyzedFilesParams.fromJson( | |
| 1820 decoder, 'params', params)); | |
| 1821 break; | |
| 1822 case "analysis.errors": | |
| 1823 outOfTestExpect(params, isAnalysisErrorsParams); | |
| 1824 _onAnalysisErrors | |
| 1825 .add(new AnalysisErrorsParams.fromJson(decoder, 'params', params)); | |
| 1826 break; | |
| 1827 case "analysis.flushResults": | |
| 1828 outOfTestExpect(params, isAnalysisFlushResultsParams); | |
| 1829 _onAnalysisFlushResults.add( | |
| 1830 new AnalysisFlushResultsParams.fromJson(decoder, 'params', params)); | |
| 1831 break; | |
| 1832 case "analysis.folding": | |
| 1833 outOfTestExpect(params, isAnalysisFoldingParams); | |
| 1834 _onAnalysisFolding | |
| 1835 .add(new AnalysisFoldingParams.fromJson(decoder, 'params', params)); | |
| 1836 break; | |
| 1837 case "analysis.highlights": | |
| 1838 outOfTestExpect(params, isAnalysisHighlightsParams); | |
| 1839 _onAnalysisHighlights.add( | |
| 1840 new AnalysisHighlightsParams.fromJson(decoder, 'params', params)); | |
| 1841 break; | |
| 1842 case "analysis.implemented": | |
| 1843 outOfTestExpect(params, isAnalysisImplementedParams); | |
| 1844 _onAnalysisImplemented.add( | |
| 1845 new AnalysisImplementedParams.fromJson(decoder, 'params', params)); | |
| 1846 break; | |
| 1847 case "analysis.invalidate": | |
| 1848 outOfTestExpect(params, isAnalysisInvalidateParams); | |
| 1849 _onAnalysisInvalidate.add( | |
| 1850 new AnalysisInvalidateParams.fromJson(decoder, 'params', params)); | |
| 1851 break; | |
| 1852 case "analysis.navigation": | |
| 1853 outOfTestExpect(params, isAnalysisNavigationParams); | |
| 1854 _onAnalysisNavigation.add( | |
| 1855 new AnalysisNavigationParams.fromJson(decoder, 'params', params)); | |
| 1856 break; | |
| 1857 case "analysis.occurrences": | |
| 1858 outOfTestExpect(params, isAnalysisOccurrencesParams); | |
| 1859 _onAnalysisOccurrences.add( | |
| 1860 new AnalysisOccurrencesParams.fromJson(decoder, 'params', params)); | |
| 1861 break; | |
| 1862 case "analysis.outline": | |
| 1863 outOfTestExpect(params, isAnalysisOutlineParams); | |
| 1864 _onAnalysisOutline | |
| 1865 .add(new AnalysisOutlineParams.fromJson(decoder, 'params', params)); | |
| 1866 break; | |
| 1867 case "analysis.overrides": | |
| 1868 outOfTestExpect(params, isAnalysisOverridesParams); | |
| 1869 _onAnalysisOverrides.add( | |
| 1870 new AnalysisOverridesParams.fromJson(decoder, 'params', params)); | |
| 1871 break; | |
| 1872 case "completion.results": | |
| 1873 outOfTestExpect(params, isCompletionResultsParams); | |
| 1874 _onCompletionResults.add( | |
| 1875 new CompletionResultsParams.fromJson(decoder, 'params', params)); | |
| 1876 break; | |
| 1877 case "search.results": | |
| 1878 outOfTestExpect(params, isSearchResultsParams); | |
| 1879 _onSearchResults | |
| 1880 .add(new SearchResultsParams.fromJson(decoder, 'params', params)); | |
| 1881 break; | |
| 1882 case "execution.launchData": | |
| 1883 outOfTestExpect(params, isExecutionLaunchDataParams); | |
| 1884 _onExecutionLaunchData.add( | |
| 1885 new ExecutionLaunchDataParams.fromJson(decoder, 'params', params)); | |
| 1886 break; | |
| 1887 default: | |
| 1888 fail('Unexpected notification: $event'); | |
| 1889 break; | |
| 1890 } | |
| 1891 } | |
| 1892 } | |
| OLD | NEW |