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'; | 7 import 'package:analysis_server/src/analysis_server.dart'; |
8 import 'package:analysis_server/src/protocol.dart'; | 8 import 'package:analysis_server/src/protocol.dart'; |
9 import 'package:analyzer/src/generated/engine.dart'; | 9 import 'package:analyzer/src/generated/engine.dart'; |
10 import 'package:analyzer/src/generated/java_io.dart'; | 10 import 'package:analyzer/src/generated/java_io.dart'; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 // TODO(brianwilkerson) Use the information from the request to set the | 110 // TODO(brianwilkerson) Use the information from the request to set the |
111 // source factory in the context. | 111 // source factory in the context. |
112 DirectoryBasedDartSdk sdk; | 112 DirectoryBasedDartSdk sdk; |
113 try { | 113 try { |
114 sdk = new DirectoryBasedDartSdk(new JavaFile(sdkDirectory)); | 114 sdk = new DirectoryBasedDartSdk(new JavaFile(sdkDirectory)); |
115 } on Exception catch (e) { | 115 } on Exception catch (e) { |
116 // TODO what error code should be returned here? | 116 // TODO what error code should be returned here? |
117 return new Response(request.id, new RequestError( | 117 return new Response(request.id, new RequestError( |
118 RequestError.CODE_SDK_ERROR, 'Failed to access sdk: $e')); | 118 RequestError.CODE_SDK_ERROR, 'Failed to access sdk: $e')); |
119 } | 119 } |
120 context.sourceFactory = new SourceFactory.con2([ | 120 context.sourceFactory = new SourceFactory([ |
121 new DartUriResolver(sdk), | 121 new DartUriResolver(sdk), |
122 new FileUriResolver(), | 122 new FileUriResolver(), |
123 // new PackageUriResolver(), | 123 // new PackageUriResolver(), |
124 ]); | 124 ]); |
125 server.contextMap[contextId] = context; | 125 server.contextMap[contextId] = context; |
126 | 126 |
127 Response response = new Response(request.id); | 127 Response response = new Response(request.id); |
128 response.setResult(CONTEXT_ID_RESULT, contextId); | 128 response.setResult(CONTEXT_ID_RESULT, contextId); |
129 return response; | 129 return response; |
130 } | 130 } |
(...skipping 24 matching lines...) Expand all Loading... |
155 | 155 |
156 /** | 156 /** |
157 * Return the version number of the analysis server. | 157 * Return the version number of the analysis server. |
158 */ | 158 */ |
159 Response version(Request request) { | 159 Response version(Request request) { |
160 Response response = new Response(request.id); | 160 Response response = new Response(request.id); |
161 response.setResult(VERSION_RESULT, '0.0.1'); | 161 response.setResult(VERSION_RESULT, '0.0.1'); |
162 return response; | 162 return response; |
163 } | 163 } |
164 } | 164 } |
OLD | NEW |