MCPcopy Index your code
hub / github.com/continuedev/continue / add

Function add

gui/src/hooks/useInputHistory.ts:46–65  ·  view source on GitHub ↗
(inputValue: JSONContent)

Source from the content-addressed store, hash-verified

44 }
45
46 function add(inputValue: JSONContent) {
47 setPendingInput(emptyJsonContent());
48
49 if (
50 JSON.stringify(inputHistory[inputHistory.length - 1]) ===
51 JSON.stringify(inputValue)
52 ) {
53 setCurrentIndex(inputHistory.length);
54 return;
55 }
56
57 setCurrentIndex(Math.min(inputHistory.length + 1, MAX_HISTORY_LENGTH));
58 setInputHistory((prev) => {
59 return [...prev, inputValue].slice(-MAX_HISTORY_LENGTH);
60 });
61 setLocalStorage(
62 `inputHistory_${historyKey}`,
63 [...inputHistory, inputValue].slice(-MAX_HISTORY_LENGTH),
64 );
65 }
66
67 const prevRef = useUpdatingRef(prev, [inputHistory]);
68 const nextRef = useUpdatingRef(next, [inputHistory]);

Callers

nothing calls this directly

Calls 2

setLocalStorageFunction · 0.90
emptyJsonContentFunction · 0.85

Tested by

no test coverage detected