check dependence only once
This commit is contained in:
parent
93714a2255
commit
eca629b4f3
@ -32,8 +32,7 @@ function checkOpenAIKey() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function registerOpenChatPanelCommand(context: vscode.ExtensionContext) {
|
function checkDependencyPackage() {
|
||||||
let disposable = vscode.commands.registerCommand('devchat.openChatPanel', () => {
|
|
||||||
const dependencyInstalled = checkDependency();
|
const dependencyInstalled = checkDependency();
|
||||||
if (!dependencyInstalled) {
|
if (!dependencyInstalled) {
|
||||||
// 依赖程序未安装,显示提示信息
|
// 依赖程序未安装,显示提示信息
|
||||||
@ -47,7 +46,10 @@ function registerOpenChatPanelCommand(context: vscode.ExtensionContext) {
|
|||||||
if (!checkOpenAIKey()) {
|
if (!checkOpenAIKey()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function registerOpenChatPanelCommand(context: vscode.ExtensionContext) {
|
||||||
|
let disposable = vscode.commands.registerCommand('devchat.openChatPanel', () => {
|
||||||
if (vscode.workspace.workspaceFolders) {
|
if (vscode.workspace.workspaceFolders) {
|
||||||
ChatPanel.createOrShow(context.extensionUri);
|
ChatPanel.createOrShow(context.extensionUri);
|
||||||
} else {
|
} else {
|
||||||
@ -110,6 +112,7 @@ function registerAskForFileCommand(context: vscode.ExtensionContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
checkDependencyPackage,
|
||||||
registerOpenChatPanelCommand,
|
registerOpenChatPanelCommand,
|
||||||
registerAddContextCommand,
|
registerAddContextCommand,
|
||||||
registerAskForCodeCommand,
|
registerAskForCodeCommand,
|
||||||
|
@ -2,6 +2,7 @@ import * as vscode from 'vscode';
|
|||||||
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
checkDependencyPackage,
|
||||||
registerOpenChatPanelCommand,
|
registerOpenChatPanelCommand,
|
||||||
registerAddContextCommand,
|
registerAddContextCommand,
|
||||||
registerAskForCodeCommand,
|
registerAskForCodeCommand,
|
||||||
@ -16,6 +17,7 @@ function activate(context: vscode.ExtensionContext) {
|
|||||||
ExtensionContextHolder.context = context;
|
ExtensionContextHolder.context = context;
|
||||||
logger.init(context);
|
logger.init(context);
|
||||||
|
|
||||||
|
checkDependencyPackage();
|
||||||
registerOpenChatPanelCommand(context);
|
registerOpenChatPanelCommand(context);
|
||||||
registerAddContextCommand(context);
|
registerAddContextCommand(context);
|
||||||
registerAskForCodeCommand(context);
|
registerAskForCodeCommand(context);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user