formatting

pull/1149/head^2
LeonOstrez 2 years ago
parent f6105101d3
commit fcb4665fd4

@ -495,13 +495,13 @@ class StateManager:
modified_files.append(db_file.path)
return modified_files
async def get_modified_files_with_content(self) -> list[dict]:
"""
Return a list of new or modified files from the file system,
Return a list of new or modified files from the file system,
including their paths, old content, and new content.
:return: List of dictionaries containing paths, old content,
:return: List of dictionaries containing paths, old content,
and new content for new or modified files.
"""
@ -517,25 +517,29 @@ class StateManager:
if saved_file_content == content:
continue
modified_files.append({
"path": path,
"file_old": saved_file_content, # Serialized content
"file_new": content
})
modified_files.append(
{
"path": path,
"file_old": saved_file_content, # Serialized content
"file_new": content,
}
)
# Handle files removed from disk
await self.current_state.awaitable_attrs.files
for db_file in self.current_state.files:
if db_file.path not in files_in_workspace:
modified_files.append({
"path": db_file.path,
"file_old": db_file.content.content, # Serialized content
"file_new": "" # Empty string as the file is removed
})
modified_files.append(
{
"path": db_file.path,
"file_old": db_file.content.content, # Serialized content
"file_new": "", # Empty string as the file is removed
}
)
return modified_files
def workspace_is_empty(self) -> bool:
"""
Returns whether the workspace has any files in them or is empty.

@ -230,16 +230,18 @@ class UIBase:
:param task_source: Source of the task, one of: 'app', 'feature', 'debugger', 'troubleshooting', 'review'.
"""
raise NotImplementedError()
async def send_modified_files(
self,
modified_files: dict[str, str,str],
modified_files: dict[str, str, str],
):
"""
Send a list of modified files to the UI.
"""
Send a list of modified files to the UI.
:param modified_files: List of modified files.
"""
raise NotImplementedError()
:param modified_files: List of modified files.
"""
raise NotImplementedError()
async def send_run_command(self, run_command: str):
"""
Send a run command to the UI.

@ -312,15 +312,14 @@ class IPCClientUI(UIBase):
"all_tasks": tasks,
},
)
async def send_modified_files(
self,
modified_files: dict[str, str, str],
):
await self._send(
MessageType.MODIFIED_FILES,
content={
"files": modified_files
},
content={"files": modified_files},
)
async def send_step_progress(

Loading…
Cancel
Save