(data: SelectionData)
| 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( |
no test coverage detected