AndroidIDE
AndroidIDE copied to clipboard
[Improvement]: Move save files task to a background service
Feature description
Currently, the files can be saved on the main thread which can be problematic for large files. We need to move the file save logic to a background service (or a background thread at least).
We could also try to work on 'auto save' feature to automatically save files after they are modified. This could work something like :
- The user edits the file in the opened editor.
- After the user types something, we schedule a task (a timer or an event-based approach) with information about the changes.
- The task would run after some delay (5-10 seconds?). If the user edits the file again before this task is executed, we cancel the current task and re-schedule it.
- When the task finally executes, it edits the files with the given changes and writes it to disk.
- When the user manually saves the files, we cancel the current task if it is scheduled or executing.
If we decide to go with this approach for the 'auto save' feature, it should handle these cases as well :
- What if the file is externally changed?
- We can use timestamps for this and compare it with the file's timestamp before saving.
- What if the IDE crashes before the task is executed?
- A background service may solve this issue.
There may be other things to consider as well which I may be forgetting.
What version of AndroidIDE you're using?
v2.5.2 (debug builds)
Duplicate issues
- [X] This issue has not been reported yet.
Code of Conduct
- [X] I agree to follow this project's Code of Conduct