show vs tell

This commit is contained in:
2026-03-02 18:29:00 +10:00
parent ad2c243849
commit d2fe2daa9b
7 changed files with 93 additions and 11 deletions

View File

@@ -43,6 +43,7 @@ interface EditorState {
linkAnnotationsToMessage: (messageId: string, annotationIds: string[]) => void
clearArchivedAnnotations: () => void
removeArchivedAnnotation: (id: string) => void
setAnnotationAnalysis: (id: string, result: { text: string; suggestion: string | null }) => void
// Analysis mode
analysisMode: AnalysisMode
@@ -457,6 +458,37 @@ export const useEditorStore = create<EditorState>((set, get) => ({
})
},
setAnnotationAnalysis: (id, result) => {
set((s) => {
if (!s.activeFilePath) return {}
const fileState = s.annotationsByFile[s.activeFilePath]
if (!fileState) return {}
const updatedAll = fileState.annotations.map(a =>
a.id === id ? { ...a, analysisCache: result } : a
)
const annotations = s.annotations.map(a =>
a.id === id ? { ...a, analysisCache: result } : a
)
return {
annotations,
annotationsByFile: {
...s.annotationsByFile,
[s.activeFilePath]: { ...fileState, annotations: updatedAll }
}
}
})
scheduleSave(() => {
const st = get()
return {
activeFilePath: st.activeFilePath,
scrollPositions: st.scrollPositions,
chatSessionsByFile: st.chatSessionsByFile,
activeSessionIdByFile: st.activeSessionIdByFile,
annotationsByFile: st.annotationsByFile
}
})
},
analysisMode: 'none',
setAnalysisMode: (analysisMode) => {
set((s) => {