mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 12:19:20 +00:00
Explain features the git extension enables
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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(', ')}`;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user