feat: cursor planning mode enabled by default (#1316)
This commit is contained in:
@@ -255,11 +255,12 @@ _See [config.lua#L9](./lua/avante/config.lua) for the full config_
|
|||||||
```lua
|
```lua
|
||||||
{
|
{
|
||||||
---@alias Provider "claude" | "openai" | "azure" | "gemini" | "cohere" | "copilot" | string
|
---@alias Provider "claude" | "openai" | "azure" | "gemini" | "cohere" | "copilot" | string
|
||||||
provider = "claude", -- Recommend using Claude
|
provider = "claude", -- The provider used in Aider mode or in the planning phase of Cursor Planning Mode
|
||||||
-- WARNING: Since auto-suggestions are a high-frequency operation and therefore expensive,
|
-- WARNING: Since auto-suggestions are a high-frequency operation and therefore expensive,
|
||||||
-- currently designating it as `copilot` provider is dangerous because: https://github.com/yetone/avante.nvim/issues/1048
|
-- currently designating it as `copilot` provider is dangerous because: https://github.com/yetone/avante.nvim/issues/1048
|
||||||
-- Of course, you can reduce the request frequency by increasing `suggestion.debounce`.
|
-- Of course, you can reduce the request frequency by increasing `suggestion.debounce`.
|
||||||
auto_suggestions_provider = "claude",
|
auto_suggestions_provider = "claude",
|
||||||
|
cursor_applying_provider = nil, -- The provider used in the applying phase of Cursor Planning Mode, defaults to nil, when nil uses Config.provider as the provider for the applying phase
|
||||||
claude = {
|
claude = {
|
||||||
endpoint = "https://api.anthropic.com",
|
endpoint = "https://api.anthropic.com",
|
||||||
model = "claude-3-5-sonnet-20241022",
|
model = "claude-3-5-sonnet-20241022",
|
||||||
@@ -290,6 +291,7 @@ _See [config.lua#L9](./lua/avante/config.lua) for the full config_
|
|||||||
support_paste_from_clipboard = false,
|
support_paste_from_clipboard = false,
|
||||||
minimize_diff = true, -- Whether to remove unchanged lines when applying a code block
|
minimize_diff = true, -- Whether to remove unchanged lines when applying a code block
|
||||||
enable_token_counting = true, -- Whether to enable token counting. Default to true.
|
enable_token_counting = true, -- Whether to enable token counting. Default to true.
|
||||||
|
enable_cursor_planning_mode = true, -- Whether to enable Cursor Planning Mode. Default to true.
|
||||||
},
|
},
|
||||||
mappings = {
|
mappings = {
|
||||||
--- @class AvanteConflictMappings
|
--- @class AvanteConflictMappings
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ local M = {}
|
|||||||
M._defaults = {
|
M._defaults = {
|
||||||
debug = false,
|
debug = false,
|
||||||
---@alias Provider "claude" | "openai" | "azure" | "gemini" | "vertex" | "cohere" | "copilot" | string
|
---@alias Provider "claude" | "openai" | "azure" | "gemini" | "vertex" | "cohere" | "copilot" | string
|
||||||
provider = "claude", -- Only recommend using Claude
|
provider = "claude",
|
||||||
-- WARNING: Since auto-suggestions are a high-frequency operation and therefore expensive,
|
-- WARNING: Since auto-suggestions are a high-frequency operation and therefore expensive,
|
||||||
-- currently designating it as `copilot` provider is dangerous because: https://github.com/yetone/avante.nvim/issues/1048
|
-- currently designating it as `copilot` provider is dangerous because: https://github.com/yetone/avante.nvim/issues/1048
|
||||||
-- Of course, you can reduce the request frequency by increasing `suggestion.debounce`.
|
-- Of course, you can reduce the request frequency by increasing `suggestion.debounce`.
|
||||||
@@ -253,7 +253,7 @@ M._defaults = {
|
|||||||
support_paste_from_clipboard = false,
|
support_paste_from_clipboard = false,
|
||||||
minimize_diff = true,
|
minimize_diff = true,
|
||||||
enable_token_counting = true,
|
enable_token_counting = true,
|
||||||
enable_cursor_planning_mode = false,
|
enable_cursor_planning_mode = true,
|
||||||
},
|
},
|
||||||
history = {
|
history = {
|
||||||
max_tokens = 4096,
|
max_tokens = 4096,
|
||||||
|
|||||||
@@ -371,8 +371,9 @@ M.setup = function()
|
|||||||
E.setup({ provider = auto_suggestions_provider })
|
E.setup({ provider = auto_suggestions_provider })
|
||||||
end
|
end
|
||||||
|
|
||||||
if Config.cursor_applying_provider then
|
if Config.behaviour.enable_cursor_planning_mode then
|
||||||
local cursor_applying_provider = M[Config.cursor_applying_provider]
|
local cursor_applying_provider_name = Config.cursor_applying_provider or Config.provider
|
||||||
|
local cursor_applying_provider = M[cursor_applying_provider_name]
|
||||||
if cursor_applying_provider and cursor_applying_provider ~= provider then
|
if cursor_applying_provider and cursor_applying_provider ~= provider then
|
||||||
E.setup({ provider = cursor_applying_provider })
|
E.setup({ provider = cursor_applying_provider })
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -884,9 +884,11 @@ function Sidebar:apply(current_cursor)
|
|||||||
local original_code = table.concat(original_code_lines, "\n")
|
local original_code = table.concat(original_code_lines, "\n")
|
||||||
local resp_content = ""
|
local resp_content = ""
|
||||||
local filetype = Utils.get_filetype(filepath)
|
local filetype = Utils.get_filetype(filepath)
|
||||||
local cursor_applying_provider = Provider[Config.cursor_applying_provider]
|
local cursor_applying_provider_name = Config.cursor_applying_provider or Config.provider
|
||||||
|
Utils.debug(string.format("Use %s for cursor applying", cursor_applying_provider_name))
|
||||||
|
local cursor_applying_provider = Provider[cursor_applying_provider_name]
|
||||||
if not cursor_applying_provider then
|
if not cursor_applying_provider then
|
||||||
Utils.error("Failed to find cursor_applying_provider provider: " .. Config.cursor_applying_provider, {
|
Utils.error("Failed to find cursor_applying_provider provider: " .. cursor_applying_provider_name, {
|
||||||
once = true,
|
once = true,
|
||||||
title = "Avante",
|
title = "Avante",
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user