sourcegraph / cody

AI that knows your entire codebase
https://cody.dev
Apache License 2.0
2.25k stars 215 forks source link

Edit: Document code doesn't follow the correct selectionRange #4628

Open umpox opened 2 weeks ago

umpox commented 2 weeks ago

Version

Latest main

Describe the bug

Document code uses task.selectionRange, but we only ask the LLM to produce documentation, not the code within the range.

This has some benefits:

But we introduce some problems with this method:

Expected behavior

We need some range to provide to the LLM, we should propose a way for a task to have a separate contextRange (or similar) to the selectionRange.

For document code, this means we could have asmall selection range (empty at first) that grows as the documentation is added. This will mean that decorations, retry behaviour and anything else should just work as normal. We can still use contextRange to provide the correct code (that we want documented) to the LLM.

Additional context

No response