( ideSelection: IDESelection | null, toolUseContext: ToolUseContext, )
| 1612 | } |
| 1613 | |
| 1614 | async function getSelectedLinesFromIDE( |
| 1615 | ideSelection: IDESelection | null, |
| 1616 | toolUseContext: ToolUseContext, |
| 1617 | ): Promise<Attachment[]> { |
| 1618 | const ideName = getConnectedIdeName(toolUseContext.options.mcpClients) |
| 1619 | if ( |
| 1620 | !ideName || |
| 1621 | ideSelection?.lineStart === undefined || |
| 1622 | !ideSelection.text || |
| 1623 | !ideSelection.filePath |
| 1624 | ) { |
| 1625 | return [] |
| 1626 | } |
| 1627 | |
| 1628 | const appState = toolUseContext.getAppState() |
| 1629 | if (isFileReadDenied(ideSelection.filePath, appState.toolPermissionContext)) { |
| 1630 | return [] |
| 1631 | } |
| 1632 | |
| 1633 | return [ |
| 1634 | { |
| 1635 | type: 'selected_lines_in_ide', |
| 1636 | ideName, |
| 1637 | lineStart: ideSelection.lineStart, |
| 1638 | lineEnd: ideSelection.lineStart + ideSelection.lineCount - 1, |
| 1639 | filename: ideSelection.filePath, |
| 1640 | content: ideSelection.text, |
| 1641 | displayPath: relative(getCwd(), ideSelection.filePath), |
| 1642 | }, |
| 1643 | ] |
| 1644 | } |
| 1645 | |
| 1646 | /** |
| 1647 | * Computes the directories to process for nested memory file loading. |
no test coverage detected