Merge pull request #3412 from continuedev/nate/quick-edit-6649

recursively render .prompt files
This commit is contained in:
Nate Sesti 2024-12-16 14:04:55 -08:00 • committed by GitHub
commit 645468623c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 26 additions and 2 deletions

View file

@ -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

View file

@ -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).