Merge pull request #465 from devchat-ai/feat/fix-workflow
Update Devchat commands and titles
This commit is contained in:
commit
c9146b9fd3
38
package.json
38
package.json
@ -659,27 +659,27 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "devchat.addContext",
|
"command": "devchat.addContext",
|
||||||
"title": "Add to DevChat"
|
"title": "Devchat:Add to DevChat"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "devchat.askForCode",
|
"command": "devchat.askForCode",
|
||||||
"title": "Add to DevChat"
|
"title": "Devchat:Add to DevChat"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "devchat.askForFile",
|
"command": "devchat.askForFile",
|
||||||
"title": "Add to DevChat"
|
"title": "Devchat:Add to DevChat"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "devchat.addConext_chinese",
|
"command": "devchat.addConext_chinese",
|
||||||
"title": "添加到DevChat"
|
"title": "Devchat:添加到DevChat"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "devchat.askForCode_chinese",
|
"command": "devchat.askForCode_chinese",
|
||||||
"title": "添加到DevChat"
|
"title": "Devchat:添加到DevChat"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "devchat.askForFile_chinese",
|
"command": "devchat.askForFile_chinese",
|
||||||
"title": "添加到DevChat"
|
"title": "Devchat:添加到DevChat"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "DevChat.InstallCommands",
|
"command": "DevChat.InstallCommands",
|
||||||
@ -703,19 +703,27 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "devchat.explain",
|
"command": "devchat.explain",
|
||||||
"title": "Generate Explain"
|
"title": "Devchat:Generate Explain"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "devchat.explain_chinese",
|
"command": "devchat.explain_chinese",
|
||||||
"title": "代码解释"
|
"title": "Devchat:代码解释"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "devchat.comments",
|
"command": "devchat.comments",
|
||||||
"title": "Generate Comments"
|
"title": "Devchat:Generate Comments"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "devchat.comments_chinese",
|
"command": "devchat.comments_chinese",
|
||||||
"title": "生成注释"
|
"title": "Devchat:生成注释"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "devchat.fix",
|
||||||
|
"title": "Devchat:Fix this"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "devchat.fix_chinese",
|
||||||
|
"title": "Devchat:修复此"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"keybindings": [
|
"keybindings": [
|
||||||
@ -819,6 +827,16 @@
|
|||||||
"command": "devchat.comments_chinese",
|
"command": "devchat.comments_chinese",
|
||||||
"when": "isChineseLocale && editorTextFocus && editorHasSelection",
|
"when": "isChineseLocale && editorTextFocus && editorHasSelection",
|
||||||
"group": "navigation"
|
"group": "navigation"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "devchat.fix",
|
||||||
|
"when": "!isChineseLocale && editorTextFocus && editorHasSelection",
|
||||||
|
"group": "navigation"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "devchat.fix_chinese",
|
||||||
|
"when": "isChineseLocale && editorTextFocus && editorHasSelection",
|
||||||
|
"group": "navigation"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -470,7 +470,7 @@ export function registerCodeLensRangeCommand(context: vscode.ExtensionContext) {
|
|||||||
if (editor) {
|
if (editor) {
|
||||||
const range = new vscode.Range(
|
const range = new vscode.Range(
|
||||||
new vscode.Position(pos.start, 0),
|
new vscode.Position(pos.start, 0),
|
||||||
new vscode.Position(pos.end+1, 0)
|
new vscode.Position(pos.end + 1, 0)
|
||||||
);
|
);
|
||||||
editor.selection = new vscode.Selection(range.start, range.end);
|
editor.selection = new vscode.Selection(range.start, range.end);
|
||||||
}
|
}
|
||||||
@ -567,11 +567,31 @@ function registerCommentCommand(context: vscode.ExtensionContext) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function registerFixCommand(context: vscode.ExtensionContext) {
|
||||||
|
const callback = async () => {
|
||||||
|
const editor = vscode.window.activeTextEditor;
|
||||||
|
if (editor) {
|
||||||
|
if (!(await ensureChatPanel(context))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
chatWithDevChat(ExtensionContextHolder.provider?.view()!, "/fix");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
context.subscriptions.push(
|
||||||
|
vscode.commands.registerCommand("devchat.fix", callback)
|
||||||
|
);
|
||||||
|
context.subscriptions.push(
|
||||||
|
vscode.commands.registerCommand("devchat.fix_chinese", callback)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
registerOpenChatPanelCommand,
|
registerOpenChatPanelCommand,
|
||||||
registerAddContextCommand,
|
registerAddContextCommand,
|
||||||
registerAskForCodeCommand,
|
registerAskForCodeCommand,
|
||||||
registerAskForFileCommand,
|
registerAskForFileCommand,
|
||||||
registerExplainCommand,
|
registerExplainCommand,
|
||||||
|
registerFixCommand,
|
||||||
registerCommentCommand,
|
registerCommentCommand,
|
||||||
};
|
};
|
||||||
|
@ -17,6 +17,7 @@ import {
|
|||||||
registerExplainCommand,
|
registerExplainCommand,
|
||||||
registerCodeLensRangeCommand,
|
registerCodeLensRangeCommand,
|
||||||
registerCommentCommand,
|
registerCommentCommand,
|
||||||
|
registerFixCommand,
|
||||||
} from "./contributes/commands";
|
} from "./contributes/commands";
|
||||||
import { regLanguageContext } from "./contributes/context";
|
import { regLanguageContext } from "./contributes/context";
|
||||||
import { regDevChatView } from "./contributes/views";
|
import { regDevChatView } from "./contributes/views";
|
||||||
@ -371,9 +372,9 @@ async function configSetModelDefaultParams() {
|
|||||||
"Model.claude-3-opus": {
|
"Model.claude-3-opus": {
|
||||||
max_input_tokens: 32000,
|
max_input_tokens: 32000,
|
||||||
},
|
},
|
||||||
"Model.claude-3-sonnet": {
|
"Model.claude-3-sonnet": {
|
||||||
max_input_tokens: 32000,
|
max_input_tokens: 32000,
|
||||||
},
|
},
|
||||||
"Model.xinghuo-2": {
|
"Model.xinghuo-2": {
|
||||||
max_input_tokens: 6000,
|
max_input_tokens: 6000,
|
||||||
},
|
},
|
||||||
@ -414,26 +415,23 @@ async function configSetModelDefaultParams() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function updateClaudePrivider() {
|
async function updateClaudePrivider() {
|
||||||
const claudeModels = [
|
const claudeModels = ["Model.claude-3-opus", "Model.claude-3-sonnet"];
|
||||||
"Model.claude-3-opus",
|
|
||||||
"Model.claude-3-sonnet",
|
|
||||||
];
|
|
||||||
|
|
||||||
for (const model of claudeModels) {
|
for (const model of claudeModels) {
|
||||||
const modelConfig: any = UiUtilWrapper.getConfiguration("devchat", model);
|
const modelConfig: any = UiUtilWrapper.getConfiguration("devchat", model);
|
||||||
if (modelConfig && Object.keys(modelConfig).length === 0) {
|
if (modelConfig && Object.keys(modelConfig).length === 0) {
|
||||||
const modelProperties: any = {
|
const modelProperties: any = {
|
||||||
"provider": "devchat"
|
provider: "devchat",
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
await vscode.workspace
|
await vscode.workspace
|
||||||
.getConfiguration("devchat")
|
.getConfiguration("devchat")
|
||||||
.update(model, modelProperties, vscode.ConfigurationTarget.Global);
|
.update(model, modelProperties, vscode.ConfigurationTarget.Global);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.channel()?.error(`update ${model} error: ${error}`);
|
logger.channel()?.error(`update ${model} error: ${error}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function activate(context: vscode.ExtensionContext) {
|
async function activate(context: vscode.ExtensionContext) {
|
||||||
@ -462,6 +460,7 @@ async function activate(context: vscode.ExtensionContext) {
|
|||||||
registerAskForCodeCommand(context);
|
registerAskForCodeCommand(context);
|
||||||
registerAskForFileCommand(context);
|
registerAskForFileCommand(context);
|
||||||
registerExplainCommand(context);
|
registerExplainCommand(context);
|
||||||
|
registerFixCommand(context);
|
||||||
registerCommentCommand(context);
|
registerCommentCommand(context);
|
||||||
registerStatusBarItemClickCommand(context);
|
registerStatusBarItemClickCommand(context);
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ export class CodeLensManager {
|
|||||||
this.registrations = [
|
this.registrations = [
|
||||||
{
|
{
|
||||||
elementType: "function",
|
elementType: "function",
|
||||||
objectName: "unit tests",
|
objectName: "Devchat:unit tests",
|
||||||
promptGenerator:
|
promptGenerator:
|
||||||
"/unit_tests {__filename__}:::{__functionName__}:::{__functionStartLine__}:::{__functionEndLine__}:::{__containerStartLine__}:::{__containerEndLine__}",
|
"/unit_tests {__filename__}:::{__functionName__}:::{__functionStartLine__}:::{__functionEndLine__}:::{__containerStartLine__}:::{__containerEndLine__}",
|
||||||
},
|
},
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit dbdb1ba29db3536e4ae358113f4251b78845c879
|
Subproject commit 874da1710f1c0e24b6c3078352919ef29b312638
|
Loading…
x
Reference in New Issue
Block a user