forked from microsoft/vscode-python
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcreateEnvButtonContext.ts
More file actions
22 lines (18 loc) · 916 Bytes
/
Copy pathcreateEnvButtonContext.ts
File metadata and controls
22 lines (18 loc) · 916 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import { IDisposableRegistry } from '../../common/types';
import { executeCommand } from '../../common/vscodeApis/commandApis';
import { getConfiguration, onDidChangeConfiguration } from '../../common/vscodeApis/workspaceApis';
async function setShowCreateEnvButtonContextKey(): Promise<void> {
const config = getConfiguration('python');
const showCreateEnvButton = config.get<string>('createEnvironment.contentButton', 'show') === 'show';
await executeCommand('setContext', 'showCreateEnvButton', showCreateEnvButton);
}
export function registerCreateEnvironmentButtonFeatures(disposables: IDisposableRegistry): void {
disposables.push(
onDidChangeConfiguration(async () => {
await setShowCreateEnvButtonContextKey();
}),
);
setShowCreateEnvButtonContextKey();
}