Explain features the git extension enables

This commit is contained in:
Daniel Imms
2023-06-07 11:57:04 -07:00
parent 1c5442ac03
commit fab99a2c40
3 changed files with 12 additions and 1 deletions

View File

@@ -7,6 +7,7 @@ import { ExtensionContext, workspace } from 'vscode';
import { filterEvent, IDisposable } from './util';
export interface ITerminalEnvironmentProvider {
featureDescription?: string;
getTerminalEnv(): { [key: string]: string };
}
@@ -24,18 +25,24 @@ export class TerminalEnvironmentManager {
private refresh(): void {
const config = workspace.getConfiguration('git', null);
this.context.environmentVariableCollection.clear();
this.context.environmentVariableCollection.description = 'Enables a git authentication provider';
if (!config.get<boolean>('enabled', true)) {
return;
}
const features: string[] = [];
for (const envProvider of this.envProviders) {
const terminalEnv = envProvider?.getTerminalEnv() ?? {};
for (const name of Object.keys(terminalEnv)) {
this.context.environmentVariableCollection.replace(name, terminalEnv[name]);
}
if (envProvider?.featureDescription && Object.keys(terminalEnv).length > 0) {
features.push(envProvider.featureDescription);
}
}
if (features.length) {
this.context.environmentVariableCollection.description = `Enables the following features: ${features.join(', ')}`;
}
}