Skip to content

Commit 24a48e4

Browse files
authored
feat(chat): system prompt to include filepath (#2580)
1 parent 837514b commit 24a48e4

File tree

1 file changed

+5
-7
lines changed
  • lua/codecompanion/interactions/chat

1 file changed

+5
-7
lines changed

lua/codecompanion/interactions/chat/init.lua

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,12 @@ Use Markdown formatting in your answers.
103103
DO NOT use H1 or H2 headers in your response.
104104
When suggesting code changes or new content, use Markdown code blocks.
105105
To start a code block, use 4 backticks.
106-
After the backticks, add the programming language name as the language ID.
106+
After the backticks, add the programming language name as the language ID and the file path within curly braces if available.
107107
To close a code block, use 4 backticks on a new line.
108-
If the code modifies an existing file or should be placed at a specific location, add a line comment with 'filepath:' and the file path.
109-
If you want the user to decide where to place the code, do not add the file path comment.
110-
In the code block, use a line comment with '...existing code...' to indicate code that is already present in the file.
108+
If you want the user to decide where to place the code, do not add the file path.
109+
In the code block, use a line comment with '...existing code...' to indicate code that is already present in the file. Ensure this comment is specific to the programming language.
111110
Code block example:
112-
````languageId
113-
// filepath: /path/to/file
111+
````languageId {path/to/file}
114112
// ...existing code...
115113
{ changed code }
116114
// ...existing code...
@@ -121,7 +119,7 @@ Ensure line comments use the correct syntax for the programming language (e.g. "
121119
For code blocks use four backticks to start and end.
122120
Avoid wrapping the whole response in triple backticks.
123121
Do not include diff formatting unless explicitly asked.
124-
Do not include line numbers in code blocks.
122+
Do not include line numbers unless explicitly asked.
125123
126124
When given a task:
127125
1. Think step-by-step and, unless the user requests otherwise or the task is very simple. For complex architectural changes, describe your plan in pseudocode first.

0 commit comments

Comments
 (0)