MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / readSelection

Function readSelection

graph-ui/src/reader/MonacoReader.tsx:119–135  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

117 selectionProps.current = props;
118
119 function readSelection(): ReaderSelection | undefined {
120 const editor = editorRef.current;
121 const model = editor?.getModel();
122 const range = editor?.getSelection();
123 const document = selectionProps.current.document;
124 if (!model || !range || range.isEmpty() || !document || selectionProps.current.status !== 'ready') return;
125 const text = model.getValueInRange(range);
126 if (text.length === 0) return;
127 return {
128 text, path: document.path,
129 startLine: document.firstLine + range.startLineNumber - 1,
130 startColumn: range.startColumn,
131 endLine: document.firstLine + range.endLineNumber - 1,
132 endColumn: range.endColumn,
133 sourceVersion: `editor:${model.id}:${model.getVersionId()}`,
134 };
135 }
136
137 function createEditor(host: HTMLDivElement) {
138 const monaco = prepareMonaco();

Callers 1

MonacoReaderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected