File tree Expand file tree Collapse file tree
lua/codecompanion/interactions/chat/rules Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -142,8 +142,9 @@ function Rules:read_files(paths)
142142 local ok , content = pcall (file .read , path )
143143
144144 if ok then
145- -- Find the parser for this file
145+ -- Find the parser and original path for this file
146146 local file_parser = nil
147+ local original_path = nil
147148 for _ , file_spec in ipairs (self .files ) do
148149 if type (file_spec ) == " table" and file_spec .path then
149150 local normalized_spec_path = vim .fs .normalize (file_spec .path )
@@ -159,14 +160,20 @@ function Rules:read_files(paths)
159160 -- Exact path match
160161 if path == normalized_spec_path then
161162 file_parser = file_spec .parser
163+ original_path = file_spec .path
162164 break
163165 end
164166 end
167+ elseif type (file_spec ) == " string" then
168+ if path == vim .fs .normalize (file_spec ) then
169+ original_path = file_spec
170+ break
171+ end
165172 end
166173 end
167174
168175 table.insert (files , {
169- name = path ,
176+ name = original_path or path ,
170177 content = content ,
171178 path = path ,
172179 filename = vim .fn .fnamemodify (path , " :t" ),
You can’t perform that action at this time.
0 commit comments