sourcegraph / cody

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

Add trigger to overwrite multiline decision #4739

Open eseliger opened 3 days ago

eseliger commented 3 days ago

When to use multiline completions is currently determined by some heuristic. It excludes certain languages, and at least for me, doesn't 100% get things right. That's okay, we can improve this over time. But until we have a very reliable decision process for single vs multiline, it can be helpful to be able to trigger cody to always try to generate a multiline completion at a certain location. That will also enable multiline completions for language currently not on the allow-list for auto-multiline (probably due to CAR concerns).

After this PR:

Option+\ will trigger any completion, with the detection on. Option+Shift+\ will trigger a multiline completion always.

Test plan

Tried generating multiline completions several times locally. There seems to be some bug in multiline in general that sometimes cuts off the completion too early, but that shouldn't prevent this change.

valerybugakov commented 2 days ago

There seems to be some bug in multiline in general that sometimes cuts off the completion too early, but that shouldn't prevent this change

It's probably not a bug but a stopSequence we use to stop generation which is \n\n. We must keep it for now because the cancellation propagation does not work reliably. We will overload our inference providers if we remove it today.