8000 Handle folding of nested defs correctly by wilywampa · Pull Request #500 · python-mode/python-mode · GitHub
[go: up one dir, main page]

Skip to content

Handle folding of nested defs correctly #500

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

Merged
merged 6 commits into from
Nov 26, 2014

Conversation

wilywampa
Copy link
Contributor

With the current folding algorithm, a function definition nested at the top of another function causes the whole outer function to be folded in with the nested function. See #489 for an example. This changeset solves that problem.

@wilywampa
Copy link
Contributor Author

Don't pull this one yet - it causes a huge slowdown. I'm trying to speed it up.

@wilywampa wilywampa force-pushed the nested_defs branch 3 times, most recently from 95911d1 to ea0e5d8 Compare November 18, 2014 01:52
- Fix folding of code between two defs nested under the same def
- Don't search for lines other than def or class in BlockStart because
  only def and class can contain nested folds
- Fix pattern used to find next_def
- Fix case where last_block_end is not followed by a blank line
@wilywampa
Copy link
Contributor Author

I made the logic much faster and added a file length limit above which this new logic is not used, so it doesn't have too much performance impact anymore.

klen added a commit that referenced this pull request Nov 26, 2014
Handle folding of nested defs correctly
@klen klen merged commit 59613fb into python-mode:develop Nov 26, 2014
@klen
Copy link
Collaborator
klen commented Nov 26, 2014

Great work, thank you very much.

@elmart
Copy link
elmart commented Nov 28, 2014

Same here. Thanks very much for this!
Closing my issue now.

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.

3 participants
0