开始修复的备份

This commit is contained in:
睿 安
2025-10-03 19:05:22 +08:00
parent 8f5ddd7dec
commit 32108d0d2b
4 changed files with 58 additions and 2 deletions

17
dist/extension.js vendored
View File

@@ -49,6 +49,7 @@ const onTypeFormattingProvider_1 = require("./providers/onTypeFormattingProvider
const documentFormattingProvider_1 = require("./providers/documentFormattingProvider");
const codeErrorProvider_1 = require("./providers/codeErrorProvider");
const apiParser_1 = require("./providers/apiParser");
const localClient_1 = require("./localClient");
function activate(context) {
console.log('Squirrel NUT Explorer 正在激活...');
// 初始化API解析器
@@ -132,12 +133,26 @@ function activate(context) {
const saveListener = vscode.workspace.onDidSaveTextDocument(async (doc) => {
if (doc.uri.scheme === 'squirrel') {
const filePath = doc.uri.path.substring(1); // 去掉开头的 '/'
const success = await model.saveFileContent(filePath, doc.getText());
const fileContent = doc.getText();
const success = await model.saveFileContent(filePath, fileContent);
if (success) {
output.appendLine(`[Squirrel] 文件 ${filePath} 保存成功`);
provider.refresh();
// 更新函数缓存
await functionExtractor.updateFileCache(model, filePath);
// 发送文件内容到本地C++服务
try {
const sendSuccess = await (0, localClient_1.sendFileToCppService)(filePath, fileContent);
if (sendSuccess) {
output.appendLine(`[Squirrel] 文件 ${filePath} 已发送到C++服务`);
}
else {
output.appendLine(`[Squirrel] 文件 ${filePath} 发送到C++服务失败`);
}
}
catch (error) {
output.appendLine(`[Squirrel] 发送文件到C++服务时发生错误: ${error}`);
}
}
else {
output.appendLine(`[Squirrel] 文件 ${filePath} 保存失败`);