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

Create origami-parsers.el #116

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Catgolin
Copy link

Currently, in Python, when we have type-hints in the definition of a function, the folding occurs on the first colon.

Folding the following function:

def some_function(arg: ArgType) -> ReturnType:
    # Stuff
    pass

will result in only showing
def some_function(arg:...

Just updating the rule of the parser to check if the colon is at the end of the line fixes the issue, allowing to show the full function definition, def some_function(arg: ArgType) -> ReturnType: which is far more appreciable in my opinion.
I believe the only cases in Python where we have a colon that is not at the end of the line is the situation described above, where we are hinting the type of a parameter, and the definition of entries in a dictionary, so this modification should not break anything (but I might be mistaken).
The only case I could think of that breaks this is if we add a comment after the colon at the end of the line, but I don't think this really causes an issue.

Make foldings in Python happen only when colon is at the end on the line (to prevent folding in the middle of the definition of a function while using type-hints)
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

Successfully merging this pull request may close these issues.

None yet

1 participant