MCPcopy Create free account
hub / github.com/Noumena-Network/code / getOpenedFileFromIDE

Function getOpenedFileFromIDE

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

Source from the content-addressed store, hash-verified

1868}
1869
1870async 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
1900async function processAtMentionedFiles(
1901 input: string,

Callers 1

getAttachmentsFunction · 0.85

Calls 2

isFileReadDeniedFunction · 0.85

Tested by

no test coverage detected