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

Wrong python folding with tree-sitter #16959

Closed
gliviu opened this Issue Mar 16, 2018 · 10 comments

Comments

Projects
None yet
3 participants
@gliviu

gliviu commented Mar 16, 2018

Prerequisites

Description

Folding python code is not working properly when tree-sitter is activated. See case below.

Steps to Reproduce

  1. Set core.useTreeSitterParsers: false in config.cson and restart Atom
  2. Create new python file with this content
for cl in reversed(range(1, len(layers))):
    pl = cl-1
    nl = cl+1
  1. Fold the first line

Expected behavior:
image

Actual behavior:
image

Reproduces how often:
Always

Versions

apm 1.19.0
npm 3.10.10
node 6.9.5 x64
atom 1.25.0
python 2.7.14
git 2.16.1.windows.1
visual studio 2015
Windows 10

Additional Information

Any additional information, configuration or data that might be necessary to reproduce the issue.

@maxbrunsfeld

This comment has been minimized.

Contributor

maxbrunsfeld commented Mar 16, 2018

Thanks for the report! It looks like CRLF line endings are causing some pretty bad problems for the python parser. Fixing this now.

@maxbrunsfeld

This comment has been minimized.

Contributor

maxbrunsfeld commented Mar 16, 2018

This will be fixed in Atom 1.25.1.

@Arcanemagus

This comment has been minimized.

Contributor

Arcanemagus commented Mar 16, 2018

I'm unable to reproduce this in the version listed, or v1.26.0-beta0:
2018-03-16_12-27-52

Your description mentions using Tree Sitter parsers, but your steps to reproduce explicitly disable those, regardless as you can see above I tested both modes with the same result.

Can you try reproducing this in safe mode? If you can, please file an issue over on language-python so we can track this down further, thanks!

@Arcanemagus

This comment has been minimized.

Contributor

Arcanemagus commented Mar 16, 2018

Looks like I need to refresh before posting, thanks for catching the CRLF line endings @maxbrunsfeld 😆.

@gliviu

This comment has been minimized.

gliviu commented Mar 16, 2018

It is actually useTreeSitterParsers: true. Wrong copy/paste after I made sure it works with old version.
Sorry about that.

maxbrunsfeld added a commit to tree-sitter/tree-sitter-python that referenced this issue Mar 28, 2018

@maxbrunsfeld

This comment has been minimized.

Contributor

maxbrunsfeld commented Mar 28, 2018

Hey, just an update on this - a fix will ship in Atom 1.26.0-beta1, or in 1.26.0 if you want to wait for the stable release.

@gliviu

This comment has been minimized.

gliviu commented Mar 29, 2018

Waiting for beta to give it a try

@maxbrunsfeld

This comment has been minimized.

Contributor

maxbrunsfeld commented Apr 5, 2018

Ok, 1.26.0-beta1 is out.

@gliviu

This comment has been minimized.

gliviu commented Apr 5, 2018

I've tried with this piece of code

for cl in reversed(range(1,
                         len(layers))):
    def f(a1:int,
          b1:List[int]):
        for cl in reversed(range(1,
                                 len(layers))):
            def f(a1:int, b1:List[int]):
                p2 = cl-1
                n2 = cl+1
        p2 = cl-1
        n2 = cl+1
        for cl in reversed(range(1, len(layers))):
            def f(a1:int, b1:List[int]):
                p2 = cl-1
                n2 = cl+1
    pl = cl-1
    nl = cl+1

and I've seen no mistake. We can consider this closed for good 👍

@lock

This comment has been minimized.

lock bot commented Oct 2, 2018

This issue has been automatically locked since there has not been any recent activity after it was closed. If you can still reproduce this issue in Safe Mode then please open a new issue and fill out the entire issue template to ensure that we have enough information to address your issue. Thanks!

@lock lock bot locked as resolved and limited conversation to collaborators Oct 2, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.