feat:新增点击示例直接发送之前加一层工作区检测逻辑
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
所有重要的项目变更都将记录在此文件中。
|
所有重要的项目变更都将记录在此文件中。
|
||||||
|
|
||||||
## [1.0.0] - 2026-01-13
|
## [1.0.2] - 2026-01-13
|
||||||
|
|
||||||
IC Coder插件端正式发布。
|
IC Coder插件端正式发布。
|
||||||
|
|
||||||
|
|||||||
@ -119,7 +119,8 @@
|
|||||||
"media",
|
"media",
|
||||||
"tools",
|
"tools",
|
||||||
"src/assets",
|
"src/assets",
|
||||||
"LICENSE"
|
"LICENSE",
|
||||||
|
"CHANGELOG.md"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@wavedrom/doppler": "^1.14.0",
|
"@wavedrom/doppler": "^1.14.0",
|
||||||
|
|||||||
@ -109,6 +109,9 @@ export function showICHelperPanel(context: vscode.ExtensionContext) {
|
|||||||
case "showInfo":
|
case "showInfo":
|
||||||
vscode.window.showInformationMessage(message.text);
|
vscode.window.showInformationMessage(message.text);
|
||||||
break;
|
break;
|
||||||
|
case "showWarning":
|
||||||
|
vscode.window.showWarningMessage(message.message);
|
||||||
|
break;
|
||||||
// 新增:处理用户回答
|
// 新增:处理用户回答
|
||||||
case "submitAnswer":
|
case "submitAnswer":
|
||||||
handleUserAnswer(
|
handleUserAnswer(
|
||||||
|
|||||||
@ -226,8 +226,20 @@ export function getExampleShowcaseScript(): string {
|
|||||||
'生成一个GMII接口的以太网UDP通信模块'
|
'生成一个GMII接口的以太网UDP通信模块'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// 存储待发送的示例索引
|
||||||
|
let pendingExampleIndex = -1;
|
||||||
|
|
||||||
// 直接发送示例消息
|
// 直接发送示例消息
|
||||||
function sendExample(index) {
|
function sendExample(index) {
|
||||||
|
// 先检查工作区
|
||||||
|
pendingExampleIndex = index;
|
||||||
|
vscode.postMessage({
|
||||||
|
command: 'checkWorkspace'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 实际发送示例消息
|
||||||
|
function doSendExample(index) {
|
||||||
const messageInput = document.getElementById('messageInput');
|
const messageInput = document.getElementById('messageInput');
|
||||||
const sendButton = document.getElementById('sendButton');
|
const sendButton = document.getElementById('sendButton');
|
||||||
|
|
||||||
|
|||||||
@ -300,7 +300,6 @@ export function getInputAreaScript(): string {
|
|||||||
${getContextDisplayScript()}
|
${getContextDisplayScript()}
|
||||||
${getContextCompressScript()}
|
${getContextCompressScript()}
|
||||||
${getOptimizeButtonScript()}
|
${getOptimizeButtonScript()}
|
||||||
${getExampleShowcaseScript()}
|
|
||||||
|
|
||||||
// 对话状态管理
|
// 对话状态管理
|
||||||
let isConversationActive = false;
|
let isConversationActive = false;
|
||||||
@ -310,6 +309,8 @@ export function getInputAreaScript(): string {
|
|||||||
let hasCheckedWorkspace = false; // 是否已经检测过工作区
|
let hasCheckedWorkspace = false; // 是否已经检测过工作区
|
||||||
let hasWorkspace = true; // 工作区状态
|
let hasWorkspace = true; // 工作区状态
|
||||||
|
|
||||||
|
${getExampleShowcaseScript()}
|
||||||
|
|
||||||
// 切换输入框布局模式
|
// 切换输入框布局模式
|
||||||
function updateInputAreaLayout() {
|
function updateInputAreaLayout() {
|
||||||
const inputArea = document.getElementById('inputArea');
|
const inputArea = document.getElementById('inputArea');
|
||||||
|
|||||||
@ -635,6 +635,14 @@ export function getWebviewContent(
|
|||||||
if (typeof hasWorkspace !== 'undefined') {
|
if (typeof hasWorkspace !== 'undefined') {
|
||||||
hasWorkspace = message.hasWorkspace;
|
hasWorkspace = message.hasWorkspace;
|
||||||
console.log('[WebView] 工作区状态:', hasWorkspace);
|
console.log('[WebView] 工作区状态:', hasWorkspace);
|
||||||
|
|
||||||
|
// 如果有待发送的示例,且工作区存在,则发送
|
||||||
|
if (hasWorkspace && typeof pendingExampleIndex !== 'undefined' && pendingExampleIndex >= 0) {
|
||||||
|
if (typeof doSendExample === 'function') {
|
||||||
|
doSendExample(pendingExampleIndex);
|
||||||
|
pendingExampleIndex = -1; // 重置
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user