twinnydotdev / twinny

The most no-nonsense, locally or API-hosted AI code completion plugin for Visual Studio Code - like GitHub Copilot but completely free and 100% private.
https://twinny.dev
MIT License
2.3k stars 126 forks source link

Multiline completion is confusing #243

Closed yshui closed 2 months ago

yshui commented 2 months ago

It is very unclear when a multiline completion triggers. I have the multiline completion option enabled, but I can only get single line completions. In console, I saw:

Streaming response end due to multiline not required

Which I assume is because this condition is not true?

https://github.com/rjmacarthy/twinny/blob/830c4a904d74f5a9b657f4b4d309ba8bca28fda8/src/extension/providers/completion.ts#L270

Which leads me to:

https://github.com/rjmacarthy/twinny/blob/830c4a904d74f5a9b657f4b4d309ba8bca28fda8/src/extension/utils.ts#L284

and

https://github.com/rjmacarthy/twinny/blob/830c4a904d74f5a9b657f4b4d309ba8bca28fda8/src/common/constants.ts#L259

This list seems to be very language specific?

rjmacarthy commented 2 months ago

Hello, thanks for the issue, you're correct! The multi-line completion feature is actually experimental. However, it's not language specific since it tries uses tree-sitter to detect when the best time to make a completion is, to be honest I did not spend that much time and effort to make it reliable because I don't have it 😄 . Feel free to make a pull request which improves it if you so wish.

Many thanks and all the best!