From 3228edc02014c7240ff122aa4a94a4dff1215be1 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Mon, 7 Apr 2025 08:32:17 +0200 Subject: [PATCH 1/9] refactor: do not require chat on plugin load Signed-off-by: Tomas Slusny --- plugin/CopilotChat.lua | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/plugin/CopilotChat.lua b/plugin/CopilotChat.lua index 9b4639df..5674d6bc 100644 --- a/plugin/CopilotChat.lua +++ b/plugin/CopilotChat.lua @@ -8,8 +8,6 @@ if vim.fn.has('nvim-' .. min_version) ~= 1 then return end -local chat = require('CopilotChat') - -- Setup highlights vim.api.nvim_set_hl(0, 'CopilotChatStatus', { link = 'DiagnosticHint', default = true }) vim.api.nvim_set_hl(0, 'CopilotChatHelp', { link = 'DiagnosticInfo', default = true }) @@ -21,6 +19,7 @@ vim.api.nvim_set_hl(0, 'CopilotChatSeparator', { link = '@punctuation.special.ma -- Setup commands vim.api.nvim_create_user_command('CopilotChat', function(args) + local chat = require('CopilotChat') local input = args.args if input and vim.trim(input) ~= '' then chat.ask(input) @@ -33,31 +32,40 @@ end, { range = true, }) vim.api.nvim_create_user_command('CopilotChatPrompts', function() + local chat = require('CopilotChat') chat.select_prompt() end, { force = true, range = true }) vim.api.nvim_create_user_command('CopilotChatModels', function() + local chat = require('CopilotChat') chat.select_model() end, { force = true }) vim.api.nvim_create_user_command('CopilotChatAgents', function() + local chat = require('CopilotChat') chat.select_agent() end, { force = true }) vim.api.nvim_create_user_command('CopilotChatOpen', function() + local chat = require('CopilotChat') chat.open() end, { force = true }) vim.api.nvim_create_user_command('CopilotChatClose', function() + local chat = require('CopilotChat') chat.close() end, { force = true }) vim.api.nvim_create_user_command('CopilotChatToggle', function() + local chat = require('CopilotChat') chat.toggle() end, { force = true }) vim.api.nvim_create_user_command('CopilotChatStop', function() + local chat = require('CopilotChat') chat.stop() end, { force = true }) vim.api.nvim_create_user_command('CopilotChatReset', function() + local chat = require('CopilotChat') chat.reset() end, { force = true }) local function complete_load() + local chat = require('CopilotChat') local options = vim.tbl_map(function(file) return vim.fn.fnamemodify(file, ':t:r') end, vim.fn.glob(chat.config.history_path .. '/*', true, true)) @@ -69,9 +77,11 @@ local function complete_load() return options end vim.api.nvim_create_user_command('CopilotChatSave', function(args) + local chat = require('CopilotChat') chat.save(args.args) end, { nargs = '*', force = true, complete = complete_load }) vim.api.nvim_create_user_command('CopilotChatLoad', function(args) + local chat = require('CopilotChat') chat.load(args.args) end, { nargs = '*', force = true, complete = complete_load }) From 16f041ecc954975416b1e33f8ca2e1df2b86a625 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 7 Apr 2025 06:33:12 +0000 Subject: [PATCH 2/9] chore(doc): auto generate docs --- doc/CopilotChat.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/CopilotChat.txt b/doc/CopilotChat.txt index 02304af7..d3b53a82 100644 --- a/doc/CopilotChat.txt +++ b/doc/CopilotChat.txt @@ -1,4 +1,4 @@ -*CopilotChat.txt* For NVIM v0.8.0 Last change: 2025 April 04 +*CopilotChat.txt* For NVIM v0.8.0 Last change: 2025 April 07 ============================================================================== Table of Contents *CopilotChat-table-of-contents* From 14c78d24e1db88384dc878e870665c3a7ad61a3a Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Tue, 8 Apr 2025 08:29:37 +0200 Subject: [PATCH 3/9] feat: add option to disable contexts in prompts Adds a new configuration option `include_contexts_in_prompt` that allows users to control whether context descriptions should be included when building the prompt for Copilot Chat. This is useful for cases where users want to reduce prompt size or customize how context information is presented to the AI. The option defaults to true to maintain backward compatibility. --- lua/CopilotChat/config.lua | 3 +++ lua/CopilotChat/init.lua | 8 +++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lua/CopilotChat/config.lua b/lua/CopilotChat/config.lua index d1ea254a..df64bf0f 100644 --- a/lua/CopilotChat/config.lua +++ b/lua/CopilotChat/config.lua @@ -25,6 +25,7 @@ local select = require('CopilotChat.select') ---@field stream nil|fun(chunk: string, source: CopilotChat.source):string ---@field callback nil|fun(response: string, source: CopilotChat.source):string ---@field remember_as_sticky boolean? +---@field include_contexts_in_prompt boolean? ---@field selection false|nil|fun(source: CopilotChat.source):CopilotChat.select.selection? ---@field window CopilotChat.config.window? ---@field show_help boolean? @@ -71,6 +72,8 @@ return { callback = nil, -- Function called when full response is received (retuned string is stored to history) remember_as_sticky = true, -- Remember model/agent/context as sticky prompts when asking questions + include_contexts_in_prompt = true, -- Include contexts in prompt + -- default selection selection = function(source) return select.visual(source) or select.buffer(source) diff --git a/lua/CopilotChat/init.lua b/lua/CopilotChat/init.lua index f173fd87..1062e1a4 100644 --- a/lua/CopilotChat/init.lua +++ b/lua/CopilotChat/init.lua @@ -850,9 +850,11 @@ function M.ask(prompt, config) -- Resolve context name and description local contexts = {} - for name, context in pairs(M.config.contexts) do - if context.description then - contexts[name] = context.description + if config.include_contexts_in_prompt then + for name, context in pairs(M.config.contexts) do + if context.description then + contexts[name] = context.description + end end end From 2b5c81f688a92a1d24fd03271e6810ced45ede52 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 8 Apr 2025 06:30:37 +0000 Subject: [PATCH 4/9] chore(doc): auto generate docs --- doc/CopilotChat.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/CopilotChat.txt b/doc/CopilotChat.txt index d3b53a82..11e4f6c5 100644 --- a/doc/CopilotChat.txt +++ b/doc/CopilotChat.txt @@ -1,4 +1,4 @@ -*CopilotChat.txt* For NVIM v0.8.0 Last change: 2025 April 07 +*CopilotChat.txt* For NVIM v0.8.0 Last change: 2025 April 08 ============================================================================== Table of Contents *CopilotChat-table-of-contents* From a63031fc706d4e34e118c46339ae2b5681fab21e Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Tue, 8 Apr 2025 22:18:12 +0200 Subject: [PATCH 5/9] feat: change default selection to visual only this is a bit more controllable than visual || buffer + add mention in README at start Closes #1103 Signed-off-by: Tomas Slusny --- README.md | 8 +++----- lua/CopilotChat/config.lua | 4 +--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 566d0371..422e634f 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ CopilotChat.nvim is a Neovim plugin that brings GitHub Copilot Chat capabilities - 🤖 GitHub Copilot Chat integration with official model and agent support (GPT-4o, Claude 3.7 Sonnet, Gemini 2.0 Flash, and more) - 💻 Rich workspace context powered by smart embeddings system -- 🔒 Explicit context sharing - only sends what you specifically request, either as context or selection +- 🔒 Explicit context sharing - only sends what you specifically request, either as context or selection (by default visual selection) - 🔌 Modular provider architecture supporting both official and custom LLM backends (Ollama, LM Studio, Mistral.ai and more) - 📝 Interactive chat UI with completion, diffs and quickfix integration - 🎯 Powerful prompt system with composable templates and sticky prompts @@ -387,7 +387,7 @@ You can set a default selection in the configuration: ```lua { - -- Default uses visual selection or falls back to buffer + -- Uses visual selection or falls back to buffer selection = function(source) return select.visual(source) or select.buffer(source) end @@ -466,9 +466,7 @@ Below are all available configuration options with their default values: -- default selection -- see select.lua for implementation - selection = function(source) - return select.visual(source) or select.buffer(source) - end, + selection = select.visual, -- default window options window = { diff --git a/lua/CopilotChat/config.lua b/lua/CopilotChat/config.lua index df64bf0f..d3ce3da9 100644 --- a/lua/CopilotChat/config.lua +++ b/lua/CopilotChat/config.lua @@ -75,9 +75,7 @@ return { include_contexts_in_prompt = true, -- Include contexts in prompt -- default selection - selection = function(source) - return select.visual(source) or select.buffer(source) - end, + selection = select.visual, -- default window options window = { From 44fde5a5b14a06f6639e9b98d87fc1a87bf2ab5d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 8 Apr 2025 20:20:48 +0000 Subject: [PATCH 6/9] chore(doc): auto generate docs --- doc/CopilotChat.txt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/doc/CopilotChat.txt b/doc/CopilotChat.txt index 11e4f6c5..853a5055 100644 --- a/doc/CopilotChat.txt +++ b/doc/CopilotChat.txt @@ -38,7 +38,7 @@ capabilities directly into your editor. It provides: - 🤖 GitHub Copilot Chat integration with official model and agent support (GPT-4o, Claude 3.7 Sonnet, Gemini 2.0 Flash, and more) - 💻 Rich workspace context powered by smart embeddings system -- 🔒 Explicit context sharing - only sends what you specifically request, either as context or selection +- 🔒 Explicit context sharing - only sends what you specifically request, either as context or selection (by default visual selection) - 🔌 Modular provider architecture supporting both official and custom LLM backends (Ollama, LM Studio, Mistral.ai and more) - 📝 Interactive chat UI with completion, diffs and quickfix integration - 🎯 Powerful prompt system with composable templates and sticky prompts @@ -437,7 +437,7 @@ You can set a default selection in the configuration: >lua { - -- Default uses visual selection or falls back to buffer + -- Uses visual selection or falls back to buffer selection = function(source) return select.visual(source) or select.buffer(source) end @@ -525,9 +525,7 @@ Below are all available configuration options with their default values: -- default selection -- see select.lua for implementation - selection = function(source) - return select.visual(source) or select.buffer(source) - end, + selection = select.visual, -- default window options window = { From 381d5cddd25abec595c3c611e96cae2ba61d7ea5 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Wed, 9 Apr 2025 08:54:30 +0200 Subject: [PATCH 7/9] fix: set default model to gpt-4o again they removed the versioned ones again and put back gpt-4o Closes #1105 Signed-off-by: Tomas Slusny --- lua/CopilotChat/config.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/CopilotChat/config.lua b/lua/CopilotChat/config.lua index d3ce3da9..dc1af205 100644 --- a/lua/CopilotChat/config.lua +++ b/lua/CopilotChat/config.lua @@ -61,7 +61,7 @@ return { system_prompt = 'COPILOT_INSTRUCTIONS', -- System prompt to use (can be specified manually in prompt via /). - model = 'gpt-4o-2024-11-20', -- Default model to use, see ':CopilotChatModels' for available models (can be specified manually in prompt via $). + model = 'gpt-4o', -- Default model to use, see ':CopilotChatModels' for available models (can be specified manually in prompt via $). agent = 'none', -- Default agent to use, see ':CopilotChatAgents' for available agents (can be specified manually in prompt via @). context = nil, -- Default context or array of contexts to use (can be specified manually in prompt via #). sticky = nil, -- Default sticky prompt or array of sticky prompts to use at start of every new chat. From bc8d12014fd4da1426093588d1b98654221a9cc5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 9 Apr 2025 06:59:02 +0000 Subject: [PATCH 8/9] chore(doc): auto generate docs --- doc/CopilotChat.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/CopilotChat.txt b/doc/CopilotChat.txt index 853a5055..13ce6f83 100644 --- a/doc/CopilotChat.txt +++ b/doc/CopilotChat.txt @@ -1,4 +1,4 @@ -*CopilotChat.txt* For NVIM v0.8.0 Last change: 2025 April 08 +*CopilotChat.txt* For NVIM v0.8.0 Last change: 2025 April 09 ============================================================================== Table of Contents *CopilotChat-table-of-contents* From a89f5f1162b04a0962e5f4c3cdf248a81e7e53cb Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 9 Apr 2025 15:25:03 +0800 Subject: [PATCH 9/9] chore(main): release 3.11.0 (#1102) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 13 +++++++++++++ version.txt | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aa7c2751..a5de69ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## [3.11.0](https://github.com/CopilotC-Nvim/CopilotChat.nvim/compare/v3.10.1...v3.11.0) (2025-04-09) + + +### Features + +* add option to disable contexts in prompts ([14c78d2](https://github.com/CopilotC-Nvim/CopilotChat.nvim/commit/14c78d24e1db88384dc878e870665c3a7ad61a3a)) +* change default selection to visual only ([a63031f](https://github.com/CopilotC-Nvim/CopilotChat.nvim/commit/a63031fc706d4e34e118c46339ae2b5681fab21e)), closes [#1103](https://github.com/CopilotC-Nvim/CopilotChat.nvim/issues/1103) + + +### Bug Fixes + +* set default model to gpt-4o again ([381d5cd](https://github.com/CopilotC-Nvim/CopilotChat.nvim/commit/381d5cddd25abec595c3c611e96cae2ba61d7ea5)), closes [#1105](https://github.com/CopilotC-Nvim/CopilotChat.nvim/issues/1105) + ## [3.10.1](https://github.com/CopilotC-Nvim/CopilotChat.nvim/compare/v3.10.0...v3.10.1) (2025-04-04) diff --git a/version.txt b/version.txt index f870be23..afad8186 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -3.10.1 +3.11.0