MCPcopy Create free account
hub / github.com/WJX20/claude-code / getOpenedFileFromIDE

Function getOpenedFileFromIDE

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

Source from the content-addressed store, hash-verified

1863}
1864
1865async function getOpenedFileFromIDE(
1866 ideSelection: IDESelection | null,
1867 toolUseContext: ToolUseContext,
1868): Promise<Attachment[]> {
1869 if (!ideSelection?.filePath || ideSelection.text) {
1870 return []
1871 }
1872
1873 const appState = toolUseContext.getAppState()
1874 if (isFileReadDenied(ideSelection.filePath, appState.toolPermissionContext)) {
1875 return []
1876 }
1877
1878 // Get nested memory files
1879 const nestedMemoryAttachments = await getNestedMemoryAttachmentsForFile(
1880 ideSelection.filePath,
1881 toolUseContext,
1882 appState,
1883 )
1884
1885 // Return nested memory attachments followed by the opened file attachment
1886 return [
1887 ...nestedMemoryAttachments,
1888 {
1889 type: 'opened_file_in_ide',
1890 filename: ideSelection.filePath,
1891 },
1892 ]
1893}
1894
1895async function processAtMentionedFiles(
1896 input: string,

Callers 1

getAttachmentsFunction · 0.85

Calls 2

isFileReadDeniedFunction · 0.85

Tested by

no test coverage detected