-
-
Notifications
You must be signed in to change notification settings - Fork 102
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
Visual selection #734
Comments
I confirm the issue, chat uses the whole buffer instead of visual selection. These are the mappings i've tried: Default one (according to the docs): vim.keymap.set("v", "<leader>cg", function()
local input = vim.fn.input("Quick Chat: ")
if input ~= "" then
copilot_chat.ask(input)
end
end, { desc = "Copilot Quick Chat" }) Explicit: vim.keymap.set("v", "<leader>cg", function()
local input = vim.fn.input("Quick Chat: ")
if input ~= "" then
copilot_chat.ask(input, {
selection = function(source)
local copilot_chat_select = require("CopilotChat.select")
return copilot_chat_select.visual(source) or copilot_chat_select.buffer(source)
end,
})
end
end, { desc = "Copilot Quick Chat" }) |
This is intentional for simplicity and because in different visual modes the col part of < > marks isnt really set (also AI do not rly likes to play nice when trying to replace stuff in middle of lines). As you can see in your own PR the change is adding pretty annoying complexity with storing the mode as well, I would rather keep this as is as I think grabbing stuff from middle of lines is most of the time not super useful anyway compared to hassle of supporting it. |
I see, I briefly checked the other similar plugin provider they do the similar thing, maybe I have a more niche requirement here as I just wanted the selection to be populated to the context and don't mean to ask AI to replace anything 😝. But instead of |
I have a keymap in visual mode to open the chat, and I need to put the visual selection to the context of the chat.
For example I have this line of text
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
and I highlight thedummy
word and open the chat using the keymap I created earlier.Problem:
The context is the entire line.
Expectation:
I would expect the context of the chat should be
dummy
.The text was updated successfully, but these errors were encountered: