MCPcopy
hub / github.com/codeaashu/claude-code / selectionChangeHandler

Function selectionChangeHandler

src/hooks/useIdeSelection.ts:91–109  ·  view source on GitHub ↗
(data: SelectionData)

Source from the content-addressed store, hash-verified

89
90 // Handler function for selection changes
91 const selectionChangeHandler = (data: SelectionData) => {
92 if (data.selection?.start && data.selection?.end) {
93 const { start, end } = data.selection
94 let lineCount = end.line - start.line + 1
95 // If on the first character of the line, do not count the line
96 // as being selected.
97 if (end.character === 0) {
98 lineCount--
99 }
100 const selection = {
101 lineCount,
102 lineStart: start.line,
103 text: data.text,
104 filePath: data.filePath,
105 }
106
107 onSelect(selection)
108 }
109 }
110
111 // Register notification handler for selection_changed events
112 ideClient.client.setNotificationHandler(

Callers 1

useIdeSelectionFunction · 0.85

Calls 1

onSelectFunction · 0.50

Tested by

no test coverage detected