vscode 当响应正在流式传输时,编辑器选择丢失,

vyswwuz2  于 22天前  发布在  Vscode
关注(0)|答案(4)|浏览(23)

当所有扩展都被禁用时,是否会出现这个问题?:是/否

  • VS Code 版本:1.87.2
  • OS 版本:MacOS Sonoma

重现步骤:

  1. 让 Copilot 为文件的所有部分添加注解
  2. 尝试选择一个区域并将其复制到剪贴板,选择区域不断重置,我认为这是因为聊天屏幕中的 DOM 节点正在重新渲染。
    屏幕录制。2024-03-20.at.12.46.11.mov
    我还在记录我能看到的行为
    注意:这种情况不仅发生在代码块中,还发生在 LLM 输出流的聊天文本渲染中。
    我现在也处于 Copilot Chat 预览版。
lokaqttq

lokaqttq1#

感谢您提出这个问题!看起来您可能正在使用旧版本的VS Code,最新稳定版本是1.87.2。请尝试升级到最新版本并检查此问题是否仍然存在。
快乐编码!

f1tvaqid

f1tvaqid2#

我已更新到最新的vscode版本:版本:1.87.2(通用)
提交:863d258
日期:2024-03-08T15:21:31.043Z
Electron:27.3.2
ElectronBuildId:26836302
Chromium:118.0.5993.159
Node.js:18.17.1
V8:11.8.172.18-electron.0
操作系统:Darwin arm64 23.0.0
问题仍然存在。

omhiaaxx

omhiaaxx3#

这里有一些可能有用的调试跟踪信息,我认为发生的情况是列表渲染器在没有在这个代码位置适当地进行差异比较的情况下替换DOM节点:
vscode/src/vs/workbench/contrib/chat/browser/chatListRenderer.ts
第642行 in dd42b9f
| | templateData.value.replaceChild(result.element,existingElement); |
所以我尝试使用DomDiff仅将差异应用于元素,但结果是整个DOM节点的ID发生变化,导致重新渲染,触发于此:
vscode/src/vs/workbench/contrib/chat/browser/chatWidget.ts
第317行到第332行 in dd42b9f
| | this.tree.setChildren(null,treeItems,{ |
| | diffIdentityProvider: { |
| | getId: (element)=>{ |
| | return((isResponseVM(element)||isRequestVM(element)) ? element.dataId : element.id)+ |
| | // TODO? We can give the welcome message a proper VM or get rid of the rest of the VMs |
| | ((isWelcomeVM(element)&&this.viewModel) ? _${ChatModelInitState[this.viewModel.initState]} : '')+ |
| | // Ensure re-rendering an element once slash commands are loaded, so the colorization can be applied. |
| | ${(isRequestVM(element)||isWelcomeVM(element))/* && !!this.lastSlashCommands ? '_scLoaded' : '' */}+ |
| | // If a response is in the process of progressive rendering, we need to ensure that it will |
| | // be re-rendered so progressive rendering is restarted, even if the model wasn't updated. |
| | ${isResponseVM(element)&&element.renderData ?_${this.visibleChangeCount}: ''}+ |
| | // Re-render once content references are loaded |
| | (isResponseVM(element) ? _${element.contentReferences.length} : ''); |
| | }, |
| | } |
| | }); |
在这里ID发生变化,因为每次更新流时我们都会在此增加dataid:
vscode/src/vs/workbench/contrib/chat/common/chatViewModel.ts
第353行到第355行 in dd42b9f
| | getdataId(){ |
| | returnthis._model.id+_${this._modelChangeCount}+_${ChatModelInitState[this._model.session.initState]}; |
| | } |

yizd12fk

yizd12fk4#

是的,这比那个更复杂,感谢你的分析。

相关问题