MCPcopy
hub / github.com/loggerhead/json4u / parseAndSet

Method parseAndSet

src/lib/editor/editor.ts:212–227  ·  view source on GitHub ↗
(
    text: string,
    extraParseOptions?: ParseOptions,
    resetCursor: boolean = true,
  )

Source from the content-addressed store, hash-verified

210 }
211
212 async parseAndSet(
213 text: string,
214 extraParseOptions?: ParseOptions,
215 resetCursor: boolean = true,
216 ): Promise<{ set: boolean; parse: boolean }> {
217 const options = {
218 ...getStatusState().parseOptions,
219 ...extraParseOptions,
220 kind: this.kind,
221 };
222
223 reportTextSize(text.length);
224 const parsedTree = await this.worker().parseAndFormat(text, options);
225 const tree = this.setTree(parsedTree, resetCursor);
226 return { set: true, parse: tree.valid() };
227 }
228
229 listenOnChange() {
230 this.editor.onDidChangeModelContent(async (ev) => {

Callers 7

listenOnDidPasteMethod · 0.95
listenOnDropFileMethod · 0.95
editorStore.tsFile · 0.80
useExecJqFunction · 0.80
useFilterFunction · 0.80
useOnFileFunction · 0.80
useDisplayExampleFunction · 0.80

Calls 5

workerMethod · 0.95
setTreeMethod · 0.95
getStatusStateFunction · 0.90
reportTextSizeFunction · 0.85
validMethod · 0.80

Tested by

no test coverage detected