You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Everything in blockquote is copied to the next prompt and added at start
automatically. This is useful for preserving context/agents etc.
- Remove SHOW_CONTEXT prompt as with sticky its no longer necessary imo and
claude works fine without additional debugging.
- Use new sticky feature with default prompts so the system prompt choice is
remembered automatically
- Add new `toggle_sticky_line` mapping for toggling sticky line under cursor
- Update README with sticky prompts, prompts and system prompts
Example:
```markdown
> #files
explain me this
---
> #files
```
Signed-off-by: Tomas Slusny <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+51-18Lines changed: 51 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -108,19 +108,49 @@ Verify "[Copilot chat in the IDE](https://github.com/settings/copilot)" is enabl
108
108
-`:CopilotChatModels` - View and select available models. This is reset when a new instance is made. Please set your model in `init.lua` for persistence.
109
109
-`:CopilotChatAgents` - View and select available agents. This is reset when a new instance is made. Please set your agent in `init.lua` for persistence.
110
110
111
-
#### Commands coming from default prompts
111
+
###Prompts
112
112
113
-
-`:CopilotChatExplain` - Write an explanation for the selected code and diagnostics as paragraphs of text
114
-
-`:CopilotChatReview` - Review the selected code
115
-
-`:CopilotChatFix` - There is a problem in this code. Rewrite the code to show it with the bug fixed
116
-
-`:CopilotChatOptimize` - Optimize the selected code to improve performance and readability
117
-
-`:CopilotChatDocs` - Please add documentation comments to the selected code
118
-
-`:CopilotChatTests` - Please generate tests for my code
119
-
-`:CopilotChatCommit` - Write commit message for the change with commitizen convention
113
+
You can ask Copilot to do various tasks with prompts. You can reference prompts with `/PromptName` in chat or call with command `:CopilotChat<PromptName>`.
114
+
Default prompts are:
120
115
121
-
### Models, Agents and Contexts
116
+
-`Explain` - Write an explanation for the selected code and diagnostics as paragraphs of text
117
+
-`Review` - Review the selected code
118
+
-`Fix` - There is a problem in this code. Rewrite the code to show it with the bug fixed
119
+
-`Optimize` - Optimize the selected code to improve performance and readability
120
+
-`Docs` - Please add documentation comments to the selected code
121
+
-`Tests` - Please generate tests for my code
122
+
-`Commit` - Write commit message for the change with commitizen convention
122
123
123
-
#### Models
124
+
### System Prompts
125
+
126
+
System prompts specify the behavior of the AI model. You can reference system prompts with `/PROMPT_NAME` in chat.
127
+
Default system prompts are:
128
+
129
+
-`COPILOT_INSTRUCTIONS` - Base GitHub Copilot instructions
130
+
-`COPILOT_EXPLAIN` - On top of the base instructions adds coding tutor behavior
131
+
-`COPILOT_REVIEW` - On top of the base instructions adds code review behavior with instructions on how to generate diagnostics
132
+
-`COPILOT_GENERATE` - On top of the base instructions adds code generation behavior, with predefined formatting and generation rules
133
+
134
+
### Sticky Prompts
135
+
136
+
You can set sticky prompt in chat by prefixing the text with `> ` using markdown blockquote syntax.
137
+
The sticky prompt will be copied at start of every new prompt in chat window. You can freely edit the sticky prompt, only rule is `> ` prefix at beginning of line.
138
+
This is useful for preserving stuff like context and agent selection (see below).
139
+
Example usage:
140
+
141
+
```markdown
142
+
> #files
143
+
144
+
List all files in the workspace
145
+
```
146
+
147
+
```markdown
148
+
> @models Using Mistral-small
149
+
150
+
What is 1 + 11
151
+
```
152
+
153
+
### Models
124
154
125
155
You can list available models with `:CopilotChatModels` command. Model determines the AI model used for the chat.
126
156
Default models are:
@@ -133,7 +163,7 @@ Default models are:
133
163
For more information about models, see [here](https://docs.github.com/en/copilot/using-github-copilot/asking-github-copilot-questions-in-your-ide#ai-models-for-copilot-chat)
134
164
You can use more models from [here](https://github.com/marketplace/models) by using `@models` agent from [here](https://github.com/marketplace/models-github) (example: `@models Using Mistral-small, what is 1 + 11`)
135
165
136
-
####Agents
166
+
### Agents
137
167
138
168
Agents are used to determine the AI agent used for the chat. You can list available agents with `:CopilotChatAgents` command.
139
169
You can set the agent in the prompt by using `@` followed by the agent name.
@@ -142,7 +172,7 @@ Default "noop" agent is `copilot`.
142
172
For more information about extension agents, see [here](https://docs.github.com/en/copilot/using-github-copilot/using-extensions-to-integrate-external-tools-with-copilot-chat)
143
173
You can install more agents from [here](https://github.com/marketplace?type=apps&copilot_app=true)
144
174
145
-
####Contexts
175
+
### Contexts
146
176
147
177
Contexts are used to determine the context of the chat.
148
178
You can set the context in the prompt by using `#` followed by the context name.
@@ -262,25 +292,25 @@ Also see [here](/lua/CopilotChat/config.lua):
262
292
-- default prompts
263
293
prompts= {
264
294
Explain= {
265
-
prompt='/COPILOT_EXPLAIN Write an explanation for the selected code and diagnostics as paragraphs of text.',
295
+
prompt='> /COPILOT_EXPLAIN\n\nWrite an explanation for the selected code and diagnostics as paragraphs of text.',
266
296
},
267
297
Review= {
268
-
prompt='/COPILOT_REVIEW Review the selected code.',
298
+
prompt='> /COPILOT_REVIEW\n\nReview the selected code.',
269
299
callback=function(response, source)
270
300
-- see config.lua for implementation
271
301
end,
272
302
},
273
303
Fix= {
274
-
prompt='/COPILOT_GENERATE There is a problem in this code. Rewrite the code to show it with the bug fixed.',
304
+
prompt='> /COPILOT_GENERATE\n\nThere is a problem in this code. Rewrite the code to show it with the bug fixed.',
275
305
},
276
306
Optimize= {
277
-
prompt='/COPILOT_GENERATE Optimize the selected code to improve performance and readability.',
307
+
prompt='> /COPILOT_GENERATE\n\nOptimize the selected code to improve performance and readability.',
278
308
},
279
309
Docs= {
280
-
prompt='/COPILOT_GENERATE Please add documentation comments to the selected code.',
310
+
prompt='> /COPILOT_GENERATE\n\nPlease add documentation comments to the selected code.',
281
311
},
282
312
Tests= {
283
-
prompt='/COPILOT_GENERATE Please generate tests for my code.',
313
+
prompt='> /COPILOT_GENERATE\n\nPlease generate tests for my code.',
284
314
},
285
315
Commit= {
286
316
prompt='Write commit message for the change with commitizen convention. Make sure the title has maximum 50 characters and message is wrapped at 72 characters. Wrap the whole message in code block with language gitcommit.',
@@ -321,6 +351,9 @@ Also see [here](/lua/CopilotChat/config.lua):
prompt='/COPILOT_EXPLAIN Write an explanation for the selected code and diagnostics as paragraphs of text.',
129
+
prompt='> /COPILOT_EXPLAIN\n\nWrite an explanation for the selected code and diagnostics as paragraphs of text.',
129
130
},
130
131
Review= {
131
-
prompt='/COPILOT_REVIEW Review the selected code.',
132
+
prompt='> /COPILOT_REVIEW\n\nReview the selected code.',
132
133
callback=function(response, source)
133
134
localdiagnostics= {}
134
135
forlineinresponse:gmatch('[^\r\n]+') do
@@ -170,16 +171,16 @@ return {
170
171
end,
171
172
},
172
173
Fix= {
173
-
prompt='/COPILOT_GENERATE There is a problem in this code. Rewrite the code to show it with the bug fixed.',
174
+
prompt='> /COPILOT_GENERATE\n\nThere is a problem in this code. Rewrite the code to show it with the bug fixed.',
174
175
},
175
176
Optimize= {
176
-
prompt='/COPILOT_GENERATE Optimize the selected code to improve performance and readability.',
177
+
prompt='> /COPILOT_GENERATE\n\nOptimize the selected code to improve performance and readability.',
177
178
},
178
179
Docs= {
179
-
prompt='/COPILOT_GENERATE Please add documentation comments to the selected code.',
180
+
prompt='> /COPILOT_GENERATE\n\nPlease add documentation comments to the selected code.',
180
181
},
181
182
Tests= {
182
-
prompt='/COPILOT_GENERATE Please generate tests for my code.',
183
+
prompt='> /COPILOT_GENERATE\n\nPlease generate tests for my code.',
183
184
},
184
185
Commit= {
185
186
prompt='Write commit message for the change with commitizen convention. Make sure the title has maximum 50 characters and message is wrapped at 72 characters. Wrap the whole message in code block with language gitcommit.',
0 commit comments