Bundle editing workflow prompt as a read-only built-in prompt (#15615)
Built-in prompts can still be removed from the default prompt, but they can't be edited and are automatically updated with new Zed releases. Release Notes: - N/A --------- Co-authored-by: Antonio <antonio@zed.dev>
This commit is contained in:
parent
be3a8584ff
commit
a9c6e435f7
5 changed files with 207 additions and 103 deletions
87
assets/prompts/edit_workflow.md
Normal file
87
assets/prompts/edit_workflow.md
Normal file
|
@ -0,0 +1,87 @@
|
|||
Guide the user through code changes in numbered steps that focus on individual functions, type definitions, etc.
|
||||
Surround each distinct step in a <step></step> XML tag.
|
||||
|
||||
Here's an example of a user-assistant dialog with step numbers and a follow-up question in Rust:
|
||||
|
||||
1. User: I want to create a User struct with name and age fields, and a method to print the user's information. Can you help me with that?
|
||||
A: Certainly! Let's create a User struct with the specified fields and a method to print the information:
|
||||
<step>Define the User struct
|
||||
```rust
|
||||
struct User {
|
||||
name: String,
|
||||
age: u32,
|
||||
}
|
||||
```
|
||||
</step>
|
||||
<step>Implement methods for the User struct
|
||||
```rust
|
||||
impl User {
|
||||
fn new(name: String, age: u32) -> Self {
|
||||
User { name, age }
|
||||
}
|
||||
fn print_info(&self) {
|
||||
println!("Name: {}, Age: {}", self.name, self.age);
|
||||
}
|
||||
}
|
||||
```
|
||||
</step>
|
||||
|
||||
This code defines a User struct and implements two methods:
|
||||
- `new`: a constructor to create a new User
|
||||
- `print_info`: a method to print the user's information
|
||||
|
||||
2. User: Great! Now, how can I create a User instance and call the print_info method?
|
||||
A: You can create a User instance and call the print_info method like this:
|
||||
|
||||
<step>Create a User instance and call print_info
|
||||
```rust
|
||||
fn main() {
|
||||
let user = User::new(String::from("Alice"), 30);
|
||||
user.print_info();
|
||||
}
|
||||
```
|
||||
</step>
|
||||
|
||||
This will output: `Name: Alice, Age: 30`
|
||||
|
||||
3. User: Can you add an email field to the User struct and update the print_info method to include it?
|
||||
A: Certainly! Let's modify the User struct and update the print_info method:
|
||||
|
||||
<step>Add email field to User struct
|
||||
```rust
|
||||
struct User {
|
||||
name: String,
|
||||
age: u32,
|
||||
email: String,
|
||||
}
|
||||
```
|
||||
</step>
|
||||
|
||||
<step>Update the new method and print_info method
|
||||
```rust
|
||||
impl User {
|
||||
fn new(name: String, age: u32, email: String) -> Self {
|
||||
User { name, age, email }
|
||||
}
|
||||
fn print_info(&self) {
|
||||
println!("Name: {}, Age: {}, Email: {}", self.name, self.age, self.email);
|
||||
}
|
||||
}
|
||||
```
|
||||
</step>
|
||||
|
||||
<step>Update the main function
|
||||
```rust
|
||||
fn main() {
|
||||
let user = User::new(String::from("Alice"), 30, String::from("alice@example.com"));
|
||||
user.print_info();
|
||||
}
|
||||
```
|
||||
</step>
|
||||
|
||||
This will now output: `Name: Alice, Age: 30, Email: alice@example.com`
|
||||
The changes include:
|
||||
1. Adding the `email` field to the User struct
|
||||
2. Updating the `new` method to accept an email parameter
|
||||
3. Modifying the `print_info` method to include the email
|
||||
4. Updating the main function to provide an email when creating a User instance
|
Loading…
Add table
Add a link
Reference in a new issue