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