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

Use on_activated_async instead of on_load_async #115

Merged
merged 1 commit into from
Sep 1, 2024

Conversation

TerminalFi
Copy link
Contributor

Switch to on activated. This is a more accurate way to update the discord presences. This ensures we only update when a file is receiving focus and not when its being previewed. Such as Go To Anything

Should fix #109

Switch to on activated. This is a more accurate way to update the discord presences. This ensures we only update when a file is receiving focus and not when its being previewed. Such as Go To Anything
Copy link
Collaborator

@FichteFoll FichteFoll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I didn't even realize we never handled on_activated to begin with.

Thanks for the fix; I haven't seen or used this package in a while.

Comment on lines +460 to 461
def on_activated_async(self, view):
handle_activity(view)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I just realized that there is also on_modified_async which listens for changes and only then sets the active view (if the previous didn't change), so I think this will need some more consideration as to what the goal of the package is.

Should it only announce views that you made changes in or should it announce views that you focused? Depending on which we choose, we'd need to define either on_modified_async or on_activated_async but not both.

Either way, we'd also need a check for the view.element() so that we don't handle widget inputs such as the find panel or the command palette because those invoke on_activated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the fact it had on_loaded and on_modified it would seem they are trying to capture both. However, the default message is "Editing in {}"

I think it would make sense to limit it to on_modified only.

@Snazzah thoughts?.

Copy link
Owner

@Snazzah Snazzah Aug 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it only announce views that you made changes in or should it announce views that you focused?

Should announce views you focused on. Whatever the user is mainly looking at should be displayed through the presence.

@Snazzah Snazzah changed the title Update drp.py Use on_activated_async instead of on_load_async Sep 1, 2024
@Snazzah Snazzah merged commit 110b26c into Snazzah:master Sep 1, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ST stops responding when using Goto Anything
3 participants