Giter Club home page Giter Club logo

Comments (2)

tmhedberg avatar tmhedberg commented on July 20, 2024

I wouldn't say that this is intentional, in that it would be nice for the plugin to work properly in this case, but it's unlikely that we'll add support for it.

For the sake of simplicity, SimpylFold does not implement a full-fledged parser for the Python syntax, but relies on regular expressions, which necessitates that we make certain assumptions about how your code is formatted. In particular, we assume that you follow the Python community's common formatting conventions, especially those dictated by PEP 8. Other formatting styles may be accepted by the Python interpreter, but we don't explicitly strive to fold correctly when dealing with styles that do not conform to PEP 8 and other common conventions.

While I don't believe PEP 8 specifically says anything about putting ): on its own line, there is a discussion on this topic where the majority consensus seems to be that this is a generally discouraged style.

On putting a blank line before a docstring, PEP 257 (on docstring conventions) states that, for single-line docstrings, "There's no blank line either before or after the docstring", and for multi-line docstrings, it discusses inserting a blank line after certain types of docstrings, but does not ever say to insert a blank line before the docstring, which I take to mean that this is also discouraged.

There's nothing wrong with using a different style, but we can't support everyone's unique preferred style while keeping SimpylFold simple. I'd accept a tiny patch to address your case if it (in my subjective opinion) does not make the plugin code more complicated, but otherwise, it's not something I'm going to spend time trying to support.

from simpylfold.

yxiong avatar yxiong commented on July 20, 2024

Thanks for the detailed response, @tmhedberg ! They are really helpful, especially the references to PEP 8 and discussion threads. I can use them in the future to convince others to follow the same convention so that this plugin works as much as possible :)

from simpylfold.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.