Skip to content
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

Autosave for editor #134

Closed
tomlin7 opened this issue Oct 2, 2023 · 11 comments · Fixed by #139
Closed

Autosave for editor #134

tomlin7 opened this issue Oct 2, 2023 · 11 comments · Fixed by #139
Assignees
Labels
enhancement New feature or request file management text editor Related to text editor's features

Comments

@tomlin7
Copy link
Owner

tomlin7 commented Oct 2, 2023

Feature

Biscuit doesn't have autosave feature yet. This is also a very important feature. We can make use of the tkinter after method for handling this. Also this autosave will require a field in settings to configure intervals and toggle, maybe also from command palette.

@tomlin7 tomlin7 added enhancement New feature or request text editor Related to text editor's features file management labels Oct 2, 2023
@tomlin7 tomlin7 self-assigned this Oct 2, 2023
@KristoferSoler
Copy link

Hi @billyeatcookies , I would like to take this issue. 💪🏽

@tomlin7
Copy link
Owner Author

tomlin7 commented Oct 3, 2023

Hey @KristoferSoler, thanks alot ❤️
The autosave can be implemented within the TextEditor class or Editor class, ig former would be better.

Few things to be noted are that, before calling editor.save() you should be checking:

  • editor.content
  • editor.content.exists
  • editor.content.editable

all these should be satisfied.

Like for example:

https://github.com/billyeatcookies/Biscuit/blob/209945384ae3a16f238f3abd9cada7cc0185e6e1/biscuit/core/utils/events.py#L34-L40

one issue preventing us from reusing this code is that autosave should not trigger a save_as dialog for non-existing files.

Also, let me know your thoughts on only saving the active tab or saving all the open tabs

@KristoferSoler
Copy link

Thanks for the info.
I'll start working and make the PR ASAP. :)

@KristoferSoler
Copy link

Also, let me know your thoughts on only saving the active tab or saving all the open tabs

I would focus first on the active tab and then watch the performance.
Or even create a new toggle to allow "active tab" o "all tabs". For more options.

@tomlin7
Copy link
Owner Author

tomlin7 commented Oct 4, 2023

@KristoferSoler thanks for the response! ❤️

Regarding the configuration part, #128 mentions about this, since the settings editor isn't fully functional you will have to do this using the config file for now. I will keep the issue updated regarding this.

@KristoferSoler
Copy link

Hi @billyeatcookies,

I think we have an issue with pytest execution.

for i, item in enumerate(path):
                text = item if item == path[-1] else f"{item} ›"
>               self.additem(os.path.join(*path[:i]), text)
E               TypeError: join() missing 1 required positional argument: 'a'

Looking if it was something from my end it seems the array it's build here: https://github.com/billyeatcookies/Biscuit/blob/209945384ae3a16f238f3abd9cada7cc0185e6e1/biscuit/core/components/editors/breadcrumbs/__init__.py#L24

Returns an array with the first element empty, this cause self.additem(os.path.join(*path[:i]), text) to break.
At this image you can see the path value before and after the treatment.
image

I did a search thorough the docs but I couldn't find anything.
Do I need to configure something I missed?

@tomlin7
Copy link
Owner Author

tomlin7 commented Oct 4, 2023

Returns an array with the first element empty, this cause self.additem(os.path.join(*path[:i]), text) to break.

@KristoferSoler that's right, there should be checks for non-empty path value. The unit testing part is very much in progress so far, and the tests written so far don't cover the entire editor and it's components.

As for now, you can skip the tests, or fix if you'd like to, I will fix them asap.

@KristoferSoler
Copy link

KristoferSoler commented Oct 4, 2023

@KristoferSoler that's right, there should be checks for non-empty path value. The unit testing part is very much in progress so far, and the tests written so far don't cover the entire editor and it's components.

Roger that. I will overpass this for now and maybe we can work together on this. 💪🏽

@tomlin7
Copy link
Owner Author

tomlin7 commented Oct 4, 2023

@KristoferSoler Thats soo good of you, I'd love to consider that after finishing up on the language server issue!

@KristoferSoler
Copy link

Hi!

Sorry for the latency. I have been on a trip. I'll create the PR today. :)

@tomlin7
Copy link
Owner Author

tomlin7 commented Oct 14, 2023

It's okay! I'm also busy with uni these days, understandable.

I'll check and share my thoughts on pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request file management text editor Related to text editor's features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants