Commit Graph
6 Commits
Author SHA1 Message Date
Mikhail Golubev 00f379ed9d PY-11357 Make automatic surrounding with custom folding comments more robust
* Searching of first parental PSI elements before/after new line
correctly stops at the start/end of file. As result it's possible now
to surround element at the first/last line in the file.
Also corresponding traversal does not try to climb above PSI file.
* Even single character can be selected in first place.
* In languages that uses indentation to delimit blocks (like Python)
several consequent sibling statements can be surrounded even if the last
of them is at the end of its parent.
2014-11-07 14:39:31 +03:00
Mikhail Golubev 59c5ef46fe PY-14261 Surrounding with custom folding preserves indentation in Python 2014-10-31 12:39:29 +03:00
Mikhail Golubev 5a383961d2 PY-11357 Adjust range of PSI elements if one of them wraps another
Python does not have special terminal symbols to indicate start/end of
the block. Because of that current approach for searching boundaries for
custom folding region may result in that one of elements "felt of the
cliff" of statement list and is too far above. E.g. in sample given by
user for the last method these elements are PyFunction and PyClass.
However if exactly one element was selected by user and both elements
ends at the same offset it's safe to pick the nested one.
2014-10-31 12:39:29 +03:00
Ekaterina Tuzova 3052d82ef6 fixed PY-2984 Surround with try/except reformats entire file 2013-11-27 17:38:46 +04:00
Dmitry Jemerov f27a14dc4c python surrounders brought to mostly working condition 2009-12-08 20:56:24 +03:00
Dmitry Jemerov 77a3189d40 work in progress on fixing python surround 2009-12-08 20:56:23 +03:00