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/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/doc/CopilotChat.txt b/doc/CopilotChat.txt index 02304af7..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 04 +*CopilotChat.txt* For NVIM v0.8.0 Last change: 2025 April 09 ============================================================================== Table of Contents *CopilotChat-table-of-contents* @@ -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 = { diff --git a/lua/CopilotChat/config.lua b/lua/CopilotChat/config.lua index d1ea254a..dc1af205 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? @@ -60,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. @@ -71,10 +72,10 @@ 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) - end, + selection = select.visual, -- default window options window = { 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 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 }) 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