MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / getLineSelectionRange

Function getLineSelectionRange

src/cm/lineNumberSelection.ts:30–41  ·  view source on GitHub ↗
(
	state: EditorView["state"],
	line: LineInfo,
)

Source from the content-addressed store, hash-verified

28 * full-line selection behavior.
29 */
30export function getLineSelectionRange(
31 state: EditorView["state"],
32 line: LineInfo,
33): { from: number; to: number } | null {
34 if (!line) return null;
35 const from = Math.max(0, toDocumentOffset(line.from));
36 const to = Math.max(from, toDocumentOffset(line.to, from));
37 return {
38 from,
39 to: Math.min(to + 1, state.doc.length),
40 };
41}
42
43function getCurrentSelectionLineRange(state: EditorView["state"]): {
44 from: number;

Callers 2

handleLineNumberClickFunction · 0.85

Calls 1

toDocumentOffsetFunction · 0.85

Tested by

no test coverage detected