@theia/vsx-registry 1.53.0-next.55 → 1.53.0-next.64
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.
- package/README.md +45 -45
- package/package.json +10 -10
- package/src/browser/recommended-extensions/preference-provider-overrides.ts +99 -99
- package/src/browser/recommended-extensions/recommended-extensions-json-schema.ts +74 -74
- package/src/browser/recommended-extensions/recommended-extensions-preference-contribution.ts +68 -68
- package/src/browser/style/extensions.svg +4 -4
- package/src/browser/style/index.css +436 -436
- package/src/browser/vsx-extension-argument-processor.ts +32 -32
- package/src/browser/vsx-extension-commands.ts +68 -68
- package/src/browser/vsx-extension-editor-manager.ts +42 -42
- package/src/browser/vsx-extension-editor.tsx +96 -96
- package/src/browser/vsx-extension.tsx +710 -710
- package/src/browser/vsx-extensions-contribution.ts +373 -373
- package/src/browser/vsx-extensions-model.ts +456 -456
- package/src/browser/vsx-extensions-preferences.ts +58 -58
- package/src/browser/vsx-extensions-search-bar.tsx +107 -107
- package/src/browser/vsx-extensions-search-model.ts +61 -61
- package/src/browser/vsx-extensions-source.ts +83 -83
- package/src/browser/vsx-extensions-view-container.ts +179 -179
- package/src/browser/vsx-extensions-widget.tsx +165 -165
- package/src/browser/vsx-language-quick-pick-service.ts +112 -112
- package/src/browser/vsx-registry-frontend-module.ts +113 -113
- package/src/common/index.ts +19 -19
- package/src/common/ovsx-client-provider.ts +35 -35
- package/src/common/vsx-environment.ts +28 -28
- package/src/common/vsx-extension-uri.ts +20 -20
- package/src/common/vsx-registry-common-module.ts +85 -85
- package/src/node/vsx-cli-deployer-participant.ts +46 -46
- package/src/node/vsx-cli.ts +55 -55
- package/src/node/vsx-environment-impl.ts +54 -54
- package/src/node/vsx-extension-resolver.ts +134 -134
- package/src/node/vsx-registry-backend-module.ts +38 -38
- package/src/node/vsx-remote-cli.ts +39 -39
- package/src/package.spec.ts +29 -29
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2024 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 { ArgumentProcessor } from '@theia/plugin-ext/lib/common/commands';
|
|
19
|
-
import { VSXExtension } from './vsx-extension';
|
|
20
|
-
|
|
21
|
-
@injectable()
|
|
22
|
-
export class VsxExtensionArgumentProcessor implements ArgumentProcessor {
|
|
23
|
-
|
|
24
|
-
processArgument(arg: unknown): unknown {
|
|
25
|
-
if (arg instanceof VSXExtension) {
|
|
26
|
-
return arg.id;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return arg;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2024 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 { ArgumentProcessor } from '@theia/plugin-ext/lib/common/commands';
|
|
19
|
+
import { VSXExtension } from './vsx-extension';
|
|
20
|
+
|
|
21
|
+
@injectable()
|
|
22
|
+
export class VsxExtensionArgumentProcessor implements ArgumentProcessor {
|
|
23
|
+
|
|
24
|
+
processArgument(arg: unknown): unknown {
|
|
25
|
+
if (arg instanceof VSXExtension) {
|
|
26
|
+
return arg.id;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return arg;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
}
|
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2021 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 { nls } from '@theia/core/lib/common/nls';
|
|
18
|
-
import { codicon } from '@theia/core/lib/browser';
|
|
19
|
-
import { Command } from '@theia/core/lib/common';
|
|
20
|
-
|
|
21
|
-
export namespace VSXExtensionsCommands {
|
|
22
|
-
|
|
23
|
-
const EXTENSIONS_CATEGORY = 'Extensions';
|
|
24
|
-
|
|
25
|
-
export const CLEAR_ALL = Command.toDefaultLocalizedCommand({
|
|
26
|
-
id: 'vsxExtensions.clearAll',
|
|
27
|
-
category: EXTENSIONS_CATEGORY,
|
|
28
|
-
label: 'Clear Search Results',
|
|
29
|
-
iconClass: codicon('clear-all')
|
|
30
|
-
});
|
|
31
|
-
export const INSTALL_FROM_VSIX: Command & { dialogLabel: string } = {
|
|
32
|
-
id: 'vsxExtensions.installFromVSIX',
|
|
33
|
-
category: nls.localizeByDefault(EXTENSIONS_CATEGORY),
|
|
34
|
-
originalCategory: EXTENSIONS_CATEGORY,
|
|
35
|
-
originalLabel: 'Install from VSIX...',
|
|
36
|
-
label: nls.localizeByDefault('Install from VSIX') + '...',
|
|
37
|
-
dialogLabel: nls.localizeByDefault('Install from VSIX')
|
|
38
|
-
};
|
|
39
|
-
export const INSTALL_VSIX_FILE: Command = Command.toDefaultLocalizedCommand({
|
|
40
|
-
id: 'vsxExtensions.installVSIX',
|
|
41
|
-
label: 'Install Extension VSIX',
|
|
42
|
-
category: EXTENSIONS_CATEGORY,
|
|
43
|
-
});
|
|
44
|
-
export const INSTALL_ANOTHER_VERSION: Command = {
|
|
45
|
-
id: 'vsxExtensions.installAnotherVersion'
|
|
46
|
-
};
|
|
47
|
-
export const COPY: Command = {
|
|
48
|
-
id: 'vsxExtensions.copy'
|
|
49
|
-
};
|
|
50
|
-
export const COPY_EXTENSION_ID: Command = {
|
|
51
|
-
id: 'vsxExtensions.copyExtensionId'
|
|
52
|
-
};
|
|
53
|
-
export const SHOW_BUILTINS = Command.toDefaultLocalizedCommand({
|
|
54
|
-
id: 'vsxExtension.showBuiltins',
|
|
55
|
-
label: 'Show Built-in Extensions',
|
|
56
|
-
category: EXTENSIONS_CATEGORY,
|
|
57
|
-
});
|
|
58
|
-
export const SHOW_INSTALLED = Command.toLocalizedCommand({
|
|
59
|
-
id: 'vsxExtension.showInstalled',
|
|
60
|
-
label: 'Show Installed Extensions',
|
|
61
|
-
category: EXTENSIONS_CATEGORY,
|
|
62
|
-
}, 'theia/vsx-registry/showInstalled');
|
|
63
|
-
export const SHOW_RECOMMENDATIONS = Command.toDefaultLocalizedCommand({
|
|
64
|
-
id: 'vsxExtension.showRecommendations',
|
|
65
|
-
label: 'Show Recommended Extensions',
|
|
66
|
-
category: EXTENSIONS_CATEGORY,
|
|
67
|
-
});
|
|
68
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2021 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 { nls } from '@theia/core/lib/common/nls';
|
|
18
|
+
import { codicon } from '@theia/core/lib/browser';
|
|
19
|
+
import { Command } from '@theia/core/lib/common';
|
|
20
|
+
|
|
21
|
+
export namespace VSXExtensionsCommands {
|
|
22
|
+
|
|
23
|
+
const EXTENSIONS_CATEGORY = 'Extensions';
|
|
24
|
+
|
|
25
|
+
export const CLEAR_ALL = Command.toDefaultLocalizedCommand({
|
|
26
|
+
id: 'vsxExtensions.clearAll',
|
|
27
|
+
category: EXTENSIONS_CATEGORY,
|
|
28
|
+
label: 'Clear Search Results',
|
|
29
|
+
iconClass: codicon('clear-all')
|
|
30
|
+
});
|
|
31
|
+
export const INSTALL_FROM_VSIX: Command & { dialogLabel: string } = {
|
|
32
|
+
id: 'vsxExtensions.installFromVSIX',
|
|
33
|
+
category: nls.localizeByDefault(EXTENSIONS_CATEGORY),
|
|
34
|
+
originalCategory: EXTENSIONS_CATEGORY,
|
|
35
|
+
originalLabel: 'Install from VSIX...',
|
|
36
|
+
label: nls.localizeByDefault('Install from VSIX') + '...',
|
|
37
|
+
dialogLabel: nls.localizeByDefault('Install from VSIX')
|
|
38
|
+
};
|
|
39
|
+
export const INSTALL_VSIX_FILE: Command = Command.toDefaultLocalizedCommand({
|
|
40
|
+
id: 'vsxExtensions.installVSIX',
|
|
41
|
+
label: 'Install Extension VSIX',
|
|
42
|
+
category: EXTENSIONS_CATEGORY,
|
|
43
|
+
});
|
|
44
|
+
export const INSTALL_ANOTHER_VERSION: Command = {
|
|
45
|
+
id: 'vsxExtensions.installAnotherVersion'
|
|
46
|
+
};
|
|
47
|
+
export const COPY: Command = {
|
|
48
|
+
id: 'vsxExtensions.copy'
|
|
49
|
+
};
|
|
50
|
+
export const COPY_EXTENSION_ID: Command = {
|
|
51
|
+
id: 'vsxExtensions.copyExtensionId'
|
|
52
|
+
};
|
|
53
|
+
export const SHOW_BUILTINS = Command.toDefaultLocalizedCommand({
|
|
54
|
+
id: 'vsxExtension.showBuiltins',
|
|
55
|
+
label: 'Show Built-in Extensions',
|
|
56
|
+
category: EXTENSIONS_CATEGORY,
|
|
57
|
+
});
|
|
58
|
+
export const SHOW_INSTALLED = Command.toLocalizedCommand({
|
|
59
|
+
id: 'vsxExtension.showInstalled',
|
|
60
|
+
label: 'Show Installed Extensions',
|
|
61
|
+
category: EXTENSIONS_CATEGORY,
|
|
62
|
+
}, 'theia/vsx-registry/showInstalled');
|
|
63
|
+
export const SHOW_RECOMMENDATIONS = Command.toDefaultLocalizedCommand({
|
|
64
|
+
id: 'vsxExtension.showRecommendations',
|
|
65
|
+
label: 'Show Recommended Extensions',
|
|
66
|
+
category: EXTENSIONS_CATEGORY,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
@@ -1,42 +1,42 @@
|
|
|
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 URI from '@theia/core/lib/common/uri';
|
|
19
|
-
import { WidgetOpenHandler } from '@theia/core/lib/browser';
|
|
20
|
-
import { VSXExtensionOptions } from './vsx-extension';
|
|
21
|
-
import { VSCodeExtensionUri } from '@theia/plugin-ext-vscode/lib/common/plugin-vscode-uri';
|
|
22
|
-
import { VSXExtensionEditor } from './vsx-extension-editor';
|
|
23
|
-
|
|
24
|
-
@injectable()
|
|
25
|
-
export class VSXExtensionEditorManager extends WidgetOpenHandler<VSXExtensionEditor> {
|
|
26
|
-
|
|
27
|
-
readonly id = VSXExtensionEditor.ID;
|
|
28
|
-
|
|
29
|
-
canHandle(uri: URI): number {
|
|
30
|
-
const id = VSCodeExtensionUri.toId(uri);
|
|
31
|
-
return !!id ? 500 : 0;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
protected createWidgetOptions(uri: URI): VSXExtensionOptions {
|
|
35
|
-
const id = VSCodeExtensionUri.toId(uri);
|
|
36
|
-
if (!id) {
|
|
37
|
-
throw new Error('Invalid URI: ' + uri.toString());
|
|
38
|
-
}
|
|
39
|
-
return id;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
}
|
|
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 URI from '@theia/core/lib/common/uri';
|
|
19
|
+
import { WidgetOpenHandler } from '@theia/core/lib/browser';
|
|
20
|
+
import { VSXExtensionOptions } from './vsx-extension';
|
|
21
|
+
import { VSCodeExtensionUri } from '@theia/plugin-ext-vscode/lib/common/plugin-vscode-uri';
|
|
22
|
+
import { VSXExtensionEditor } from './vsx-extension-editor';
|
|
23
|
+
|
|
24
|
+
@injectable()
|
|
25
|
+
export class VSXExtensionEditorManager extends WidgetOpenHandler<VSXExtensionEditor> {
|
|
26
|
+
|
|
27
|
+
readonly id = VSXExtensionEditor.ID;
|
|
28
|
+
|
|
29
|
+
canHandle(uri: URI): number {
|
|
30
|
+
const id = VSCodeExtensionUri.toId(uri);
|
|
31
|
+
return !!id ? 500 : 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
protected createWidgetOptions(uri: URI): VSXExtensionOptions {
|
|
35
|
+
const id = VSCodeExtensionUri.toId(uri);
|
|
36
|
+
if (!id) {
|
|
37
|
+
throw new Error('Invalid URI: ' + uri.toString());
|
|
38
|
+
}
|
|
39
|
+
return id;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
}
|
|
@@ -1,96 +1,96 @@
|
|
|
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 { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
|
|
19
|
-
import { ReactWidget, Message, Widget, codicon } from '@theia/core/lib/browser';
|
|
20
|
-
import { VSXExtension, VSXExtensionEditorComponent } from './vsx-extension';
|
|
21
|
-
import { VSXExtensionsModel } from './vsx-extensions-model';
|
|
22
|
-
import { Deferred } from '@theia/core/lib/common/promise-util';
|
|
23
|
-
import { nls } from '@theia/core/lib/common/nls';
|
|
24
|
-
|
|
25
|
-
@injectable()
|
|
26
|
-
export class VSXExtensionEditor extends ReactWidget {
|
|
27
|
-
|
|
28
|
-
static ID = 'vsx-extension-editor';
|
|
29
|
-
|
|
30
|
-
@inject(VSXExtension)
|
|
31
|
-
protected readonly extension: VSXExtension;
|
|
32
|
-
|
|
33
|
-
@inject(VSXExtensionsModel)
|
|
34
|
-
protected readonly model: VSXExtensionsModel;
|
|
35
|
-
|
|
36
|
-
protected readonly deferredScrollContainer = new Deferred<HTMLElement>();
|
|
37
|
-
|
|
38
|
-
@postConstruct()
|
|
39
|
-
protected init(): void {
|
|
40
|
-
this.addClass('theia-vsx-extension-editor');
|
|
41
|
-
this.id = VSXExtensionEditor.ID + ':' + this.extension.id;
|
|
42
|
-
this.title.closable = true;
|
|
43
|
-
this.updateTitle();
|
|
44
|
-
this.title.iconClass = codicon('list-selection');
|
|
45
|
-
this.node.tabIndex = -1;
|
|
46
|
-
this.update();
|
|
47
|
-
this.toDispose.push(this.model.onDidChange(() => this.update()));
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
override getScrollContainer(): Promise<HTMLElement> {
|
|
51
|
-
return this.deferredScrollContainer.promise;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
protected override onActivateRequest(msg: Message): void {
|
|
55
|
-
super.onActivateRequest(msg);
|
|
56
|
-
this.node.focus();
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
protected override onUpdateRequest(msg: Message): void {
|
|
60
|
-
super.onUpdateRequest(msg);
|
|
61
|
-
this.updateTitle();
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
protected override onAfterShow(msg: Message): void {
|
|
65
|
-
super.onAfterShow(msg);
|
|
66
|
-
this.update();
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
protected updateTitle(): void {
|
|
70
|
-
const label = nls.localizeByDefault('Extension: {0}', (this.extension.displayName || this.extension.name));
|
|
71
|
-
this.title.label = label;
|
|
72
|
-
this.title.caption = label;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
protected override onResize(msg: Widget.ResizeMessage): void {
|
|
76
|
-
super.onResize(msg);
|
|
77
|
-
this.update();
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
protected resolveScrollContainer = (element: VSXExtensionEditorComponent | null) => {
|
|
81
|
-
if (!element) {
|
|
82
|
-
this.deferredScrollContainer.reject(new Error('element is null'));
|
|
83
|
-
} else if (!element.scrollContainer) {
|
|
84
|
-
this.deferredScrollContainer.reject(new Error('element.scrollContainer is undefined'));
|
|
85
|
-
} else {
|
|
86
|
-
this.deferredScrollContainer.resolve(element.scrollContainer);
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
protected render(): React.ReactNode {
|
|
91
|
-
return <VSXExtensionEditorComponent
|
|
92
|
-
ref={this.resolveScrollContainer}
|
|
93
|
-
extension={this.extension}
|
|
94
|
-
/>;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
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 { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
|
|
19
|
+
import { ReactWidget, Message, Widget, codicon } from '@theia/core/lib/browser';
|
|
20
|
+
import { VSXExtension, VSXExtensionEditorComponent } from './vsx-extension';
|
|
21
|
+
import { VSXExtensionsModel } from './vsx-extensions-model';
|
|
22
|
+
import { Deferred } from '@theia/core/lib/common/promise-util';
|
|
23
|
+
import { nls } from '@theia/core/lib/common/nls';
|
|
24
|
+
|
|
25
|
+
@injectable()
|
|
26
|
+
export class VSXExtensionEditor extends ReactWidget {
|
|
27
|
+
|
|
28
|
+
static ID = 'vsx-extension-editor';
|
|
29
|
+
|
|
30
|
+
@inject(VSXExtension)
|
|
31
|
+
protected readonly extension: VSXExtension;
|
|
32
|
+
|
|
33
|
+
@inject(VSXExtensionsModel)
|
|
34
|
+
protected readonly model: VSXExtensionsModel;
|
|
35
|
+
|
|
36
|
+
protected readonly deferredScrollContainer = new Deferred<HTMLElement>();
|
|
37
|
+
|
|
38
|
+
@postConstruct()
|
|
39
|
+
protected init(): void {
|
|
40
|
+
this.addClass('theia-vsx-extension-editor');
|
|
41
|
+
this.id = VSXExtensionEditor.ID + ':' + this.extension.id;
|
|
42
|
+
this.title.closable = true;
|
|
43
|
+
this.updateTitle();
|
|
44
|
+
this.title.iconClass = codicon('list-selection');
|
|
45
|
+
this.node.tabIndex = -1;
|
|
46
|
+
this.update();
|
|
47
|
+
this.toDispose.push(this.model.onDidChange(() => this.update()));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
override getScrollContainer(): Promise<HTMLElement> {
|
|
51
|
+
return this.deferredScrollContainer.promise;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
protected override onActivateRequest(msg: Message): void {
|
|
55
|
+
super.onActivateRequest(msg);
|
|
56
|
+
this.node.focus();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
protected override onUpdateRequest(msg: Message): void {
|
|
60
|
+
super.onUpdateRequest(msg);
|
|
61
|
+
this.updateTitle();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
protected override onAfterShow(msg: Message): void {
|
|
65
|
+
super.onAfterShow(msg);
|
|
66
|
+
this.update();
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
protected updateTitle(): void {
|
|
70
|
+
const label = nls.localizeByDefault('Extension: {0}', (this.extension.displayName || this.extension.name));
|
|
71
|
+
this.title.label = label;
|
|
72
|
+
this.title.caption = label;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
protected override onResize(msg: Widget.ResizeMessage): void {
|
|
76
|
+
super.onResize(msg);
|
|
77
|
+
this.update();
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
protected resolveScrollContainer = (element: VSXExtensionEditorComponent | null) => {
|
|
81
|
+
if (!element) {
|
|
82
|
+
this.deferredScrollContainer.reject(new Error('element is null'));
|
|
83
|
+
} else if (!element.scrollContainer) {
|
|
84
|
+
this.deferredScrollContainer.reject(new Error('element.scrollContainer is undefined'));
|
|
85
|
+
} else {
|
|
86
|
+
this.deferredScrollContainer.resolve(element.scrollContainer);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
protected render(): React.ReactNode {
|
|
91
|
+
return <VSXExtensionEditorComponent
|
|
92
|
+
ref={this.resolveScrollContainer}
|
|
93
|
+
extension={this.extension}
|
|
94
|
+
/>;
|
|
95
|
+
}
|
|
96
|
+
}
|