mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 08:47:44 +00:00
refactor(vscode-ide-companion): 优化代码结构和性能
- 移除未使用的依赖项 qwen-code - 优化 completion 刷新逻辑,避免渲染循环 - 更新 CompletionMenu 组件,增加空状态提示
This commit is contained in:
@@ -138,11 +138,16 @@ export const App: React.FC = () => {
|
||||
const completion = useCompletionTrigger(inputFieldRef, getCompletionItems);
|
||||
|
||||
// When workspace files update while menu open for @, refresh items so the first @ shows the list
|
||||
// Note: Avoid depending on the entire `completion` object here, since its identity
|
||||
// changes on every render which would retrigger this effect and can cause a refresh loop.
|
||||
useEffect(() => {
|
||||
if (completion.isOpen && completion.triggerChar === '@') {
|
||||
// Only refresh items; do not change other completion state to avoid re-renders loops
|
||||
completion.refreshCompletion();
|
||||
}
|
||||
}, [fileContext.workspaceFiles, completion]);
|
||||
// Only re-run when the actual data source changes, not on every render
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [fileContext.workspaceFiles, completion.isOpen, completion.triggerChar]);
|
||||
|
||||
// Message submission
|
||||
const handleSubmit = useMessageSubmit({
|
||||
|
||||
Reference in New Issue
Block a user