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

Python 3 async not supported #887

Open
adrienverge opened this issue Apr 28, 2018 · 16 comments
Open

Python 3 async not supported #887

adrienverge opened this issue Apr 28, 2018 · 16 comments

Comments

@adrienverge
Copy link

@adrienverge adrienverge commented Apr 28, 2018

Hello,

Before you ask: I have read the docs and use let g:pymode_python = 'python3' ;-)

async keywords are not recognized, are reported as syntax errors and prevent correct folding. This happens on Fedora, both with Vim and Neovim.

To make sure this was not related to my system or __pycache__ (like reported by @kierun on #845), I reproduced the bug on a fresh virtual machine:

  • Fedora 27 Cloud Base
  • Vim 8 and Neovim 0.2 installed, as well as Python 3
  • ~/.vimrc contents:
    " I removed everything else
    let g:pymode_python = 'python3'
  • python-mode installed basically (but the bug happens with Vundle too):
    mkdir ~/.vim
    git clone --recursive https://github.com/python-mode/python-mode.git
    cd python-mode
    cp -R * ~/.vim
  • Tested on a simple Python file:
    #!/usr/bin/python3
    
    def regular_function():
        # fold me!
        pass
    
    async def async_function():
        # fold me!
        pass
  • Debugging info is attached (:version and vim -i NONE -u ~/.vim/debugvimrc.vim test.py)
  • .ropeproject is created (with config.py globalnames history objectdb inside it)

Result: folding does work for regular functions, but not for async ones. async keywords are reported as syntax errors. It's the same for Vim and Neovim.

capture d ecran de 2018-04-28 22-15-00

Am I doing something wrong?
I'd be glad to provide more info and try anything!

@diraol
Copy link
Contributor

@diraol diraol commented Apr 29, 2018

Hi @adrienverge first of all, thanks for your interest and for the nice report!

We know that we have several issues with the folding function of python-mode. Not only with things being folded or note, but also with performance.

Speaking for myself, I'm not using python-mode folding feature, I've disabled it and I'm using 'Konfekt/FastFold' and 'tmhedberg/SimpylFold' vim plugins to provide this feature.

If you want to help us fixing the problems with our current folding feature, we would gladly accept a PR with such improvement (which is very much needed).

@adrienverge
Copy link
Author

@adrienverge adrienverge commented Apr 29, 2018

Hi Diego,

Thanks for your fast answer, 'Konfekt/FastFold' and 'tmhedberg/SimpylFold' are incredible: they solve my async folding problem, but also other folding issues I had, and now large files load significantly faster!
(But I still use setlocal foldtext=pymode#folding#text() in my .vimrc, I find it nicer.)

I've looked a bit at python-mode folding code, and it looks OK to me (g:pymode_folding_regex contains async\s\+def). I'll give a further look when I have time.

Thanks again! I let choose whether this issue should be closed, or kept as reference for other users experiencing the same.

Adrien

adrienverge added a commit to adrienverge/dotfiles that referenced this issue Apr 29, 2018
Disable python-mode folding and enable it with 'tmhedberg/SimpylFold'
(+ 'Konfekt/FastFold'), which solves the bug (with `async` or classes in
classes), and is much faster.

For reference see the discussion at
python-mode/python-mode#887 (comment)
adrienverge added a commit to adrienverge/dotfiles that referenced this issue Apr 29, 2018
Disable python-mode folding and enable it with 'tmhedberg/SimpylFold'
(+ 'Konfekt/FastFold'), which solves the bug (with `async` or classes in
classes), and is much faster.

For reference see the discussion at
python-mode/python-mode#887 (comment)
@xaviergmail
Copy link

@xaviergmail xaviergmail commented May 26, 2018

It seems completion on self in an async def doesn't work for me. Is anyone else experiencing this?

@stale
Copy link

@stale stale bot commented Oct 23, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the inactive label Oct 23, 2018
@adrienverge
Copy link
Author

@adrienverge adrienverge commented Oct 24, 2018

@Stale the issue is not solved, but let it open so that other users can find it easily.

@stale stale bot removed the inactive label Oct 24, 2018
@stale
Copy link

@stale stale bot commented Mar 23, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the inactive label Mar 23, 2019
@adrienverge
Copy link
Author

@adrienverge adrienverge commented Mar 23, 2019

@Stale the issue is not solved, but let it open so that other users can find it easily.

@stale stale bot removed the inactive label Mar 23, 2019
@stale
Copy link

@stale stale bot commented Aug 20, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the inactive label Aug 20, 2019
@adrienverge
Copy link
Author

@adrienverge adrienverge commented Aug 20, 2019

@Stale here is a comment so that you don't close the issue. It's not solved yet. Please let it open so that other users can find it easily.

@stale stale bot removed the inactive label Aug 20, 2019
@stale
Copy link

@stale stale bot commented Jan 19, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the inactive label Jan 19, 2020
@adrienverge
Copy link
Author

@adrienverge adrienverge commented Jan 19, 2020

@Stale here is a comment so that you don't close the issue. It's not solved yet. Please let it open so that other users can find it easily.

@stale stale bot removed the inactive label Jan 19, 2020
@stale
Copy link

@stale stale bot commented Jun 17, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the inactive label Jun 17, 2020
@adrienverge
Copy link
Author

@adrienverge adrienverge commented Jun 17, 2020

@Stale you are annoying. This issue is not solved and should remain open so that other users can find it easily.

@stale stale bot removed the inactive label Jun 17, 2020
@diraol
Copy link
Contributor

@diraol diraol commented Jun 18, 2020

@adrienverge is this issue really still happening? Have you tried it again with our latest release?

Because for me it seems to be working fine.

I mean, I had to add set foldmethod=indent for it to work, but other than that, or it folds both definitions or none of them.

@adrienverge
Copy link
Author

@adrienverge adrienverge commented Jun 19, 2020

Hi Diego, thanks for the tip, I didn't know about set foldmethod=indent. I confirm this correctly folds async functions, but also if and try blocks, as well as function arguments. So this workaround has a real drawback. All in all I think this issue still exists and should remain open, unless you think this is annoying and we can close.

In the meantime, I still use Konfekt/FastFold and tmhedberg/SimpylFold plugins.

@diraol
Copy link
Contributor

@diraol diraol commented Jun 19, 2020

Hi @adrienverge, nice to know!

To be very honest with you, It will be hard for me to dedicate time to python-mode folding feature. Especially considering that we have FastFold and SimplyFold that do the job very well. And python-mode folding feature is indeed knowingly problematic.

So, I'll let it up to you regarding leaving this issue opened or not. I don't mind. ;)

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

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.