1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | Object.defineProperty(exports, "__esModule", { value: true });
|
18 | exports.bindResourceProvider = exports.bindPreferenceService = exports.bindMessageService = void 0;
|
19 | const common_1 = require("../common");
|
20 | const preferences_1 = require("./preferences");
|
21 | const injectable_preference_proxy_1 = require("./preferences/injectable-preference-proxy");
|
22 | function bindMessageService(bind) {
|
23 | bind(common_1.MessageClient).toSelf().inSingletonScope();
|
24 | return bind(common_1.MessageService).toSelf().inSingletonScope();
|
25 | }
|
26 | exports.bindMessageService = bindMessageService;
|
27 | function bindPreferenceService(bind) {
|
28 | bind(preferences_1.PreferenceProvider).toSelf().inSingletonScope().whenTargetNamed(preferences_1.PreferenceScope.User);
|
29 | bind(preferences_1.PreferenceProvider).toSelf().inSingletonScope().whenTargetNamed(preferences_1.PreferenceScope.Workspace);
|
30 | bind(preferences_1.PreferenceProvider).toSelf().inSingletonScope().whenTargetNamed(preferences_1.PreferenceScope.Folder);
|
31 | bind(preferences_1.PreferenceProviderProvider).toFactory(ctx => (scope) => {
|
32 | if (scope === preferences_1.PreferenceScope.Default) {
|
33 | return ctx.container.get(preferences_1.PreferenceSchemaProvider);
|
34 | }
|
35 | return ctx.container.getNamed(preferences_1.PreferenceProvider, scope);
|
36 | });
|
37 | bind(preferences_1.PreferenceServiceImpl).toSelf().inSingletonScope();
|
38 | bind(preferences_1.PreferenceService).toService(preferences_1.PreferenceServiceImpl);
|
39 | (0, preferences_1.bindPreferenceSchemaProvider)(bind);
|
40 | bind(preferences_1.PreferenceValidationService).toSelf().inSingletonScope();
|
41 | bind(injectable_preference_proxy_1.InjectablePreferenceProxy).toSelf();
|
42 | bind(injectable_preference_proxy_1.PreferenceProxyFactory).toFactory(({ container }) => (schema, options = {}) => {
|
43 | const child = container.createChild();
|
44 | child.bind(preferences_1.PreferenceProxyOptions).toConstantValue(options !== null && options !== void 0 ? options : {});
|
45 | child.bind(injectable_preference_proxy_1.PreferenceProxySchema).toConstantValue(() => schema);
|
46 | const handler = child.get(injectable_preference_proxy_1.InjectablePreferenceProxy);
|
47 | return new Proxy(Object.create(null), handler);
|
48 | });
|
49 | }
|
50 | exports.bindPreferenceService = bindPreferenceService;
|
51 | function bindResourceProvider(bind) {
|
52 | bind(common_1.DefaultResourceProvider).toSelf().inSingletonScope();
|
53 | bind(common_1.ResourceProvider).toProvider(context => uri => context.container.get(common_1.DefaultResourceProvider).get(uri));
|
54 | (0, common_1.bindContributionProvider)(bind, common_1.ResourceResolver);
|
55 | }
|
56 | exports.bindResourceProvider = bindResourceProvider;
|
57 |
|
\ | No newline at end of file |