Instructed Suggestions
Introduced on 2024-09-12
Sometimes you may want the suggestions to complete or modify the code in the way you want. You can use instructed suggestions to achieve this.
There are two types of instructed suggestions:
- Keep Writing: This will guide the model to continue writing the code as instructed.
- Rewrite: This will guide the model to rewrite the current line to meet the instruction.
Keep Writing
For example, you have the following code:
You may want the rectangle to have a specific size. So you keep writing the code in this way:
And the app may generate the correct code for you .frame(width: 200, height: 300)
.
Rewrite
For rewrite, you can use another token \\<
to tell the app to rewrite the current line.
For example, you have the following code:
And the app may generate the correct code for you var assistant: String
.
If no instruction is provided, the app will try to use warning/error messages as the instruction.
For example, you have the following code:
The app may fix the code for you by adding await
in the correct place.