-
-
Notifications
You must be signed in to change notification settings - Fork 172
Language settings for copilot answers #173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -396,10 +396,23 @@ function M.debug(debug) | |
| log.logfile = logfile | ||
| end | ||
|
|
||
| --- Set up the language for default prompts | ||
| ---@param config CopilotChat.config|nil | ||
| function M.setup_copilot_language(config) | ||
| if not config or not config.language then | ||
| return | ||
| end | ||
|
|
||
| for _, prompt in pairs(config.prompts) do | ||
| prompt.prompt = prompt.prompt .. ' ' .. prompts.PROMPT_ANSWER_LANGUAGE_TEMPLATE(config.language) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do not edit config, see how updating prompt is handled elsewhere. |
||
| end | ||
| end | ||
|
|
||
| --- Set up the plugin | ||
| ---@param config CopilotChat.config|nil | ||
| function M.setup(config) | ||
| M.config = vim.tbl_deep_extend('force', default_config, config or {}) | ||
| M.setup_copilot_language(M.config) | ||
| state.copilot = Copilot(M.config.proxy, M.config.allow_insecure) | ||
|
|
||
| state.diff = Diff( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -175,4 +175,10 @@ M.SHOW_CONTEXT = [[ | |
| At the beginning of your response show code outline from all the provided files coming from Context and Active Selection. | ||
| ]] | ||
|
|
||
| ---Prompt for the user to provide a language | ||
| --- @param language string | ||
| function M.PROMPT_ANSWER_LANGUAGE_TEMPLATE(language) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should not be in prompts file anymore. Now its used for populating prompts whn completing automatically so if this isnt part of it it should not be here |
||
| return string.format([[Please answer in %s.]], language) | ||
| end | ||
|
|
||
| return M | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this, add the default config part to default config section (e.g just mirror the change in config.lua)