dismiss suggestions

This commit is contained in:
2026-02-26 12:12:07 +10:00
parent 525f795447
commit 1bc0a82e73
6 changed files with 120 additions and 31 deletions

View File

@@ -35,6 +35,7 @@ interface EditorState {
annotations: TextAnnotation[]
annotationsByFile: Record<string, AnnotationFileState>
setAnnotations: (annotations: TextAnnotation[]) => void
removeAnnotation: (id: string) => void
clearAnnotations: () => void
// Analysis mode
@@ -252,6 +253,24 @@ export const useEditorStore = create<EditorState>((set, get) => ({
}
})
},
removeAnnotation: (id) => {
set((s) => {
const annotations = s.annotations.filter((a) => a.id !== id)
const annotationsByFile = s.activeFilePath
? { ...s.annotationsByFile, [s.activeFilePath]: { mode: s.analysisMode, annotations } }
: s.annotationsByFile
return { annotations, annotationsByFile }
})
scheduleSave(() => {
const st = get()
return {
activeFilePath: st.activeFilePath,
scrollPositions: st.scrollPositions,
chatHistoryByFile: st.chatHistoryByFile,
annotationsByFile: st.annotationsByFile
}
})
},
clearAnnotations: () => {
set((s) => {
const annotationsByFile = s.activeFilePath