Skip to content

Commit 48544d2

Browse files
committed
address georges comments
1 parent 63919f6 commit 48544d2

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

sqlmesh/lsp/reference.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,20 @@ def by_position(position: Position) -> t.Callable[[Reference], bool]:
3434
Returns:
3535
A function that returns True if the reference contains the position, False otherwise
3636
"""
37-
return lambda r: (
38-
r.range.start.line < position.line
39-
or (r.range.start.line == position.line and r.range.start.character <= position.character)
40-
) and (
41-
r.range.end.line > position.line
42-
or (r.range.end.line == position.line and r.range.end.character >= position.character)
43-
)
37+
38+
def contains_position(r: Reference) -> bool:
39+
return (
40+
r.range.start.line < position.line
41+
or (
42+
r.range.start.line == position.line
43+
and r.range.start.character <= position.character
44+
)
45+
) and (
46+
r.range.end.line > position.line
47+
or (r.range.end.line == position.line and r.range.end.character >= position.character)
48+
)
49+
50+
return contains_position
4451

4552

4653
def get_references(

0 commit comments

Comments
 (0)