Smarter/fuzzy omnicompletion
Closed this issue · 7 comments
It would be great to support a fuzzy omnicompletion, in the likes of FlashDevelop's.
I've tried implementing myself, but I'm not too acquainted with how vim omnicompletion works. I've modified vaxe.py
to include the following line, at line 13:
base = re.sub(r'', '\\w*', base)
This gave me a smarter omnicompletion when there was already some base text entered. Would it be possible to make it work on all cases?
Also, sorting them based on camelCase detection would be fantastic!
Thanks for your work! Vaxe is great!
Hi Caue, glad you like the plugin!
I'm not sure if camel-case completion helps too much for simple field completion, I rarely use capitalization there.
I should be able to do something for top-level completion, although I'm not sure if/when that is available.
I think some sort of subsequence matching should help, and probably would be useful in cases with a lot of fields, like html5 typedefs.
I suppose the other thing I want to know is... am I missing out on providing anything else? You probably know more about the compiler internals, workflows, and special needs of the different targets. I think I have a decent level of NME support for now, but I have no ideas about Java, etc. because I'm not using as much (as I had hoped to). Thanks!
Hey Justin! I'm also not sure if it is possible to do a better omnicompletion, as I'm not too sure how it filters the results after haxe was called. I hope there's a way to do it
About special needs of the different targets, I think all the basic tools are there! Your plugin is very good, and has made me switch to vim once and for all ;)
If I think of something, I'll open an issue for it!
Thanks!
Caue,
Vim has a special "omnifunc" that is triggered with ctrl-x, ctrl-o. you can see more details with :h omnifunc.
The vaxe specific omnifunc implementation is here:
Line 153 in d769851
That function basically just manages the signature and simple functionality required for an omnifunc. It calls more sophisticated "DisplayCompletion" which will create a special dictionary object with the right format for vim. DisplayCompletion in turn calls a python-specific helper that helps parse and rearrange the xml from the completion request. If you want to modify the actual completion results, it's probably best to do it in the python function. I'll try to do a fuzzy completion example to give you an idea of how it looks.
P.s., the python helper is here:
https://github.com/jdonaldson/vaxe/blob/master/autoload/vaxe.py
You might also try the YouCompleteMe autocompleter, which does this sort of thing by default. I think it's worth the hassle: http://valloric.github.io/YouCompleteMe/
closing this out, it's gotten stale.