Skip to content

Commit 364cf6d

Browse files
committed
Refactor CodeContextStructure to improve raw element formatting and enhance readability
1 parent 09b6663 commit 364cf6d

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

codetide/core/models.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -359,17 +359,15 @@ def as_list_str(self)->List[List[str]]:
359359
raw_elements_by_file["PACKAGES"].append(entry.raw)
360360

361361
for entry in self.variables.values():
362-
raw_elements_by_file[entry.file_path].append(entry.raw)
362+
raw_elements_by_file[entry.file_path].append(f"\n{entry.raw}")
363363

364364
for entry in self.functions.values():
365-
raw_elements_by_file[entry.file_path].append(entry.raw)
365+
raw_elements_by_file[entry.file_path].append(f"\n{entry.raw}")
366366

367367
for entry in self.classes.values():
368-
raw_elements_by_file[entry.file_path].append(entry.raw)
369-
368+
raw_elements_by_file[entry.file_path].append(f"\n{entry.raw}")
370369
for entry in self.classes_headers.values():
371-
# TODO fix place holder with class definition +attributes
372-
raw_elements_by_file[entry.file_path].append(self.trim(entry.raw))
370+
raw_elements_by_file[entry.file_path].append(f"\n{self.trim(entry.raw)}")
373371

374372
unique_class_elements_not_in_classes = set(self._unique_class_elements_ids) - set(self.classes.keys()) - set(self.classes_headers.keys()) - set(self.requested_elements)
375373

@@ -402,7 +400,7 @@ def as_list_str(self)->List[List[str]]:
402400

403401
wrapped_list = [
404402
[
405-
wrap_content(content="\n\n".join(elements), filepath=filepath)
403+
wrap_content(content="\n".join(elements), filepath=filepath)
406404
for filepath, elements in raw_elements_by_file.items()
407405
], [
408406
wrap_content(content=content, filepath=filepath)

0 commit comments

Comments
 (0)