mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
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.
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
class ThisIsATest():
|
||||
<selection>def __init__(self):
|
||||
self.test = 1</selection>
|
||||
|
||||
def another_one(self):
|
||||
print "Hello, world!"
|
||||
|
||||
def another_two(self):
|
||||
print "Hello, world!"
|
||||
|
||||
def another_three(self):
|
||||
print "Hello, world!"
|
||||
|
||||
def another_four(self):
|
||||
print "Hello, world!"
|
||||
@@ -0,0 +1,15 @@
|
||||
class ThisIsATest():
|
||||
def __init__(self):
|
||||
self.test = 1
|
||||
|
||||
def another_one(self):
|
||||
print "Hello, world!"
|
||||
|
||||
def another_two(self):
|
||||
print "Hello, world!"
|
||||
|
||||
def another_three(self):
|
||||
print "Hello, world!"
|
||||
|
||||
<selection>def another_four(self):
|
||||
print "Hello, world!"</selection>
|
||||
Reference in New Issue
Block a user