| 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.server; | 5 library domain.server; |
| 6 | 6 |
| 7 import 'package:analysis_server/src/analysis_server.dart'; |
| 8 import 'package:analysis_server/src/protocol.dart'; |
| 7 import 'package:analyzer/src/generated/engine.dart'; | 9 import 'package:analyzer/src/generated/engine.dart'; |
| 8 import 'package:analyzer/src/generated/java_io.dart'; | 10 import 'package:analyzer/src/generated/java_io.dart'; |
| 9 import 'package:analyzer/src/generated/sdk_io.dart'; | 11 import 'package:analyzer/src/generated/sdk_io.dart'; |
| 10 import 'package:analyzer/src/generated/source.dart'; | 12 import 'package:analyzer/src/generated/source.dart'; |
| 11 import 'package:analyzer/src/generated/source_io.dart'; | 13 import 'package:analyzer/src/generated/source_io.dart'; |
| 12 | 14 |
| 13 import 'analysis_server.dart'; | |
| 14 import 'protocol.dart'; | |
| 15 | |
| 16 /** | 15 /** |
| 17 * Instances of the class [ServerDomainHandler] implement a [RequestHandler] | 16 * Instances of the class [ServerDomainHandler] implement a [RequestHandler] |
| 18 * that handles requests in the server domain. | 17 * that handles requests in the server domain. |
| 19 */ | 18 */ |
| 20 class ServerDomainHandler implements RequestHandler { | 19 class ServerDomainHandler implements RequestHandler { |
| 21 /** | 20 /** |
| 22 * The name of the server.createContext request. | 21 * The name of the server.createContext request. |
| 23 */ | 22 */ |
| 24 static const String CREATE_CONTEXT_METHOD = 'server.createContext'; | 23 static const String CREATE_CONTEXT_METHOD = 'server.createContext'; |
| 25 | 24 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 } | 108 } |
| 110 AnalysisContext context = AnalysisEngine.instance.createAnalysisContext(); | 109 AnalysisContext context = AnalysisEngine.instance.createAnalysisContext(); |
| 111 // TODO(brianwilkerson) Use the information from the request to set the | 110 // TODO(brianwilkerson) Use the information from the request to set the |
| 112 // source factory in the context. | 111 // source factory in the context. |
| 113 context.sourceFactory = new SourceFactory.con2([ | 112 context.sourceFactory = new SourceFactory.con2([ |
| 114 new DartUriResolver(new DirectoryBasedDartSdk(new JavaFile(sdkDirectory)))
, | 113 new DartUriResolver(new DirectoryBasedDartSdk(new JavaFile(sdkDirectory)))
, |
| 115 new FileUriResolver(), | 114 new FileUriResolver(), |
| 116 // new PackageUriResolver(), | 115 // new PackageUriResolver(), |
| 117 ]); | 116 ]); |
| 118 server.contextMap[contextId] = context; | 117 server.contextMap[contextId] = context; |
| 119 | 118 |
| 120 Response response = new Response(request.id); | 119 Response response = new Response(request.id); |
| 121 response.setResult(CONTEXT_ID_RESULT, contextId); | 120 response.setResult(CONTEXT_ID_RESULT, contextId); |
| 122 return response; | 121 return response; |
| 123 } | 122 } |
| 124 | 123 |
| 125 /** | 124 /** |
| 126 * Delete the context with the given id. Future attempts to use the context id | 125 * Delete the context with the given id. Future attempts to use the context id |
| 127 * will result in an error being returned. | 126 * will result in an error being returned. |
| 128 */ | 127 */ |
| 129 Response deleteContext(Request request) { | 128 Response deleteContext(Request request) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 148 | 147 |
| 149 /** | 148 /** |
| 150 * Return the version number of the analysis server. | 149 * Return the version number of the analysis server. |
| 151 */ | 150 */ |
| 152 Response version(Request request) { | 151 Response version(Request request) { |
| 153 Response response = new Response(request.id); | 152 Response response = new Response(request.id); |
| 154 response.setResult(VERSION_RESULT, '0.0.1'); | 153 response.setResult(VERSION_RESULT, '0.0.1'); |
| 155 return response; | 154 return response; |
| 156 } | 155 } |
| 157 } | 156 } |
| OLD | NEW |