tweekmonster / django-plus.vim

:guitar: Improvements to the handling of Django related files in Vim
MIT License
179 stars 15 forks source link

Can't use template completions from inside views.py #5

Open aleprovencio opened 8 years ago

aleprovencio commented 8 years ago

Although I'm able to use these completions from the templates themselves using {% extends %} I don't get any when using render(), get_template() and friends.

tweekmonster commented 8 years ago

Those patterns require you to start a string, like get_template('. The pattern for render() expects the completions to start at the second argument: render(request, '.

If you are doing that and it's still not working, I'll need more info such as what plugin you're using for completions or if the file has b:is_python set, etc.

aleprovencio commented 8 years ago

That's exactly what I'm trying, I'm using YouCompleteMe and b:is_python is not set. Please tell me if you need more info.

tweekmonster commented 8 years ago

b:is_python is not set

Well, that's your problem. Do you why it isn't being set? If you manually set b:is_django to 1 do the completions work?

aleprovencio commented 8 years ago

b:is_django actually does get set, b:is_python is the one which doesn't.

tweekmonster commented 8 years ago

Oh, sorry that was a typo. I meant b:is_django the first time. What does echo &omnifunc show?

tweekmonster commented 8 years ago

I haven't used YCM in a long time, but from what I remember, it might be that it's not picking up the omnifunc set by this plugin and I don't think there's anything I can do about it without digging into YCM's docs or sources, which I'm not keen on doing.

One last thing you can try if &omnifunc shows djangoplus#complete is moving the cursor to where you expect completions to be and press ^X^O to see if that manually triggers Vim's completion.

aleprovencio commented 8 years ago

&omnifunc shows youcompleteme#OmniComplete...

tweekmonster commented 8 years ago

Yeah, so what I said above. django-plus uses after/ftplugin/python.vim since that is the best time to capture an existing omnifunc to act as a pass-through. If omnifunc is set to YMC's, that means it overrode it after django-plus did.

I abandoned YCM a long time ago because of how involving the setup is. So, I personally don't want to look into making this compatible with YCM. If you can figure out how to fix this, I'd be more than happy to accept a PR, though.

aleprovencio commented 8 years ago

I see... I don't think I can tackle that now also, but thanks!