OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'package:analyzer/file_system/file_system.dart'; | 5 import 'package:analyzer/file_system/file_system.dart'; |
| 6 import 'package:analyzer/file_system/physical_file_system.dart'; |
6 import 'package:analyzer/src/dart/analysis/driver.dart' | 7 import 'package:analyzer/src/dart/analysis/driver.dart' |
7 show AnalysisDriverGeneric, AnalysisDriverScheduler, PerformanceLog; | 8 show AnalysisDriverGeneric, AnalysisDriverScheduler, PerformanceLog; |
8 import 'package:analyzer/src/dart/analysis/file_state.dart'; | 9 import 'package:analyzer/src/dart/analysis/file_state.dart'; |
9 import 'package:analyzer/src/generated/source.dart'; | 10 import 'package:analyzer/src/generated/source.dart'; |
10 import 'package:analyzer_plugin/channel/channel.dart'; | 11 import 'package:analyzer_plugin/channel/channel.dart'; |
11 import 'package:analyzer_plugin/protocol/protocol.dart'; | 12 import 'package:analyzer_plugin/protocol/protocol.dart'; |
12 import 'package:analyzer_plugin/protocol/protocol_constants.dart'; | 13 import 'package:analyzer_plugin/protocol/protocol_constants.dart'; |
13 import 'package:analyzer_plugin/protocol/protocol_generated.dart'; | 14 import 'package:analyzer_plugin/protocol/protocol_generated.dart'; |
14 import 'package:analyzer_plugin/src/protocol/protocol_internal.dart'; | 15 import 'package:analyzer_plugin/src/protocol/protocol_internal.dart'; |
15 import 'package:analyzer_plugin/src/utilities/null_string_sink.dart'; | 16 import 'package:analyzer_plugin/src/utilities/null_string_sink.dart'; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 /** | 77 /** |
77 * The file content overlay used by any analysis drivers that are created. | 78 * The file content overlay used by any analysis drivers that are created. |
78 */ | 79 */ |
79 final FileContentOverlay fileContentOverlay = new FileContentOverlay(); | 80 final FileContentOverlay fileContentOverlay = new FileContentOverlay(); |
80 | 81 |
81 /** | 82 /** |
82 * Initialize a newly created analysis server plugin. If a resource [provider] | 83 * Initialize a newly created analysis server plugin. If a resource [provider] |
83 * is given, then it will be used to access the file system. Otherwise a | 84 * is given, then it will be used to access the file system. Otherwise a |
84 * resource provider that accesses the physical file system will be used. | 85 * resource provider that accesses the physical file system will be used. |
85 */ | 86 */ |
86 ServerPlugin(this.resourceProvider) { | 87 ServerPlugin(ResourceProvider provider) |
| 88 : resourceProvider = provider ?? PhysicalResourceProvider.INSTANCE { |
87 analysisDriverScheduler = new AnalysisDriverScheduler(performanceLog); | 89 analysisDriverScheduler = new AnalysisDriverScheduler(performanceLog); |
88 analysisDriverScheduler.start(); | 90 analysisDriverScheduler.start(); |
89 } | 91 } |
90 | 92 |
91 /** | 93 /** |
92 * Return the byte store used by any analysis drivers that are created, or | 94 * Return the byte store used by any analysis drivers that are created, or |
93 * `null` if the cache location isn't known because the 'plugin.version' | 95 * `null` if the cache location isn't known because the 'plugin.version' |
94 * request has not yet been received. | 96 * request has not yet been received. |
95 */ | 97 */ |
96 ByteStore get byteStore => _byteStore; | 98 ByteStore get byteStore => _byteStore; |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 response = new Response(id, | 527 response = new Response(id, |
526 error: new RequestError( | 528 error: new RequestError( |
527 RequestErrorCode.PLUGIN_ERROR, exception.toString(), | 529 RequestErrorCode.PLUGIN_ERROR, exception.toString(), |
528 stackTrace: stackTrace.toString())); | 530 stackTrace: stackTrace.toString())); |
529 } | 531 } |
530 if (response != null) { | 532 if (response != null) { |
531 _channel.sendResponse(response); | 533 _channel.sendResponse(response); |
532 } | 534 } |
533 } | 535 } |
534 } | 536 } |
OLD | NEW |