Skip to content
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

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

Open
aleprovencio opened this issue Jul 25, 2016 · 9 comments
Open

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

aleprovencio opened this issue Jul 25, 2016 · 9 comments

Comments

@aleprovencio
Copy link

aleprovencio commented Jul 25, 2016

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
Copy link
Owner

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
Copy link
Author

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
Copy link
Owner

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
Copy link
Author

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

@tweekmonster
Copy link
Owner

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

@tweekmonster
Copy link
Owner

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
Copy link
Author

aleprovencio commented Jul 26, 2016

&omnifunc shows youcompleteme#OmniComplete...

@tweekmonster
Copy link
Owner

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants