Skip to content

Commit 60f9416

Browse files
committed
Updates caret styling to point left if the line character is before the first indentation
1 parent 69986a3 commit 60f9416

File tree

5 files changed

+27
-18
lines changed

5 files changed

+27
-18
lines changed

packages/pyright-scip/snapshots/output/enclosing_range_class/advanced.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# < definition scip-python python snapshot-util 0.1 advanced/__init__:
22

33
# format-options: showRanges
4-
# start enclosing_range scip-python python snapshot-util 0.1 advanced/class_decorator().
4+
# < start enclosing_range scip-python python snapshot-util 0.1 advanced/class_decorator().
55
def class_decorator(cls):
66
# ^^^^^^^^^^^^^^^ definition snapshot-util 0.1 advanced/class_decorator().
77
# ^^^ definition snapshot-util 0.1 advanced/class_decorator().(cls)
@@ -14,12 +14,12 @@ def wrapper(*args, **kwargs):
1414
# ^^^ reference snapshot-util 0.1 advanced/class_decorator().(cls)
1515
# ^^^^ reference snapshot-util 0.1 advanced/class_decorator().wrapper().(args)
1616
# ^^^^^^ reference snapshot-util 0.1 advanced/class_decorator().wrapper().(kwargs)
17-
# end enclosing_range scip-python python snapshot-util 0.1 advanced/class_decorator().wrapper().
17+
# ^ end enclosing_range scip-python python snapshot-util 0.1 advanced/class_decorator().wrapper().
1818
return wrapper
1919
# ^^^^^^^ reference snapshot-util 0.1 advanced/class_decorator().wrapper().
20-
# end enclosing_range scip-python python snapshot-util 0.1 advanced/class_decorator().
20+
# < end enclosing_range scip-python python snapshot-util 0.1 advanced/class_decorator().
2121

22-
# start enclosing_range scip-python python snapshot-util 0.1 advanced/Test#
22+
# < start enclosing_range scip-python python snapshot-util 0.1 advanced/Test#
2323
@class_decorator
2424
#^^^^^^^^^^^^^^^ reference snapshot-util 0.1 advanced/class_decorator().
2525
class Test:
@@ -35,7 +35,7 @@ def __init__(self, x: float):
3535
# ^^^^ reference snapshot-util 0.1 advanced/Test#__init__().(self)
3636
# ^ definition snapshot-util 0.1 advanced/Test#x.
3737
# ^ reference snapshot-util 0.1 advanced/Test#__init__().(x)
38-
# end enclosing_range scip-python python snapshot-util 0.1 advanced/Test#__init__().
38+
# ^ end enclosing_range scip-python python snapshot-util 0.1 advanced/Test#__init__().
3939

4040
# ⌄ start enclosing_range scip-python python snapshot-util 0.1 advanced/Test#test().
4141
def test(self) -> float:
@@ -45,6 +45,6 @@ def test(self) -> float:
4545
return self.x
4646
# ^^^^ reference snapshot-util 0.1 advanced/Test#test().(self)
4747
# ^ reference snapshot-util 0.1 advanced/Test#x.
48-
# end enclosing_range scip-python python snapshot-util 0.1 advanced/Test#test().
49-
# end enclosing_range scip-python python snapshot-util 0.1 advanced/Test#
48+
# ^ end enclosing_range scip-python python snapshot-util 0.1 advanced/Test#test().
49+
# < end enclosing_range scip-python python snapshot-util 0.1 advanced/Test#
5050

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# < definition scip-python python snapshot-util 0.1 simple/__init__:
22

33
# format-options: showRanges
4-
# start enclosing_range scip-python python snapshot-util 0.1 simple/Test#
4+
# < start enclosing_range scip-python python snapshot-util 0.1 simple/Test#
55
class Test():
66
# ^^^^ definition snapshot-util 0.1 simple/Test#
77
# ^^^^ definition snapshot-util 0.1 simple/Test#
88
pass
9-
# end enclosing_range scip-python python snapshot-util 0.1 simple/Test#
9+
# < end enclosing_range scip-python python snapshot-util 0.1 simple/Test#
1010

packages/pyright-scip/snapshots/output/enclosing_range_function/advanced.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# < definition scip-python python snapshot-util 0.1 advanced/__init__:
22

33
# format-options: showRanges
4-
# start enclosing_range scip-python python snapshot-util 0.1 advanced/decorator().
4+
# < start enclosing_range scip-python python snapshot-util 0.1 advanced/decorator().
55
def decorator(func):
66
# ^^^^^^^^^ definition snapshot-util 0.1 advanced/decorator().
77
# ^^^^ definition snapshot-util 0.1 advanced/decorator().(func)
@@ -14,12 +14,12 @@ def wrapper(*args, **kwargs):
1414
# ^^^^ reference snapshot-util 0.1 advanced/decorator().(func)
1515
# ^^^^ reference snapshot-util 0.1 advanced/decorator().wrapper().(args)
1616
# ^^^^^^ reference snapshot-util 0.1 advanced/decorator().wrapper().(kwargs)
17-
# end enclosing_range scip-python python snapshot-util 0.1 advanced/decorator().wrapper().
17+
# ^ end enclosing_range scip-python python snapshot-util 0.1 advanced/decorator().wrapper().
1818
return wrapper
1919
# ^^^^^^^ reference snapshot-util 0.1 advanced/decorator().wrapper().
20-
# end enclosing_range scip-python python snapshot-util 0.1 advanced/decorator().
20+
# < end enclosing_range scip-python python snapshot-util 0.1 advanced/decorator().
2121

22-
# start enclosing_range scip-python python snapshot-util 0.1 advanced/func().
22+
# < start enclosing_range scip-python python snapshot-util 0.1 advanced/func().
2323
@decorator
2424
#^^^^^^^^^ reference snapshot-util 0.1 advanced/decorator().
2525
def func(x: float) -> float:
@@ -33,5 +33,5 @@ def func(x: float) -> float:
3333

3434
return test
3535
# ^^^^ reference local 0
36-
# end enclosing_range scip-python python snapshot-util 0.1 advanced/func().
36+
# < end enclosing_range scip-python python snapshot-util 0.1 advanced/func().
3737

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# < definition scip-python python snapshot-util 0.1 simple/__init__:
22

33
# format-options: showRanges
4-
# start enclosing_range scip-python python snapshot-util 0.1 simple/simple().
4+
# < start enclosing_range scip-python python snapshot-util 0.1 simple/simple().
55
def simple(x):
66
# ^^^^^^ definition snapshot-util 0.1 simple/simple().
77
# ^ definition snapshot-util 0.1 simple/simple().(x)
88
return x
99
# ^ reference snapshot-util 0.1 simple/simple().(x)
10-
# end enclosing_range scip-python python snapshot-util 0.1 simple/simple().
10+
# < end enclosing_range scip-python python snapshot-util 0.1 simple/simple().
1111

packages/pyright-scip/src/lib.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,19 @@ export function formatSnapshot(
189189

190190
out.push(commentSyntax);
191191
out.push(' '.repeat(Math.max(1, enclosingRange.range.start.character - 1)));
192+
193+
if (enclosingRange.range.start.character < 2) {
194+
out.push('<');
195+
} else if (end) {
196+
out.push('^');
197+
} else {
198+
out.push('⌄');
199+
}
200+
192201
if (end) {
193-
out.push(' end ');
202+
out.push(' end ');
194203
} else {
195-
out.push(' start ');
204+
out.push(' start ');
196205
}
197206
out.push('enclosing_range ');
198207
out.push(enclosingRange.symbol);

0 commit comments

Comments
 (0)