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

Feat: Update Date Modified on Editor Content Change & Miscellaneous Style and YAML Timestamp Changes #1178

Merged

Conversation

pjkaufman
Copy link
Collaborator

@pjkaufman pjkaufman commented Sep 28, 2024

Fixes #183
Fixes #890
Fixes #1161
Fixes #1162
May fix #995

There has been some level of desire for the ability to make the date modified be set whenever the user makes a change to the editor/file via Obsidian. In order to do this, there is a need to know whenever the editor is updated. When it is, it will set off a debounced action to update the date modified so long as the user does not remove the changes by the time that the debounced function runs.

There were also some style changes made to cut down some on the whitespace that was present, but not necessary.

There was also a wording update to try to make things clearer that the lint on file change only happens when focused file changes.

Changes Made:

  • Updated Lint on File Change to Lint on Focused File Change
  • Adds ability to run the YAML timestamp rule x seconds after the last editor change (it tries to keep from updating the date modified if no net changes were made in the editor between when the first change was made and the debounce ran)
  • Tries to make sure that the other linting logic at the end updates the original file text for any debounce functions that exist to try to keep from unnecessarily adding a another timestamp update if it is not necessary
  • Adds a dropdown for determining the source of truth for date modified and date created

TODO:

  • Swap boolean setting for trusting created date in the YAML as the source of truth to a dropdown
  • Add a similar option for date modified where only changes in Obsidian are recorded
  • Try to account for no valid created date provided (0 as the ctime should instead be now)

…le change logic and added some style cleanup to make settings without info, but with a description to look a little cleaner
…eed some tweaking to make it more accurate, but it should do the trick.
@pjkaufman pjkaufman added bug Something isn't working enhancement New feature or request yaml YAML related issues or features obsidian Obsidian specific syntax issue or feature wording update This means that the fix or at least part of the fix is related to a wording change for the settings labels Sep 28, 2024
@pjkaufman pjkaufman self-assigned this Sep 28, 2024
@pjkaufman pjkaufman marked this pull request as ready for review September 28, 2024 21:07
@pjkaufman pjkaufman merged commit 21856fc into platers:master Sep 28, 2024
1 check passed
@pjkaufman pjkaufman deleted the timestamp-update-after-file-change branch September 28, 2024 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request obsidian Obsidian specific syntax issue or feature wording update This means that the fix or at least part of the fix is related to a wording change for the settings yaml YAML related issues or features
Projects
None yet
1 participant