MCPcopy Index your code
hub / github.com/codeaashu/claude-code / getSelectedLinesFromIDE

Function getSelectedLinesFromIDE

src/utils/attachments.ts:1614–1644  ·  view source on GitHub ↗
(
  ideSelection: IDESelection | null,
  toolUseContext: ToolUseContext,
)

Source from the content-addressed store, hash-verified

1612}
1613
1614async 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.

Callers 1

getAttachmentsFunction · 0.85

Calls 3

getConnectedIdeNameFunction · 0.85
isFileReadDeniedFunction · 0.85
getCwdFunction · 0.85

Tested by

no test coverage detected