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

Folding bad style #68

Closed
iago-lito opened this issue Dec 29, 2016 · 3 comments
Closed

Folding bad style #68

iago-lito opened this issue Dec 29, 2016 · 3 comments

Comments

@iago-lito
Copy link

iago-lito commented Dec 29, 2016

Currently working on this feature suggestion, I find myself puzzled with one case: SimpylFold is misfolding this script:

def method(argument):

    here_is = code
    here_is = {'kind': 'of a',
        'nasty': 'case',
'uh?': 'I know'}
    here_is = more_code

after_the_method

.. this is because the user is free to choose the indentation level as long as this opening bracket { is not closed, so Simpyl algorithm stumbles over the 6th line, considered as the end of the function.

This is misfolded. But this is bad python style.
What is Simpyl philosophy regarding this?
Is it considered as a bug? Or is it user's responsibility to respect PEP standards so its script is folded right?

What is the philosophy I should stick to? :)

@tmhedberg
Copy link
Owner

tmhedberg commented Dec 29, 2016 via email

@iago-lito
Copy link
Author

iago-lito commented Dec 30, 2016

Understood. Let's drop these nasty cases then. Cheers :)


Philosophy corner: Concerning the "actual parser"..

I think that parsing python script would not be such a pain if we accept not sticking to plain vimscript. For instance, python's native ast package does a really good job in this way.

However, nothing would work if the script is misformed (the parsing would fail). But Simpyl is all about script edition, and it is natural to have misformed script while editing script.

My point is: the reason we do not want Simpyl to perform an actual parsing is not because it would make it not "simpel" anymore. It is because it would not be able to fold script during the edition process.. which is a really good reason ;)


@tmhedberg
Copy link
Owner

tmhedberg commented Dec 30, 2016 via email

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

No branches or pull requests

2 participants