Skip to content

Fix disable_file_parse for create_file #819

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/codegen/sdk/codebase/codebase_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,9 @@ def build_graph(self, repo_operator: RepoOperator) -> None:

# =====[ Add all files to the graph in parallel ]=====
syncs = defaultdict(lambda: [])
if not self.config.disable_file_parse:
if self.config.disable_file_parse:
logger.warning("WARNING: File parsing is disabled!")
else:
for filepath, _ in repo_operator.iter_files(subdirs=self.projects[0].subdirectories, extensions=self.extensions, ignore_list=GLOBAL_FILE_IGNORE_LIST):
syncs[SyncType.ADD].append(self.to_absolute(filepath))
logger.info(f"> Parsing {len(syncs[SyncType.ADD])} files in {self.projects[0].subdirectories or 'ALL'} subdirectories with {self.extensions} extensions")
Expand Down Expand Up @@ -266,7 +268,9 @@ def apply_diffs(self, diff_list: list[DiffLite]) -> None:
else:
logger.warning(f"Unhandled diff change type: {diff.change_type}")
by_sync_type = defaultdict(lambda: [])
if not self.config.disable_file_parse:
if self.config.disable_file_parse:
logger.warning("WARNING: File parsing is disabled!")
else:
for filepath, sync_type in files_to_sync.items():
if self.get_file(filepath) is None:
if sync_type is SyncType.DELETE:
Expand Down
2 changes: 1 addition & 1 deletion src/codegen/sdk/core/codebase.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ def create_file(self, filepath: str, content: str = "", sync: bool = True) -> TS

file_exts = self.ctx.extensions
# Create file as source file if it has a registered extension
if any(filepath.endswith(ext) for ext in file_exts):
if any(filepath.endswith(ext) for ext in file_exts) and not self.ctx.config.disable_file_parse:
file_cls = self.ctx.node_classes.file_cls
file = file_cls.from_content(filepath, content, self.ctx, sync=sync)
if file is None:
Expand Down
Loading