MCPcopy Create free account
hub / github.com/sourcebot-dev/sourcebot / resetEditor

Function resetEditor

packages/web/src/features/chat/utils.ts:176–184  ·  view source on GitHub ↗
(editor: CustomEditor)

Source from the content-addressed store, hash-verified

174
175// @see: https://stackoverflow.com/a/74102147
176export const resetEditor = (editor: CustomEditor) => {
177 const point = { path: [0, 0], offset: 0 }
178 editor.selection = { anchor: point, focus: point };
179 clearEditorHistory(editor);
180 editor.children = [{
181 type: "paragraph",
182 children: [{ text: "" }]
183 }];
184}
185
186export const addLineNumbers = (source: string, lineOffset = 1) => {
187 return source.split('\n').map((line, index) => `${index + lineOffset}: ${line}`).join('\n');

Callers 2

ChatThreadFunction · 0.90
ConnectorsMenuFunction · 0.90

Calls 1

clearEditorHistoryFunction · 0.85

Tested by

no test coverage detected