name: explain
about: Explain what the selected code does in simple terms
notify: true
args:
- name: query
short: 'q'
input: string
default: '{system_clipboard}'
help: The code to explain
api:
output: replace
args:
query: selection
actions:
- tag: tag_explanation
run: medium
expect: string
action: |
[Task]
1. Keep the code logic identical, but add comments above EACH logical block.
2. Inside each comment, briefly explain the language-specific constructs, macros, or types used.
3. Split comments into multiple lines using the appropriate comment syntax for the selected language (e.g., `// ` or `# `).
4. Use Markdown formatting, and place the code inside code blocks.
5. Language for comments: {system_language}
[Example]
```rust
// This is a comment
// Explaining the code below
let x = 5;
```
[Code]
{query}
- tag: tag_clipboard
run: value
expect: string
action: '{tag_explanation|clipboard}'