MCPcopy Create free account
hub / github.com/uiwjs/react-codemirror / getStatistics

Function getStatistics

core/src/utils.ts:34–49  ·  view source on GitHub ↗
(view: ViewUpdate)

Source from the content-addressed store, hash-verified

32}
33
34export const getStatistics = (view: ViewUpdate): Statistics => {
35 return {
36 line: view.state.doc.lineAt(view.state.selection.main.from),
37 lineCount: view.state.doc.lines,
38 lineBreak: view.state.lineBreak,
39 length: view.state.doc.length,
40 readOnly: view.state.readOnly,
41 tabSize: view.state.tabSize,
42 selection: view.state.selection,
43 selectionAsSingle: view.state.selection.asSingle().main,
44 ranges: view.state.selection.ranges,
45 selectionCode: view.state.sliceDoc(view.state.selection.main.from, view.state.selection.main.to),
46 selections: view.state.selection.ranges.map((r) => view.state.sliceDoc(r.from, r.to)),
47 selectedText: view.state.selection.ranges.some((r) => !r.empty),
48 };
49};

Callers 1

useCodeMirrorFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…