backseat.nvim
backseat.nvim copied to clipboard
feature: `BackseatAsk` range
Currently, to ask a question in regards to a specific line or couple of lines in the file you must address it verbally.
For example, if you want to ask a question about a variable X in a stretch of code, you must ask something along the lines of "what is the purpose of variable X in the for loop following it?".
It would be very nice if you could, say, visually select the line(s) using the variable, and ask "what is the purpose of variable X here?", and the selected line range be sent on the request as additional context for the question.
This could open the door to ask a lot of very directed questions, allowing for a very specific response to a specific part of the code selected.
This would also alleviate the problem of long files exceeding the max token limit for models on BackseatAsk. I'd also add the ability to say "Rewrite this using a linked list instead of an array" for visual selections
I feel like sending the surrounding context for the code might still be a good idea in some scenarios where it is important/useful for the answer (perhaps have it be a toggleable option in the underlying lua function call?).
In those cases, it might be a good idea to send the full context and just sent the relevant line numbers (e.g. "<full surrounding context, perhaps the whole file if possible>. Target lines: 14-20").
That would allow for something like:
- <Visually select
forloop> :BackseatAsk Rewrite this using a functional idiom (using rust iterators)- <The model gets the full context, understands the purpose of the loop within the function, the variables available, and returns the rewritten loop as a chain of iterators>