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

Massive core refactoring + Tracking state indicator #26

Draft
wants to merge 24 commits into
base: main
Choose a base branch
from

Conversation

rupel190
Copy link

Hiho @plasmabit

Great plugin! I've used it for a while and meant to add a formatter to the editing_time as #25 suggests. However, things escalated and I've... I've kinda re-written the core logic using debouncing.
It works the same, but improves on robustness and efficiency, especially avoiding excessive function calls.

Since I'm not completely done I'll open this as a draft, though I'm already using it for 1-2 weeks now. Let me know what you think in the meanwhile!

Adds:

Status Indicator

Emojis at the bottom indicating whether time is counted.
image
After typing is halted a configurable timeout counts down and resets the indicator.
image
The frontmatter is not just updated after typing has stopped, but every x seconds (where x is the typing timeout). So if my typing timeout is set to 30 seconds and I type for 80 seconds the frontmatter is updated at 30s, 60s and then once more as the timer runs out.

Modified timestamp

The modified time is now updated only if a configurable threshold is used. So if set to 30 seconds, the overall typing time needs to exceed 30 seconds. Important: When typing timeout >= modified threshold, the modified time will always be updated. I.e. when the typing icon is blue for longer than the modified threshold it updates.

Restructures settings:

image
image

  • Date/Time formatter in settings are dynamically highlighted depending on validity
    image

Fixes:

Current plan:

…is tracked in the status bar, but neither connected to core tracking nor reflected in the properties.
… timeout for CAMS/BOMS; Add customizable edit indicators; MISSING usage of actual settings values
…the assignment of debounced functions into loadSettings
…on. Current state: CAMS modified, other 3 not updated
@plasmabit
Copy link
Owner

Wow, I haven't been active on GitHub, and I just saw this. Give me a minute

@plasmabit
Copy link
Owner

Feedback on this pull request

edited_seconds

Couple of things.

  1. backward compatibility

    • I think it’s fair to say that contributions should generally be backward compatible so people can enjoy the benefits of previous versions. The issue is how you’ve reimagined the edited_seconds property.
    • Before, it was just a number—straightforward. Now it’s a date. I get the idea of adding customization, but by default, it really should stay as a number. It’s literally the number of seconds a file was edited. I couldn’t get it to work with my setup either. When I set it to s or sss, it stopped updating after 10 seconds. It would be nice to have a toggle between being a number or a date.
  2. inflated edit times

    • The new setup inflates how long I actually spend editing notes. For example, when I edit for 4 seconds, it logs it as 10 seconds, which is more than double. Even with the lowest intervals, it overestimates. I like the idea of giving users options to tweak things, but there should still be an option for accurate tracking. This is especially important for CAMS, which is built for this exact purpose — precise and frequent updates. You can’t edit an inactive file with CAMS, so it has limits in its ability to be optimized.
  3. data vs presentation

    • Honestly, there’s no real need for it to be a date. Numbers are just easier to work with, and if someone wants a date, they can convert it through the interface. I used to display it on the status bar and might bring that back. This kind of flexibility should happen in how the data is displayed, not in the core property itself.

File Updates

I appreciate the effort to optimize things, but it feels like it lost its precision. The whole point of CAMS is to be accurate and snappy. Right now, if a file becomes inactive before its frontmatter is updated, it updates the next file you open instead. This also happens with edited_seconds. It’s especially bad when the timeout is set to higher intervals.

I’ve only tested this with CAMS, so I’m not sure how it behaves in other setups.


One last thing—please don’t edit manifest.json. It doesn’t support contributors, but I could add you to the README instead.

There are a lot of great ideas here, but right now, it feels more like a fork than a direct contribution.

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.

2 participants