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
refactor!: use sticky instead of stored config per chat
1. **Centralized sticky prompt management**: The new `insert_sticky` function handles all sticky prompt logic in one place, making it easier to maintain.
2. **Improved selection management**: The addition of `M.set_selection` provides a clean API for managing selection state.
3. **Consistent function signatures**: Standardized function signatures with `resolve_prompt`, `resolve_agent`, etc. all having consistent parameter order and return values.
4. **Better highlight management**: The highlighting logic is now consolidated in `update_highlights`.
5. **Simplified code flow**: Removed redundant functions like `highlight_selection` and integrated their functionality into the main code flow.
6. **Improved prompt handling**: The `Chat:set_prompt` function now provides a cleaner way to update the prompt content.
BREAKING CHANGE: The API for working with prompts has changed. `resolve_prompts` is now `resolve_prompt`
with different parameter order and return values. Selection can now only be configured in `.setup()`
Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
@@ -535,10 +536,12 @@ Below are all available configuration options with their default values:
535
536
-- see config/prompts.lua for implementation
536
537
prompts= {
537
538
Explain= {
538
-
prompt='> /COPILOT_EXPLAIN\n\nWrite an explanation for the selected code as paragraphs of text.',
539
+
prompt='Write an explanation for the selected code as paragraphs of text.',
540
+
sticky='/COPILOT_EXPLAIN',
539
541
},
540
542
Review= {
541
-
prompt='> /COPILOT_REVIEW\n\nReview the selected code.',
543
+
prompt='Review the selected code.',
544
+
sticky='/COPILOT_REVIEW',
542
545
},
543
546
Fix= {
544
547
prompt='There is a problem in this code. Identify the issues and rewrite the code with fixes. Explain what was wrong and how your changes address the problems.',
@@ -553,7 +556,8 @@ Below are all available configuration options with their default values:
553
556
prompt='Please generate tests for my code.',
554
557
},
555
558
Commit= {
556
-
prompt='> #git:staged\n\nWrite commit message for the change with commitizen convention. Keep the title under 50 characters and wrap message at 72 characters. Format as a gitcommit code block.',
559
+
prompt='Write commit message for the change with commitizen convention. Keep the title under 50 characters and wrap message at 72 characters. Format as a gitcommit code block.',
Copy file name to clipboardExpand all lines: lua/CopilotChat/config/prompts.lua
+6-3Lines changed: 6 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -96,11 +96,13 @@ return {
96
96
},
97
97
98
98
Explain= {
99
-
prompt='> /COPILOT_EXPLAIN\n\nWrite an explanation for the selected code as paragraphs of text.',
99
+
prompt='Write an explanation for the selected code as paragraphs of text.',
100
+
sticky='/COPILOT_EXPLAIN',
100
101
},
101
102
102
103
Review= {
103
-
prompt='> /COPILOT_REVIEW\n\nReview the selected code.',
104
+
prompt='Review the selected code.',
105
+
sticky='/COPILOT_REVIEW',
104
106
callback=function(response, source)
105
107
localdiagnostics= {}
106
108
forlineinresponse:gmatch('[^\r\n]+') do
@@ -159,6 +161,7 @@ return {
159
161
},
160
162
161
163
Commit= {
162
-
prompt='> #git:staged\n\nWrite commit message for the change with commitizen convention. Keep the title under 50 characters and wrap message at 72 characters. Format as a gitcommit code block.',
164
+
prompt='Write commit message for the change with commitizen convention. Keep the title under 50 characters and wrap message at 72 characters. Format as a gitcommit code block.',
0 commit comments