-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE] Allow manual completion via function #149
Comments
i've had a pr waiting over 10 months over at #70 to implement this exact feature! i'd really appreciate your feedback on that pr if you have any |
Glancing over it with my limited lua knowledge, it seems that you went with the alternative suggestion described in my issue. It seems like it should work, although personally I'd rather have the functions exposed by tabnine-vim like described above (or equivalents). Will probably use your fork if no further development is made on this issue. |
the original goal of my pr was to implement it with as small of a diff as possible. if I get a go ahead from @amirbilu, I would also prefer to have separate |
@Guergeiro amir has given his approval for me to go ahead and make these changes! require("tabnine").accept_suggestion() -- return boolean: success (maybe?) else no return - NOTE: no error if no suggestion!
require("tabnine").has_suggestion() -- return boolean - has
require("tabnine").dismiss_suggestion() -- see above for accept_suggestion do you have any feedback on this api? would this work for your use case? |
secondly, do you think it makes more sense to expose these under |
We're already exposing |
The functions provided seem nice. Where should they be namespaced to, is a matter for the maintainers of the package, but from personal opinion, Since this is a neovim plugin, why don't you look into how nvim-cmp does this? |
@Guergeiro nvim-cmp does this: cmp.mapping = require('cmp.config.mapping') which is essentially namespacing it into I think i'll stick with |
I've just finished reading their doc.txt and they have it at top level with I think you are mixing the functions that interact with tabnine with the keybinds that call these functions. The latter would make sense to be namespaced into something like |
Is your feature request related to a problem? Please describe.
When using this plugin, it is recommended that we map the
accept_key
to something that doesn't collide with other plugin mappings. While this works, it would be interesting if we can do a manual complete ourselves by using some kind of provided function. Generally, autocomplete engines provide ways of doing this (asyncomple.vim, ddc.vim, ncm2, CoC, nvim-cmp etc).Describe the solution you'd like
I'm going to type vimscript since I don't know how to do it in lua in neovim (migrating atm):
Describe alternatives you've considered
The only alternative I've considered is having some function as
accept_key
that we can have logic attached to it that decides whether or not we want to return a valid keybind or justnil
.Additional context
Although this plugin doesn't serve as a autocomplete plugin, it very much has autocomplete functionality. Having an API that allows us to inspect the results of this plugin could even benefit other users of it; cmp-tabnine comes to mind.
The text was updated successfully, but these errors were encountered: