( ideSelection: IDESelection | null, toolUseContext: ToolUseContext, )
| 1914 | } |
| 1915 | |
| 1916 | async function getOpenedFileFromIDE( |
| 1917 | ideSelection: IDESelection | null, |
| 1918 | toolUseContext: ToolUseContext, |
| 1919 | ): Promise<Attachment[]> { |
| 1920 | if (!ideSelection?.filePath || ideSelection.text) { |
| 1921 | return [] |
| 1922 | } |
| 1923 | |
| 1924 | const appState = toolUseContext.getAppState() |
| 1925 | if (isFileReadDenied(ideSelection.filePath, appState.toolPermissionContext)) { |
| 1926 | return [] |
| 1927 | } |
| 1928 | |
| 1929 | // Get nested memory files |
| 1930 | const nestedMemoryAttachments = await getNestedMemoryAttachmentsForFile( |
| 1931 | ideSelection.filePath, |
| 1932 | toolUseContext, |
| 1933 | appState, |
| 1934 | ) |
| 1935 | |
| 1936 | // Return nested memory attachments followed by the opened file attachment |
| 1937 | return [ |
| 1938 | ...nestedMemoryAttachments, |
| 1939 | { |
| 1940 | type: 'opened_file_in_ide', |
| 1941 | filename: ideSelection.filePath, |
| 1942 | }, |
| 1943 | ] |
| 1944 | } |
| 1945 | |
| 1946 | async function processAtMentionedFiles( |
| 1947 | input: string, |
no test coverage detected