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

Interface Statistics

core/src/utils.ts:4–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2import type { ViewUpdate } from '@codemirror/view';
3
4export interface Statistics {
5 /** total length of the document */
6 length: number;
7 /** Get the number of lines in the editor. */
8 lineCount: number;
9 /** Get the currently line description around the given position. */
10 line: Line;
11 /** Get the proper [line-break](https://codemirror.net/docs/ref/#state.EditorState^lineSeparator) string for this state. */
12 lineBreak: string;
13 /** Returns true when the editor is [configured](https://codemirror.net/6/docs/ref/#state.EditorState^readOnly) to be read-only. */
14 readOnly: boolean;
15 /** The size (in columns) of a tab in the document, determined by the [`tabSize`](https://codemirror.net/6/docs/ref/#state.EditorState^tabSize) facet. */
16 tabSize: number;
17 /** Cursor Position */
18 selection: EditorSelection;
19 /** Make sure the selection only has one range. */
20 selectionAsSingle: SelectionRange;
21 /** Retrieves a list of all current selections. */
22 ranges: readonly SelectionRange[];
23 /** Get the currently selected code. */
24 selectionCode: string;
25 /**
26 * The length of the given array should be the same as the number of active selections.
27 * Replaces the content of the selections with the strings in the array.
28 */
29 selections: string[];
30 /** Return true if any text is selected. */
31 selectedText: boolean;
32}
33
34export const getStatistics = (view: ViewUpdate): Statistics => {
35 return {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…