diff --git a/core/promptFiles/v2/renderPromptFile.ts b/core/promptFiles/v2/renderPromptFile.ts index 89b36b0a8..2d1f92510 100644 --- a/core/promptFiles/v2/renderPromptFile.ts +++ b/core/promptFiles/v2/renderPromptFile.ts @@ -26,8 +26,21 @@ async function resolveAttachment( // Files if (await extras.ide.fileExists(name)) { + let subItems: ContextItem[] = []; + if (name.endsWith(".prompt")) { + // Recurse + const [items, _] = await renderPromptFileV2( + await extras.ide.readFile(name), + extras, + ); + subItems.push(...items); + } + const content = `\`\`\`${name}\n${await extras.ide.readFile(name)}\n\`\`\``; - return [{ name: getBasename(name), content, description: name }]; + return [ + ...subItems, + { name: getBasename(name), content, description: name }, + ]; } // URLs diff --git a/docs/docs/customize/deep-dives/prompt-files.md b/docs/docs/customize/deep-dives/prompt-files.md index fd8a1ae94..7269a459a 100644 --- a/docs/docs/customize/deep-dives/prompt-files.md +++ b/docs/docs/customize/deep-dives/prompt-files.md @@ -47,12 +47,23 @@ If you don't need any of these parameters, you can leave out the preamble and do ### Context -Many [context provider](../context-providers.md) can be referenced by typing "@" followed by the name of the context provider. +Many [context provider](../context-providers.md) can be referenced by typing "@" followed by the name of the context provider. The currently supported list is: - `@terminal` - The contents of the terminal +- `@currentFile` - The currently active file +- `@open` - All open files +- `@os` - Information about the operating system +- `@problems` - Problems reported by the language server in the active file +- `@repo-map` - A map of files in the repository +- `@tree` - A tree view of the repository structure + +Or you can directly type URLs and file paths: + - `@https://github.com/continuedev/continue` - The contents of a URL - `@src/index.ts` - The contents of a file (VS Code only) +All references will be attached as context items, rather than injected directly inline. + ## Feedback If you have ideas about how to improve the `.prompt` file format, please reach out on [Discord](https://discord.gg/NWtdYexhMs).