Skip to content
Prev Previous commit
Next Next commit
Rename
  • Loading branch information
Kartik Raj
Kartik Raj committed Aug 14, 2023
commit 443487f25b39cdf25ae5db7d82cc0de4fc95816c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export class TerminalEnvVarCollectionService implements IExtensionActivationServ
await this._applyCollection(resource, defaultShell?.shell);
return;
}
await this.trackTerminalPromptStatus(shell, resource, env);
await this.trackTerminalPrompt(shell, resource, env);
this.processEnvVars = undefined;
return;
}
Expand Down Expand Up @@ -170,7 +170,7 @@ export class TerminalEnvVarCollectionService implements IExtensionActivationServ
const description = new MarkdownString(`${Interpreters.activateTerminalDescription} \`${displayPath}\``);
envVarCollection.description = description;

await this.trackTerminalPromptStatus(shell, resource, env);
await this.trackTerminalPrompt(shell, resource, env);
}

private isPromptSet = new Map<number | undefined, boolean>();
Expand All @@ -184,23 +184,23 @@ export class TerminalEnvVarCollectionService implements IExtensionActivationServ
/**
* Call this once we know terminal prompt is set correctly for terminal owned by this resource.
*/
private setTerminalPromptStatus(resource: Resource) {
private terminalPromptIsCorrect(resource: Resource) {
const key = this.getWorkspaceFolder(resource)?.index;
this.isPromptSet.set(key, true);
}

private clearTerminalPromptStatus(resource: Resource) {
private terminalPromptIsNotCorrect(resource: Resource) {
const key = this.getWorkspaceFolder(resource)?.index;
this.isPromptSet.delete(key);
}

/**
* Tracks whether prompt for terminal was correctly set.
*/
private async trackTerminalPromptStatus(shell: string, resource: Resource, env: EnvironmentVariables | undefined) {
this.clearTerminalPromptStatus(resource);
private async trackTerminalPrompt(shell: string, resource: Resource, env: EnvironmentVariables | undefined) {
this.terminalPromptIsNotCorrect(resource); // Assume terminal prompt is not correct to begin with.
if (!env) {
this.setTerminalPromptStatus(resource);
this.terminalPromptIsCorrect(resource);
return;
}
// Prompts for these shells cannot be set reliably using variables
Expand All @@ -223,7 +223,7 @@ export class TerminalEnvVarCollectionService implements IExtensionActivationServ
return;
}
}
this.setTerminalPromptStatus(resource);
this.terminalPromptIsCorrect(resource);
}

private async handleMicroVenv(resource: Resource) {
Expand Down