File tree Expand file tree Collapse file tree
lua/codecompanion/interactions/chat/ui Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,16 +40,18 @@ function Folds:setup(winnr)
4040end
4141
4242--- Global method which Neovim calls to display folded text
43- --- @return table
43+ --- @return table | string
4444function Folds .fold_text ()
4545 local bufnr = api .nvim_get_current_buf ()
46- local start = vim .v .foldstart - 1
47- local folds = Folds .fold_summaries [bufnr ] or {}
48- local fold_data = folds [start ]
4946
47+ if vim .bo [bufnr ].filetype ~= " codecompanion" then
48+ return vim .fn .foldtext ()
49+ end
50+
51+ local folds = Folds .fold_summaries [bufnr ]
52+ local fold_data = folds and folds [vim .v .foldstart - 1 ]
5053 if not fold_data then
51- -- Fallback for legacy data
52- return Folds ._format_fold_text (" Unknown" , " context" )
54+ return vim .fn .foldtext ()
5355 end
5456
5557 return Folds ._format_fold_text (fold_data .content , fold_data .type )
You can’t perform that action at this time.
0 commit comments