maralla / completor.vim

Async completion framework made ease.
MIT License
1.31k stars 62 forks source link

Omni Trigger for Javascript #143

Open amadeus opened 6 years ago

amadeus commented 6 years ago

So I have omni completion setup for Javascript via Flow, and I'd prefer to not use the built in Tern system.

I am trying to setup an omni trigger for javascript like so:

let g:completor_javascript_omni_trigger = "\w+$|[\w\\)\]\}\'\"]+\.\w*$"

This is based on the built in trigger for Tern, however it doesn't appear to work. I still have to press <c-x><c-o> to bring up omni completions.

As a side note, I am also using filetypes of javascript.jsx, not sure if this has any affect.

maralla commented 6 years ago

Updating to the latest commit and setting the following trigger may fix the problem:

let g:completor_javascript_omni_trigger = "\\w+$|[\\w\\)\\]\\}\'\"]+\\.\\w*$"
amadeus commented 6 years ago

This seems to work well, thanks!

The only other thing I've found though, is that getting the omnicomplete results locks up the UI for a few milliseconds. Is this just a limitation in Vim? Or is there a way that Completor could return the omnicomplete results asynchronously?

maralla commented 6 years ago

Currently the omnicomplete results are computed using the current vim instance synchronously. And right now I can't find a proper way to do this asynchronously. So maybe it's better to implement the completer using other language and running the completer in a different process asynchronously.

amadeus commented 6 years ago

Ahh yeah, make sense. Personally I would really like Flow support, however I did try taking a stab at it a while back, but I was never able to get it to work quite right.