@theia/vsx-registry 1.53.0-next.5 → 1.53.0-next.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +45 -45
  2. package/lib/common/vsx-environment.d.ts +1 -0
  3. package/lib/common/vsx-environment.d.ts.map +1 -1
  4. package/lib/common/vsx-registry-common-module.d.ts.map +1 -1
  5. package/lib/common/vsx-registry-common-module.js +9 -3
  6. package/lib/common/vsx-registry-common-module.js.map +1 -1
  7. package/lib/node/vsx-cli.d.ts +1 -0
  8. package/lib/node/vsx-cli.d.ts.map +1 -1
  9. package/lib/node/vsx-cli.js +4 -0
  10. package/lib/node/vsx-cli.js.map +1 -1
  11. package/lib/node/vsx-environment-impl.d.ts +1 -0
  12. package/lib/node/vsx-environment-impl.d.ts.map +1 -1
  13. package/lib/node/vsx-environment-impl.js +3 -0
  14. package/lib/node/vsx-environment-impl.js.map +1 -1
  15. package/lib/node/vsx-extension-resolver.js +3 -3
  16. package/lib/node/vsx-extension-resolver.js.map +1 -1
  17. package/package.json +12 -11
  18. package/src/browser/recommended-extensions/preference-provider-overrides.ts +99 -99
  19. package/src/browser/recommended-extensions/recommended-extensions-json-schema.ts +74 -74
  20. package/src/browser/recommended-extensions/recommended-extensions-preference-contribution.ts +68 -68
  21. package/src/browser/style/extensions.svg +4 -4
  22. package/src/browser/style/index.css +436 -436
  23. package/src/browser/vsx-extension-argument-processor.ts +32 -32
  24. package/src/browser/vsx-extension-commands.ts +68 -68
  25. package/src/browser/vsx-extension-editor-manager.ts +42 -42
  26. package/src/browser/vsx-extension-editor.tsx +96 -96
  27. package/src/browser/vsx-extension.tsx +710 -710
  28. package/src/browser/vsx-extensions-contribution.ts +373 -373
  29. package/src/browser/vsx-extensions-model.ts +456 -456
  30. package/src/browser/vsx-extensions-preferences.ts +58 -58
  31. package/src/browser/vsx-extensions-search-bar.tsx +107 -107
  32. package/src/browser/vsx-extensions-search-model.ts +61 -61
  33. package/src/browser/vsx-extensions-source.ts +83 -83
  34. package/src/browser/vsx-extensions-view-container.ts +179 -179
  35. package/src/browser/vsx-extensions-widget.tsx +165 -165
  36. package/src/browser/vsx-language-quick-pick-service.ts +112 -112
  37. package/src/browser/vsx-registry-frontend-module.ts +113 -113
  38. package/src/common/index.ts +19 -19
  39. package/src/common/ovsx-client-provider.ts +35 -35
  40. package/src/common/vsx-environment.ts +28 -27
  41. package/src/common/vsx-extension-uri.ts +20 -20
  42. package/src/common/vsx-registry-common-module.ts +85 -78
  43. package/src/node/vsx-cli-deployer-participant.ts +46 -46
  44. package/src/node/vsx-cli.ts +55 -51
  45. package/src/node/vsx-environment-impl.ts +54 -50
  46. package/src/node/vsx-extension-resolver.ts +134 -134
  47. package/src/node/vsx-registry-backend-module.ts +38 -38
  48. package/src/node/vsx-remote-cli.ts +39 -39
  49. package/src/package.spec.ts +29 -29
@@ -1,58 +1,58 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2023 Ericsson and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { interfaces } from '@theia/core/shared/inversify';
18
- import {
19
- createPreferenceProxy,
20
- PreferenceProxy,
21
- PreferenceService,
22
- PreferenceSchema,
23
- PreferenceContribution
24
- } from '@theia/core/lib/browser/preferences';
25
- import { nls } from '@theia/core';
26
-
27
- export const VsxExtensionsPreferenceSchema: PreferenceSchema = {
28
- 'type': 'object',
29
- properties: {
30
- 'extensions.onlyShowVerifiedExtensions': {
31
- type: 'boolean',
32
- default: false,
33
- description: nls.localize('theia/vsx-registry/onlyShowVerifiedExtensionsDescription', 'This allows the {0} to only show verified extensions.', 'Open VSX Registry')
34
- },
35
- }
36
- };
37
-
38
- export interface VsxExtensionsConfiguration {
39
- 'extensions.onlyShowVerifiedExtensions': boolean;
40
- }
41
-
42
- export const VsxExtensionsPreferenceContribution = Symbol('VsxExtensionsPreferenceContribution');
43
- export const VsxExtensionsPreferences = Symbol('VsxExtensionsPreferences');
44
- export type VsxExtensionsPreferences = PreferenceProxy<VsxExtensionsConfiguration>;
45
-
46
- export function createVsxExtensionsPreferences(preferences: PreferenceService, schema: PreferenceSchema = VsxExtensionsPreferenceSchema): VsxExtensionsPreferences {
47
- return createPreferenceProxy(preferences, schema);
48
- }
49
-
50
- export function bindVsxExtensionsPreferences(bind: interfaces.Bind): void {
51
- bind(VsxExtensionsPreferences).toDynamicValue(ctx => {
52
- const preferences = ctx.container.get<PreferenceService>(PreferenceService);
53
- const contribution = ctx.container.get<PreferenceContribution>(VsxExtensionsPreferenceContribution);
54
- return createVsxExtensionsPreferences(preferences, contribution.schema);
55
- }).inSingletonScope();
56
- bind(VsxExtensionsPreferenceContribution).toConstantValue({ schema: VsxExtensionsPreferenceSchema });
57
- bind(PreferenceContribution).toService(VsxExtensionsPreferenceContribution);
58
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2023 Ericsson and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { interfaces } from '@theia/core/shared/inversify';
18
+ import {
19
+ createPreferenceProxy,
20
+ PreferenceProxy,
21
+ PreferenceService,
22
+ PreferenceSchema,
23
+ PreferenceContribution
24
+ } from '@theia/core/lib/browser/preferences';
25
+ import { nls } from '@theia/core';
26
+
27
+ export const VsxExtensionsPreferenceSchema: PreferenceSchema = {
28
+ 'type': 'object',
29
+ properties: {
30
+ 'extensions.onlyShowVerifiedExtensions': {
31
+ type: 'boolean',
32
+ default: false,
33
+ description: nls.localize('theia/vsx-registry/onlyShowVerifiedExtensionsDescription', 'This allows the {0} to only show verified extensions.', 'Open VSX Registry')
34
+ },
35
+ }
36
+ };
37
+
38
+ export interface VsxExtensionsConfiguration {
39
+ 'extensions.onlyShowVerifiedExtensions': boolean;
40
+ }
41
+
42
+ export const VsxExtensionsPreferenceContribution = Symbol('VsxExtensionsPreferenceContribution');
43
+ export const VsxExtensionsPreferences = Symbol('VsxExtensionsPreferences');
44
+ export type VsxExtensionsPreferences = PreferenceProxy<VsxExtensionsConfiguration>;
45
+
46
+ export function createVsxExtensionsPreferences(preferences: PreferenceService, schema: PreferenceSchema = VsxExtensionsPreferenceSchema): VsxExtensionsPreferences {
47
+ return createPreferenceProxy(preferences, schema);
48
+ }
49
+
50
+ export function bindVsxExtensionsPreferences(bind: interfaces.Bind): void {
51
+ bind(VsxExtensionsPreferences).toDynamicValue(ctx => {
52
+ const preferences = ctx.container.get<PreferenceService>(PreferenceService);
53
+ const contribution = ctx.container.get<PreferenceContribution>(VsxExtensionsPreferenceContribution);
54
+ return createVsxExtensionsPreferences(preferences, contribution.schema);
55
+ }).inSingletonScope();
56
+ bind(VsxExtensionsPreferenceContribution).toConstantValue({ schema: VsxExtensionsPreferenceSchema });
57
+ bind(PreferenceContribution).toService(VsxExtensionsPreferenceContribution);
58
+ }
@@ -1,107 +1,107 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2020 TypeFox and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import * as React from '@theia/core/shared/react';
18
- import { injectable, postConstruct, inject } from '@theia/core/shared/inversify';
19
- import { ReactWidget, Message, codicon } from '@theia/core/lib/browser/widgets';
20
- import { PreferenceService } from '@theia/core/lib/browser';
21
- import { VSXExtensionsSearchModel } from './vsx-extensions-search-model';
22
- import { VSXExtensionsModel } from './vsx-extensions-model';
23
- import { nls } from '@theia/core/lib/common/nls';
24
-
25
- @injectable()
26
- export class VSXExtensionsSearchBar extends ReactWidget {
27
-
28
- @inject(VSXExtensionsModel)
29
- protected readonly extensionsModel: VSXExtensionsModel;
30
-
31
- @inject(VSXExtensionsSearchModel)
32
- protected readonly searchModel: VSXExtensionsSearchModel;
33
-
34
- @inject(PreferenceService)
35
- protected readonly preferenceService: PreferenceService;
36
-
37
- protected input: HTMLInputElement | undefined;
38
- protected onlyShowVerifiedExtensions: boolean | undefined;
39
-
40
- @postConstruct()
41
- protected init(): void {
42
- this.onlyShowVerifiedExtensions = this.preferenceService.get('extensions.onlyShowVerifiedExtensions');
43
- this.id = 'vsx-extensions-search-bar';
44
- this.addClass('theia-vsx-extensions-search-bar');
45
- this.searchModel.onDidChangeQuery((query: string) => this.updateSearchTerm(query));
46
- this.preferenceService.onPreferenceChanged(change => {
47
- if (change.preferenceName === 'extensions.onlyShowVerifiedExtensions') {
48
- this.extensionsModel.setOnlyShowVerifiedExtensions(!!change.newValue);
49
- this.onlyShowVerifiedExtensions = change.newValue;
50
- this.update();
51
- }
52
- });
53
- }
54
-
55
- protected render(): React.ReactNode {
56
- return <div className='vsx-search-container'>
57
- <input type='text'
58
- ref={input => this.input = input || undefined}
59
- defaultValue={this.searchModel.query}
60
- spellCheck={false}
61
- className='theia-input'
62
- placeholder={nls.localize('theia/vsx-registry/searchPlaceholder', 'Search Extensions in {0}', 'Open VSX Registry')}
63
- onChange={this.updateQuery}>
64
- </input>
65
- {this.renderOptionContainer()}
66
- </div>;
67
- }
68
-
69
- protected updateQuery = (e: React.ChangeEvent<HTMLInputElement>) => this.searchModel.query = e.target.value;
70
-
71
- protected updateSearchTerm(term: string): void {
72
- if (this.input) {
73
- this.input.value = term;
74
- }
75
- }
76
-
77
- protected renderOptionContainer(): React.ReactNode {
78
- const showVerifiedExtensions = this.renderShowVerifiedExtensions();
79
- return <div className='option-buttons'>{showVerifiedExtensions}</div>;
80
- }
81
-
82
- protected renderShowVerifiedExtensions(): React.ReactNode {
83
- return <span
84
- className={`${codicon('verified')} option action-label ${this.onlyShowVerifiedExtensions ? 'enabled' : ''}`}
85
- title={nls.localize('theia/vsx-registry/onlyShowVerifiedExtensionsTitle', 'Only Show Verified Extensions')}
86
- onClick={() => this.handleShowVerifiedExtensionsClick()}>
87
- </span>;
88
- }
89
-
90
- protected handleShowVerifiedExtensionsClick(): void {
91
- this.extensionsModel.setOnlyShowVerifiedExtensions(!this.onlyShowVerifiedExtensions);
92
- this.update();
93
- }
94
-
95
- protected override onActivateRequest(msg: Message): void {
96
- super.onActivateRequest(msg);
97
- if (this.input) {
98
- this.input.focus();
99
- }
100
- }
101
-
102
- protected override onAfterAttach(msg: Message): void {
103
- super.onAfterAttach(msg);
104
- this.update();
105
- }
106
-
107
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2020 TypeFox and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import * as React from '@theia/core/shared/react';
18
+ import { injectable, postConstruct, inject } from '@theia/core/shared/inversify';
19
+ import { ReactWidget, Message, codicon } from '@theia/core/lib/browser/widgets';
20
+ import { PreferenceService } from '@theia/core/lib/browser';
21
+ import { VSXExtensionsSearchModel } from './vsx-extensions-search-model';
22
+ import { VSXExtensionsModel } from './vsx-extensions-model';
23
+ import { nls } from '@theia/core/lib/common/nls';
24
+
25
+ @injectable()
26
+ export class VSXExtensionsSearchBar extends ReactWidget {
27
+
28
+ @inject(VSXExtensionsModel)
29
+ protected readonly extensionsModel: VSXExtensionsModel;
30
+
31
+ @inject(VSXExtensionsSearchModel)
32
+ protected readonly searchModel: VSXExtensionsSearchModel;
33
+
34
+ @inject(PreferenceService)
35
+ protected readonly preferenceService: PreferenceService;
36
+
37
+ protected input: HTMLInputElement | undefined;
38
+ protected onlyShowVerifiedExtensions: boolean | undefined;
39
+
40
+ @postConstruct()
41
+ protected init(): void {
42
+ this.onlyShowVerifiedExtensions = this.preferenceService.get('extensions.onlyShowVerifiedExtensions');
43
+ this.id = 'vsx-extensions-search-bar';
44
+ this.addClass('theia-vsx-extensions-search-bar');
45
+ this.searchModel.onDidChangeQuery((query: string) => this.updateSearchTerm(query));
46
+ this.preferenceService.onPreferenceChanged(change => {
47
+ if (change.preferenceName === 'extensions.onlyShowVerifiedExtensions') {
48
+ this.extensionsModel.setOnlyShowVerifiedExtensions(!!change.newValue);
49
+ this.onlyShowVerifiedExtensions = change.newValue;
50
+ this.update();
51
+ }
52
+ });
53
+ }
54
+
55
+ protected render(): React.ReactNode {
56
+ return <div className='vsx-search-container'>
57
+ <input type='text'
58
+ ref={input => this.input = input || undefined}
59
+ defaultValue={this.searchModel.query}
60
+ spellCheck={false}
61
+ className='theia-input'
62
+ placeholder={nls.localize('theia/vsx-registry/searchPlaceholder', 'Search Extensions in {0}', 'Open VSX Registry')}
63
+ onChange={this.updateQuery}>
64
+ </input>
65
+ {this.renderOptionContainer()}
66
+ </div>;
67
+ }
68
+
69
+ protected updateQuery = (e: React.ChangeEvent<HTMLInputElement>) => this.searchModel.query = e.target.value;
70
+
71
+ protected updateSearchTerm(term: string): void {
72
+ if (this.input) {
73
+ this.input.value = term;
74
+ }
75
+ }
76
+
77
+ protected renderOptionContainer(): React.ReactNode {
78
+ const showVerifiedExtensions = this.renderShowVerifiedExtensions();
79
+ return <div className='option-buttons'>{showVerifiedExtensions}</div>;
80
+ }
81
+
82
+ protected renderShowVerifiedExtensions(): React.ReactNode {
83
+ return <span
84
+ className={`${codicon('verified')} option action-label ${this.onlyShowVerifiedExtensions ? 'enabled' : ''}`}
85
+ title={nls.localize('theia/vsx-registry/onlyShowVerifiedExtensionsTitle', 'Only Show Verified Extensions')}
86
+ onClick={() => this.handleShowVerifiedExtensionsClick()}>
87
+ </span>;
88
+ }
89
+
90
+ protected handleShowVerifiedExtensionsClick(): void {
91
+ this.extensionsModel.setOnlyShowVerifiedExtensions(!this.onlyShowVerifiedExtensions);
92
+ this.update();
93
+ }
94
+
95
+ protected override onActivateRequest(msg: Message): void {
96
+ super.onActivateRequest(msg);
97
+ if (this.input) {
98
+ this.input.focus();
99
+ }
100
+ }
101
+
102
+ protected override onAfterAttach(msg: Message): void {
103
+ super.onAfterAttach(msg);
104
+ this.update();
105
+ }
106
+
107
+ }
@@ -1,61 +1,61 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2020 TypeFox and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { injectable } from '@theia/core/shared/inversify';
18
- import { Emitter } from '@theia/core/lib/common/event';
19
-
20
- export enum VSXSearchMode {
21
- Initial,
22
- None,
23
- Search,
24
- Installed,
25
- Builtin,
26
- Recommended,
27
- }
28
-
29
- export const BUILTIN_QUERY = '@builtin';
30
- export const INSTALLED_QUERY = '@installed';
31
- export const RECOMMENDED_QUERY = '@recommended';
32
-
33
- @injectable()
34
- export class VSXExtensionsSearchModel {
35
-
36
- protected readonly onDidChangeQueryEmitter = new Emitter<string>();
37
- readonly onDidChangeQuery = this.onDidChangeQueryEmitter.event;
38
- protected readonly specialQueries = new Map<string, VSXSearchMode>([
39
- [BUILTIN_QUERY, VSXSearchMode.Builtin],
40
- [INSTALLED_QUERY, VSXSearchMode.Installed],
41
- [RECOMMENDED_QUERY, VSXSearchMode.Recommended],
42
- ]);
43
-
44
- protected _query = '';
45
- set query(query: string) {
46
- if (this._query === query) {
47
- return;
48
- }
49
- this._query = query;
50
- this.onDidChangeQueryEmitter.fire(this._query);
51
- }
52
- get query(): string {
53
- return this._query;
54
- }
55
-
56
- getModeForQuery(): VSXSearchMode {
57
- return this.query
58
- ? this.specialQueries.get(this.query) ?? VSXSearchMode.Search
59
- : VSXSearchMode.None;
60
- }
61
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2020 TypeFox and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { injectable } from '@theia/core/shared/inversify';
18
+ import { Emitter } from '@theia/core/lib/common/event';
19
+
20
+ export enum VSXSearchMode {
21
+ Initial,
22
+ None,
23
+ Search,
24
+ Installed,
25
+ Builtin,
26
+ Recommended,
27
+ }
28
+
29
+ export const BUILTIN_QUERY = '@builtin';
30
+ export const INSTALLED_QUERY = '@installed';
31
+ export const RECOMMENDED_QUERY = '@recommended';
32
+
33
+ @injectable()
34
+ export class VSXExtensionsSearchModel {
35
+
36
+ protected readonly onDidChangeQueryEmitter = new Emitter<string>();
37
+ readonly onDidChangeQuery = this.onDidChangeQueryEmitter.event;
38
+ protected readonly specialQueries = new Map<string, VSXSearchMode>([
39
+ [BUILTIN_QUERY, VSXSearchMode.Builtin],
40
+ [INSTALLED_QUERY, VSXSearchMode.Installed],
41
+ [RECOMMENDED_QUERY, VSXSearchMode.Recommended],
42
+ ]);
43
+
44
+ protected _query = '';
45
+ set query(query: string) {
46
+ if (this._query === query) {
47
+ return;
48
+ }
49
+ this._query = query;
50
+ this.onDidChangeQueryEmitter.fire(this._query);
51
+ }
52
+ get query(): string {
53
+ return this._query;
54
+ }
55
+
56
+ getModeForQuery(): VSXSearchMode {
57
+ return this.query
58
+ ? this.specialQueries.get(this.query) ?? VSXSearchMode.Search
59
+ : VSXSearchMode.None;
60
+ }
61
+ }
@@ -1,83 +1,83 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2020 TypeFox and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
18
- import { TreeSource, TreeElement } from '@theia/core/lib/browser/source-tree';
19
- import { VSXExtensionsModel } from './vsx-extensions-model';
20
- import debounce = require('@theia/core/shared/lodash.debounce');
21
-
22
- @injectable()
23
- export class VSXExtensionsSourceOptions {
24
- static INSTALLED = 'installed';
25
- static BUILT_IN = 'builtin';
26
- static SEARCH_RESULT = 'searchResult';
27
- static RECOMMENDED = 'recommended';
28
- readonly id: string;
29
- }
30
-
31
- @injectable()
32
- export class VSXExtensionsSource extends TreeSource {
33
-
34
- @inject(VSXExtensionsSourceOptions)
35
- protected readonly options: VSXExtensionsSourceOptions;
36
-
37
- @inject(VSXExtensionsModel)
38
- protected readonly model: VSXExtensionsModel;
39
-
40
- @postConstruct()
41
- protected init(): void {
42
- this.fireDidChange();
43
- this.toDispose.push(this.model.onDidChange(() => this.scheduleFireDidChange()));
44
- }
45
-
46
- protected scheduleFireDidChange = debounce(() => this.fireDidChange(), 100, { leading: false, trailing: true });
47
-
48
- getModel(): VSXExtensionsModel {
49
- return this.model;
50
- }
51
-
52
- *getElements(): IterableIterator<TreeElement> {
53
- for (const id of this.doGetElements()) {
54
- const extension = this.model.getExtension(id);
55
- if (!extension) {
56
- continue;
57
- }
58
- if (this.options.id === VSXExtensionsSourceOptions.RECOMMENDED) {
59
- if (this.model.isInstalled(id)) {
60
- continue;
61
- }
62
- }
63
- if (this.options.id === VSXExtensionsSourceOptions.BUILT_IN) {
64
- if (extension.builtin) {
65
- yield extension;
66
- }
67
- } else if (!extension.builtin) {
68
- yield extension;
69
- }
70
- }
71
- }
72
-
73
- protected doGetElements(): IterableIterator<string> {
74
- if (this.options.id === VSXExtensionsSourceOptions.SEARCH_RESULT) {
75
- return this.model.searchResult;
76
- }
77
- if (this.options.id === VSXExtensionsSourceOptions.RECOMMENDED) {
78
- return this.model.recommended;
79
- }
80
- return this.model.installed;
81
- }
82
-
83
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2020 TypeFox and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
18
+ import { TreeSource, TreeElement } from '@theia/core/lib/browser/source-tree';
19
+ import { VSXExtensionsModel } from './vsx-extensions-model';
20
+ import debounce = require('@theia/core/shared/lodash.debounce');
21
+
22
+ @injectable()
23
+ export class VSXExtensionsSourceOptions {
24
+ static INSTALLED = 'installed';
25
+ static BUILT_IN = 'builtin';
26
+ static SEARCH_RESULT = 'searchResult';
27
+ static RECOMMENDED = 'recommended';
28
+ readonly id: string;
29
+ }
30
+
31
+ @injectable()
32
+ export class VSXExtensionsSource extends TreeSource {
33
+
34
+ @inject(VSXExtensionsSourceOptions)
35
+ protected readonly options: VSXExtensionsSourceOptions;
36
+
37
+ @inject(VSXExtensionsModel)
38
+ protected readonly model: VSXExtensionsModel;
39
+
40
+ @postConstruct()
41
+ protected init(): void {
42
+ this.fireDidChange();
43
+ this.toDispose.push(this.model.onDidChange(() => this.scheduleFireDidChange()));
44
+ }
45
+
46
+ protected scheduleFireDidChange = debounce(() => this.fireDidChange(), 100, { leading: false, trailing: true });
47
+
48
+ getModel(): VSXExtensionsModel {
49
+ return this.model;
50
+ }
51
+
52
+ *getElements(): IterableIterator<TreeElement> {
53
+ for (const id of this.doGetElements()) {
54
+ const extension = this.model.getExtension(id);
55
+ if (!extension) {
56
+ continue;
57
+ }
58
+ if (this.options.id === VSXExtensionsSourceOptions.RECOMMENDED) {
59
+ if (this.model.isInstalled(id)) {
60
+ continue;
61
+ }
62
+ }
63
+ if (this.options.id === VSXExtensionsSourceOptions.BUILT_IN) {
64
+ if (extension.builtin) {
65
+ yield extension;
66
+ }
67
+ } else if (!extension.builtin) {
68
+ yield extension;
69
+ }
70
+ }
71
+ }
72
+
73
+ protected doGetElements(): IterableIterator<string> {
74
+ if (this.options.id === VSXExtensionsSourceOptions.SEARCH_RESULT) {
75
+ return this.model.searchResult;
76
+ }
77
+ if (this.options.id === VSXExtensionsSourceOptions.RECOMMENDED) {
78
+ return this.model.recommended;
79
+ }
80
+ return this.model.installed;
81
+ }
82
+
83
+ }