| 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 domain.completion; | 5 library domain.completion; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 9 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
| 10 import 'package:analysis_server/src/analysis_server.dart'; | 10 import 'package:analysis_server/src/analysis_server.dart'; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 // extract and validate params | 131 // extract and validate params |
| 132 CompletionGetSuggestionsParams params = | 132 CompletionGetSuggestionsParams params = |
| 133 new CompletionGetSuggestionsParams.fromRequest(request); | 133 new CompletionGetSuggestionsParams.fromRequest(request); |
| 134 | 134 |
| 135 AnalysisResult result; | 135 AnalysisResult result; |
| 136 AnalysisContext context; | 136 AnalysisContext context; |
| 137 Source source; | 137 Source source; |
| 138 if (server.options.enableNewAnalysisDriver) { | 138 if (server.options.enableNewAnalysisDriver) { |
| 139 result = await server.getAnalysisResult(params.file); | 139 result = await server.getAnalysisResult(params.file); |
| 140 | 140 |
| 141 if (result == null) { | 141 if (result == null || !result.exists) { |
| 142 server.sendResponse(new Response.unknownSource(request)); | 142 server.sendResponse(new Response.unknownSource(request)); |
| 143 return; | 143 return; |
| 144 } | 144 } |
| 145 | 145 |
| 146 if (params.offset < 0 || params.offset > result.content.length) { | 146 if (params.offset < 0 || params.offset > result.content.length) { |
| 147 server.sendResponse(new Response.invalidParameter( | 147 server.sendResponse(new Response.invalidParameter( |
| 148 request, | 148 request, |
| 149 'params.offset', | 149 'params.offset', |
| 150 'Expected offset between 0 and source length inclusive,' | 150 'Expected offset between 0 and source length inclusive,' |
| 151 ' but found ${params.offset}')); | 151 ' but found ${params.offset}')); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 final int replacementOffset; | 277 final int replacementOffset; |
| 278 | 278 |
| 279 /** | 279 /** |
| 280 * The suggested completions. | 280 * The suggested completions. |
| 281 */ | 281 */ |
| 282 final List<CompletionSuggestion> suggestions; | 282 final List<CompletionSuggestion> suggestions; |
| 283 | 283 |
| 284 CompletionResult( | 284 CompletionResult( |
| 285 this.replacementOffset, this.replacementLength, this.suggestions); | 285 this.replacementOffset, this.replacementLength, this.suggestions); |
| 286 } | 286 } |
| OLD | NEW |