Skip to content

Commit 77733f7

Browse files
committed
chore: styling
1 parent 4056106 commit 77733f7

1 file changed

Lines changed: 16 additions & 14 deletions

File tree

lua/neotest/lib/positions/init.lua

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,22 @@ neotest.lib.positions = {}
1515
--- @param range integer[] range represented as 4 integers: start_row, start_col, end_row, end_col
1616
--- @return integer Distance from given line to the range. If line is within range, distance is 0.
1717
local function distance(line, range)
18-
local start_row, end_row = range[1], range[3]
19-
if line < start_row then
20-
return start_row - line
21-
elseif line <= end_row then
22-
return 0
23-
else
24-
return line - end_row
25-
end
18+
local start_row, end_row = range[1], range[3]
19+
if line < start_row then
20+
return start_row - line
21+
elseif line <= end_row then
22+
return 0
23+
else
24+
return line - end_row
25+
end
2626
end
2727

2828
--- Calculates number of lines of given range
2929
--- @param range integer[] range represented as 4 integers: start_row, start_col, end_row, end_col
3030
--- @return integer Number of lines that the range spans over
3131
local function range_size(range)
32-
local start_row, end_row = range[1], range[3]
33-
return end_row - start_row + 1
32+
local start_row, end_row = range[1], range[3]
33+
return end_row - start_row + 1
3434
end
3535

3636
--- Get the nearest position to the given line in the provided file tree
@@ -46,7 +46,7 @@ neotest.lib.positions.nearest = function(tree, line)
4646
local nearest = tree
4747
local nearest_distance = nil
4848
local nearest_range_size = nil
49-
for _, node in tree:iter_nodes({continue = continue}) do
49+
for _, node in tree:iter_nodes({ continue = continue }) do
5050
(function()
5151
if node:data().type == "file" then
5252
-- In the first iteration of iter_nodes, node will be the root node,
@@ -68,9 +68,11 @@ neotest.lib.positions.nearest = function(tree, line)
6868
end
6969
local dist = distance(line, range)
7070
local size = range_size(range)
71-
if nearest_distance == nil or
72-
dist < nearest_distance or
73-
(dist == nearest_distance and size < nearest_range_size) then
71+
if
72+
nearest_distance == nil
73+
or dist < nearest_distance
74+
or (dist == nearest_distance and size < nearest_range_size)
75+
then
7476
nearest = node
7577
nearest_distance = dist
7678
nearest_range_size = size

0 commit comments

Comments
 (0)