MCPcopy Index your code
hub / github.com/claude-code-best/claude-code / getOpenedFileFromIDE

Function getOpenedFileFromIDE

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

Source from the content-addressed store, hash-verified

1914}
1915
1916async 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
1946async function processAtMentionedFiles(
1947 input: string,

Callers 1

getAttachmentsFunction · 0.85

Calls 2

isFileReadDeniedFunction · 0.85

Tested by

no test coverage detected