sourcegraph / cody

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

debounce selection determination to reduce CPU load #4627

Closed sqs closed 2 weeks ago

sqs commented 2 weeks ago

Previously, it only debounced the postMessage. Now it debounces the entire operation to get the right selection context. I still see it called 2x for a cursor move (empty selection) and 4x for a non-empty selection due to VS Code calling the event handler multiple times for some reason, but this is a big improvement over before.

Fixes https://linear.app/sourcegraph/issue/CODY-2481/debounce-or-throttle-commandscontextselection-file-calls-to-prevent

Test plan

Try selections and see how many OT spans get sent (and use logpoints).