Pierrad / obsidian-github-copilot

A bridge between Obsidian and Github Copilot
Apache License 2.0
155 stars 10 forks source link

Partial suggestion Acceptance similar to VS-Code #19

Closed timo-x30xe closed 5 months ago

timo-x30xe commented 5 months ago

Is your feature request related to a problem? Please describe. Often, the beginning of a Copilot suggestion is exactly what I want, but it continues too long (writing a whole paragraph) or goes off into an unwanted direction later on. Currently, there is only an "All or Nothing" acceptance option.

Describe the solution you'd like An option to accept suggestions word by word, similar to VS Code's Ctrl+RightArrow keybind, which allows you to accept parts of the suggestion without triggering a whole new generation. See the GIF below for an example: Example single word acceptance

Describe alternatives you've considered The current alternative is to accept everything and delete the unwanted parts afterward.

I also tried coding a hacky solution where I split the suggestion string by spaces and accept only the first element of the list using a shortcut. However, this caused a new suggestion generation each time, resulting in wait times and the possibility of changing the prediction.

Pierrad commented 5 months ago

Hi @timo-x30xe,

Thanks for using the plugin!

In fact, I didn't know about this keybind in VSCode as for me Ctrl-ArrowRight is mapped to switch desktop window in my environment but it's very useful for long suggestion indeed.

I've implemented the feature and it's available in the v1.0.6. You can configure the keybind in the settings.

Let me know if it fits you need!

timo-x30xe commented 5 months ago

Working as expected! Thank you