Skip to content

Commit a627f8a

Browse files
committed
fix selection context payload
1 parent e6e31d0 commit a627f8a

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

lua/eca/api.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,11 @@ function M.add_selection_context()
153153
-- Create context object
154154
local context = {
155155
type = "file",
156-
path = context_path,
157-
lines_range = {
156+
path = current_file,
157+
linesRange = {
158158
start = start_line,
159-
End = end_line
160-
}
159+
["end"] = end_line, -- end is a reserved word in Lua
160+
},
161161
}
162162

163163
-- Get current sidebar and add context

lua/eca/sidebar.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,6 +1132,10 @@ function M:_update_contexts_display()
11321132
for i, context in ipairs(self._contexts) do
11331133
local name = context.type == "repoMap" and "repoMap" or vim.fn.fnamemodify(context.path, ":t") -- Get filename only
11341134

1135+
if context.linesRange and context.linesRange.start and context.linesRange["end"] then
1136+
name = string.format("%s:%d-%d", name, context.linesRange.start, context.linesRange["end"])
1137+
end
1138+
11351139
-- Create context reference with @ prefix like eca-emacs
11361140
local ref = "@" .. name
11371141
table.insert(context_refs, ref)

0 commit comments

Comments
 (0)