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