mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 06:05:01 +07:00
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.
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
class ThisIsATest():
|
||||
# <editor-fold desc="Description">
|
||||
def __init__(self):
|
||||
self.test = 1
|
||||
# </editor-fold>
|
||||
|
||||
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,4 @@
|
||||
[
|
||||
1,
|
||||
<selection>2
|
||||
]</selection>
|
||||
@@ -0,0 +1,4 @@
|
||||
[
|
||||
1,
|
||||
2
|
||||
]
|
||||
+1
-1
@@ -12,4 +12,4 @@ class ThisIsATest():
|
||||
print "Hello, world!"
|
||||
|
||||
<selection>def another_four(self):
|
||||
print "Hello, world!"</selection>
|
||||
print "Hello, world!"</selection>
|
||||
@@ -0,0 +1,17 @@
|
||||
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!"
|
||||
|
||||
# <editor-fold desc="Description">
|
||||
def another_four(self):
|
||||
print "Hello, world!"
|
||||
# </editor-fold>
|
||||
@@ -0,0 +1,9 @@
|
||||
class C:
|
||||
def m1(self):
|
||||
pass
|
||||
|
||||
<selection>def m2(self):
|
||||
pass
|
||||
|
||||
def m3(self):
|
||||
pass</selection>
|
||||
@@ -0,0 +1,11 @@
|
||||
class C:
|
||||
def m1(self):
|
||||
pass
|
||||
|
||||
# <editor-fold desc="Description">
|
||||
def m2(self):
|
||||
pass
|
||||
|
||||
def m3(self):
|
||||
pass
|
||||
# </editor-fold>
|
||||
@@ -0,0 +1 @@
|
||||
x = 'foo' <selection>+</selection> 'bar'
|
||||
@@ -0,0 +1,3 @@
|
||||
# <editor-fold desc="Description">
|
||||
x = 'foo' + 'bar'
|
||||
# </editor-fold>
|
||||
@@ -0,0 +1,2 @@
|
||||
<selection>print('foo')
|
||||
</selection>
|
||||
@@ -0,0 +1,3 @@
|
||||
# <editor-fold desc="Description">
|
||||
print('foo')
|
||||
# </editor-fold>
|
||||
Reference in New Issue
Block a user