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