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

@@ -18,6 +18,8 @@ export class Askpass implements IIPCHandler, ITerminalEnvironmentProvider {
private cache = new Map<string, Credentials>();
private credentialsProviders = new Set<CredentialsProvider>();
readonly featureDescription = 'git auth provider';
constructor(private ipc?: IIPCServer) {
if (ipc) {
this.disposable = ipc.registerHandler('askpass', this);

View File

@@ -17,6 +17,8 @@ export class GitEditor implements IIPCHandler, ITerminalEnvironmentProvider {
private env: { [key: string]: string };
private disposable: IDisposable = EmptyDisposable;
readonly featureDescription = 'git editor';
constructor(ipc?: IIPCServer) {
if (ipc) {
this.disposable = ipc.registerHandler('git-editor', this);

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(', ')}`;
}
}