Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'sibling' elements that cannot be pruned individually #142

Open
connor4312 opened this issue Jan 6, 2025 · 0 comments
Open

Add 'sibling' elements that cannot be pruned individually #142

connor4312 opened this issue Jan 6, 2025 · 0 comments
Assignees

Comments

@connor4312
Copy link
Member

connor4312 commented Jan 6, 2025

Some prompts use XML tags like

<tag>
content
</tag>

We should ensure that the opening and closing tags cannot be pruned individually. I suggest something like

import { PromptElement, usePruneWith } from '@vscode/prompt-tsx';

class MyPromptElements extends PromptElement {
  render() {
    const token = usePruneWith();
    return <>
      <Chunk pruneWith={token}>{`<${this.props.tagName}>`}</Chunk>
      {this.children}
      <Chunk pruneWith={token}>{`</${this.props.tagName}>`}</Chunk>
    </>;
  }
}
@connor4312 connor4312 self-assigned this Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant