Skip to content

Commit 5551304

Browse files
committed
refactor: line number formatting for shared buffers
1 parent ff3eae6 commit 5551304

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

lua/codecompanion/helpers/actions.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function M.get_code(start_line, end_line, opts)
1010
for line_num = start_line, end_line do
1111
local line
1212
if opts and opts.show_line_numbers then
13-
line = string.format("%d: %s", line_num, vim.fn.getline(line_num))
13+
line = string.format("%d |%s", line_num, vim.fn.getline(line_num))
1414
else
1515
line = string.format("%s", vim.fn.getline(line_num))
1616
end

lua/codecompanion/utils/buffers.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ function M.add_line_numbers(content)
121121

122122
content = vim.split(content, "\n")
123123
for i, line in ipairs(content) do
124-
table.insert(formatted, string.format("%d: %s", i, line))
124+
table.insert(formatted, string.format("%d |%s", i, line))
125125
end
126126

127127
return table.concat(formatted, "\n")

tests/utils/test_buffers.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ T["Utils->Buffers"]["add_line_numbers works"] = function()
4747
return _G.buf_utils.add_line_numbers(content)
4848
]])
4949

50-
h.expect_match(result, "1: hello")
51-
h.expect_match(result, "2: world")
52-
h.expect_match(result, "3: test")
50+
h.expect_match(result, "1 |hello")
51+
h.expect_match(result, "2 |world")
52+
h.expect_match(result, "3 |test")
5353
end
5454

5555
return T

0 commit comments

Comments
 (0)