diff --git a/src/contributes/commandsBase.ts b/src/contributes/commandsBase.ts index 0bb784e..a76b81a 100644 --- a/src/contributes/commandsBase.ts +++ b/src/contributes/commandsBase.ts @@ -23,7 +23,7 @@ function locateCommand(command): string | undefined { } } -export function checkDevChatDependency(pythonCommand: string): boolean { +export function checkDevChatDependency(pythonCommand: string, showError: boolean = true): boolean { let pipxBinPath: string | undefined = undefined; try { const binPath = getPipxEnvironmentPath(pythonCommand); @@ -39,7 +39,7 @@ export function checkDevChatDependency(pythonCommand: string): boolean { } } else { const error_status = `Failed to obtain the pipx environment path.`; - if (pipxPathStatus !== error_status) { + if (pipxPathStatus !== error_status && showError) { logger.channel()?.warn(error_status); logger.channel()?.show(); pipxPathStatus = error_status; @@ -51,7 +51,7 @@ export function checkDevChatDependency(pythonCommand: string): boolean { // DevChat dependency check failed // log out detail error message const error_status = `Failed to check DevChat dependency due to error: ${error}`; - if (pipxPathStatus !== error_status) { + if (pipxPathStatus !== error_status && showError) { logger.channel()?.warn(error_status); logger.channel()?.show(); pipxPathStatus = error_status; @@ -75,7 +75,7 @@ export function checkDevChatDependency(pythonCommand: string): boolean { return true; } catch(error) { const error_status = `Failed to check DevChat dependency due to error: ${error}`; - if (devchatStatus !== error_status) { + if (devchatStatus !== error_status && showError) { logger.channel()?.warn(error_status); logger.channel()?.show(); devchatStatus = error_status; diff --git a/src/panel/statusBarViewBase.ts b/src/panel/statusBarViewBase.ts index 0517356..a9fc8fc 100644 --- a/src/panel/statusBarViewBase.ts +++ b/src/panel/statusBarViewBase.ts @@ -65,7 +65,8 @@ export async function dependencyCheck(): Promise<[string, string]> { } if (!bOk) { - bOk = checkDevChatDependency(pythonCommand!); + const showError = devchatStatus == ''? false : true; + bOk = checkDevChatDependency(pythonCommand!, showError); } if (bOk && versionChanged && !devChat) { bOk = false; diff --git a/src/util/commonUtil.ts b/src/util/commonUtil.ts index 96e6db6..9bb6d28 100644 --- a/src/util/commonUtil.ts +++ b/src/util/commonUtil.ts @@ -72,7 +72,7 @@ export class CommandRun { fs.writeFileSync(outputFile, outputData); } - if (stderr) { + if (stderr && !onError) { logger.channel()?.error(stderr); logger.channel()?.show(); }