tabnine-sublime icon indicating copy to clipboard operation
tabnine-sublime copied to clipboard

Enhancement: close half-open braces, use the snippet system to smartly place the point

Open Lucretiel opened this issue 7 years ago • 2 comments

Suppose I'm creating a new rust struct, with some derive attributes at the top. I type:

#

And TabNine suggests [derive(Clone, .

This is a good suggestion, but I'm very much used to my editor automatically closing my braces. What I'm suggesting, therefore, is that the following flow occur (█ indicates the suggestion/location of the point; I'm not sure how to indicate this in the UI. Perhaps a highlighted character?)

  • TabNine suggests [derive(Clone, █)]
  • I accept the suggestion. My text buffer is now:
#[derive(Clone, █)]
  • I have the ability to add more attributes, aided by TabNine.
  • The next time I hit <tab>, outside of a completion context, it advances the point outside the next brace. It does this continuously until I'm fully outside the braces:
// <tab>
#[derive(Clone, Default)█]

// <tab>
#[derive(Clone, Default)]█

This can probably be implemented "dumbly", that is, it can use simple syntax analysis that examines the output of TabNine's suggestion, and simply closes all detected half-open braces.

Lucretiel avatar Nov 05 '18 23:11 Lucretiel

Closing of half-open braces has been added. Snippet support is still pending. (Supporting the workflow you describe requires a rethinking of the current interface, since pressing tab after a completion currently selects the next completion.)

zxqfl avatar Nov 24 '18 19:11 zxqfl

Yeah, I was thinking about that, too. You'd have to do some extra typing to get out of the tabnine context. Still, glad to hear that brace closing works!

On Sat, Nov 24, 2018, 2:50 PM Jacob Jackson <[email protected] wrote:

Closing of half-open braces has been added. Snippet support is still pending. (Supporting the workflow you describe requires a rethinking of the current interface, since pressing tab after a completion currently selects the next completion.)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/zxqfl/tabnine-sublime/issues/3#issuecomment-441391470, or mute the thread https://github.com/notifications/unsubscribe-auth/ABvSraLmh4jSkq19NSF1jKDGC_-p3pD4ks5uyaLngaJpZM4YPdhK .

Lucretiel avatar Nov 24 '18 19:11 Lucretiel