MCPcopy Create free account
hub / github.com/anomalyco/opencode / add

Function add

packages/app/src/context/comments.tsx:103–117  ·  view source on GitHub ↗
(input: Omit<LineComment, "id" | "time">)

Source from the content-addressed store, hash-verified

101 const list = (file: string) => store.comments[file] ?? []
102
103 const add = (input: Omit<LineComment, "id" | "time">) => {
104 const next: LineComment = {
105 id: uuid(),
106 time: Date.now(),
107 ...input,
108 selection: cloneSelection(input.selection),
109 }
110
111 batch(() => {
112 setStore("comments", input.file, (items) => [...(items ?? []), next])
113 setFocus({ file: input.file, id: next.id })
114 })
115
116 return next
117 }
118
119 const remove = (file: string, id: string) => {
120 batch(() => {

Callers

nothing calls this directly

Calls 5

uuidFunction · 0.90
batchFunction · 0.85
setStoreFunction · 0.85
setFocusFunction · 0.85
cloneSelectionFunction · 0.70

Tested by

no test coverage detected