Add command to set Python Path in DevChat configuration

- Added a new command 'devchat.PythonPath' in commands.ts.
- This command prompts the user to input a Python Path and updates the DevChat configuration with the provided path.
- The new command is registered in the extension.ts file.
This commit is contained in:
bobo.yang 2023-07-06 07:42:44 +08:00
parent f63f88e7f6
commit 892c3638cc
2 changed files with 19 additions and 0 deletions

View File

@ -5,6 +5,7 @@ import { TopicManager } from '../topic/topicManager';
import { TopicTreeDataProvider, TopicTreeItem } from '../panel/topicView';
import { FilePairManager } from '../util/diffFilePairs';
import { ApiKeyManager } from '../util/apiKey';
import { UiUtilWrapper } from '../util/uiUtil';
function registerOpenChatPanelCommand(context: vscode.ExtensionContext) {
@ -148,6 +149,21 @@ export function regReloadTopicCommand(context: vscode.ExtensionContext) {
);
}
export function regPythonPathCommand(context: vscode.ExtensionContext) {
context.subscriptions.push(
vscode.commands.registerCommand('devchat.PythonPath', async () => {
const pythonPath = await vscode.window.showInputBox({
title: "Set Python Path",
placeHolder: "Set Python Path"
}) ?? '';
if (pythonPath) {
vscode.workspace.getConfiguration("DevChat").update("PythonPath", pythonPath, vscode.ConfigurationTarget.Global);
}
})
);
}
export function regApplyDiffResultCommand(context: vscode.ExtensionContext) {
context.subscriptions.push(
vscode.commands.registerCommand('devchat.applyDiffResult', async () => {

View File

@ -13,6 +13,7 @@ import {
regReloadTopicCommand,
regApplyDiffResultCommand,
registerStatusBarItemClickCommand,
regPythonPathCommand,
} from './contributes/commands';
import { regLanguageContext } from './contributes/context';
import { regDevChatView, regTopicView } from './contributes/views';
@ -51,5 +52,7 @@ function activate(context: vscode.ExtensionContext) {
regSelectTopicCommand(context);
regReloadTopicCommand(context);
regApplyDiffResultCommand(context);
regPythonPathCommand(context);
}
exports.activate = activate;