(selection: ReaderSelection)
| 4780 | }; |
| 4781 | |
| 4782 | const attachSelection = (selection: ReaderSelection): void => { |
| 4783 | if (selection.path !== activePath || document?.path !== activePath) return; |
| 4784 | const range = { startLine: selection.startLine, endLine: selection.endLine |
| 4785 | - (selection.endColumn === 1 && selection.endLine > selection.startLine ? 1 : 0) }; |
| 4786 | const symbol = symbolMatchesReader(liveCode.symbol, selection.path, range) ? liveCode.symbol : undefined; |
| 4787 | setReaderSelection(selection); |
| 4788 | setChatAttachment(undefined); |
| 4789 | setChatGraphSelection(inspectorChatContext({ ...liveCode, symbol, |
| 4790 | ir: matchingInspectorIr(liveCode.ir, symbol, project, activePath), selection }, crypto.randomUUID())); |
| 4791 | setBrowserAiOpen(true); |
| 4792 | }; |
| 4793 | // The chat grounds explanations in the selected symbol's source, read like "Read source evidence" (K14). |
| 4794 | const readSymbolSource = useCallback((qualifiedName: string, window: { maxLines: number }) => |
| 4795 | client.getCodeSnippet(project, qualifiedName, window), [client, project]); |
no test coverage detected