|
53 | 53 | ---@param line number Buffer line number |
54 | 54 | ---@param output Output Output object to query |
55 | 55 | ---@return {message: MessageInfo, part: MessagePart, msg_idx: number, part_idx: number}|nil |
| 56 | +---@deprecated Use RenderState:get_message_at_line() instead |
56 | 57 | function M.get_message_at_line(line, output) |
57 | | - local metadata = output:get_nearest_metadata(line) |
58 | | - if metadata and metadata.msg_idx and metadata.part_idx then |
59 | | - local msg = state.messages and state.messages[metadata.msg_idx] |
60 | | - if not msg or not msg.parts then |
61 | | - return nil |
62 | | - end |
63 | | - local part = msg.parts[metadata.part_idx] |
64 | | - if not part then |
65 | | - return nil |
66 | | - end |
67 | | - return { |
68 | | - message = msg, |
69 | | - part = part, |
70 | | - msg_idx = metadata.msg_idx, |
71 | | - part_idx = metadata.part_idx, |
72 | | - } |
73 | | - end |
| 58 | + return nil |
74 | 59 | end |
75 | 60 |
|
76 | 61 | ---Calculate statistics for reverted messages and tool calls |
@@ -667,22 +652,10 @@ end |
667 | 652 | ---Formats a single message part and returns the resulting output object |
668 | 653 | ---@param part MessagePart The part to format |
669 | 654 | ---@param role 'user'|'assistant'|'system' The role, user or assistant, that created this part |
670 | | ----@param msg_idx integer The index of the message in state.messages |
671 | | ----@param part_idx integer The index of the part in state.messages[msg_idx].parts |
672 | 655 | ---@return Output |
673 | | -function M.format_part(part, role, msg_idx, part_idx) |
| 656 | +function M.format_part(part, role) |
674 | 657 | local output = Output.new() |
675 | 658 |
|
676 | | - -- FIXME: do we need metadata? it looks like maybe only for snapshots? |
677 | | - local metadata = { |
678 | | - msg_idx = msg_idx, |
679 | | - part_idx = part_idx, |
680 | | - role = role, |
681 | | - type = part.type, |
682 | | - snapshot = part.snapshot, |
683 | | - } |
684 | | - output:add_metadata(metadata) |
685 | | - |
686 | 659 | local content_added = false |
687 | 660 |
|
688 | 661 | if role == 'user' then |
|
0 commit comments