forked from che-incubator/che-code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-from-vsix.ts
More file actions
40 lines (33 loc) · 1.64 KB
/
Copy pathinstall-from-vsix.ts
File metadata and controls
40 lines (33 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/**********************************************************************
* Copyright (c) 2025 Red Hat, Inc.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
***********************************************************************/
/* eslint-disable header/header */
import * as vscode from 'vscode';
import { EditorConfigurations } from './editor-configurations';
export const INSTALL_FROM_VSIX = 'extensions.install-from-vsix-enabled';
export class InstallFromVSIX {
constructor(private outputChannel: vscode.OutputChannel) { }
async apply(configs: EditorConfigurations): Promise<void> {
this.outputChannel.appendLine('[InstallFromVSIX] Looking for configurations...');
try {
const installFromVsix = configs[INSTALL_FROM_VSIX];
if (installFromVsix === undefined) {
this.outputChannel.appendLine('[InstallFromVSIX] Configuration for the Install From VSIX command not found');
return;
}
if (installFromVsix === false || installFromVsix === 'false') {
this.outputChannel.appendLine(`[InstallFromVSIX] Applying ${installFromVsix} value for the ${INSTALL_FROM_VSIX} configuration.`);
// disable command
vscode.commands.executeCommand('setContext', INSTALL_FROM_VSIX, false);
}
} catch (error) {
this.outputChannel.appendLine(`[InstallFromVSIX] Failed to configure Install From VSIX command: ${error}`);
}
}
}