SourceCraft Code Assistant prompt library
Warning
This feature is only available in Visual Studio Code.
Code Assistant now features a prompt library for chats, which contains templates for frequently used requests.
You can use a preset prompt, edit one, or add your own custom prompt.
Note
The interface language of the Visual Studio Code plugin depends on the selected IDE language.
Using prompts
-
Click
SourceCraft Code Assistant in the editor’s left panel.If you have many plugins, the chat button may be hidden in the
menu.Alternatively, use Ctrl + L in Windows/Linux or Command + L in macOS.
- In the message input window, click
. - View the prompt description:
- Hover over the prompt to view its brief description.
- To view the full text of the prompt, click
next to it.
- Select the prompt.
- If appropriate, edit the text, e.g., fill in the placeholders, such as
#{function name}
, add context and rules. - Click
or press Enter.
Editing a preset prompt
- In the message input window, click
. - Next to the prompt you want to edit, click
. - Edit the prompt text and save the changes.
Adding your custom prompt
-
In the message input window, click
. -
Click
Add prompt. -
In the file that opens, fill in the prompt parameters in the section separated by
---
.- name: Prompt name by which you can find the prompt in the
menu. - description: Brief description of the prompt to display when you hover over it.
If you do not specify the name and description parameters, they will be generated from the file name and the first lines of the prompt.
- name: Prompt name by which you can find the prompt in the
-
Add prompt text and save the file.
The prompt file will be saved at <project_directory>/.codeassistant/prompts/<filename>.mdc
.
You can also manually add prompt files with the .md
and .mdc
extensions to the specified directory and its subdirectories.
In .mdc
files, there is a section for the prompt name and description:
---
name: Enter your rule name
description: Enter your rule description
---