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: Include canvas files when determining orphans #53

Merged

Conversation

MostlyArmless
Copy link
Contributor

Main change

Mainly, this change is to close issue #43:

  1. We've already loaded a list of all vault files, so filter out just the .canvas files
  2. loop over the canvas files, load their contents, parse the JSON and find any links to other files. That set of links is the same one that we're already populating when iterating all the markdown files.
  3. Now, when we check if a file is orphaned, this plugin will no longer consider a file to be orphaned if it exists in or is linked to from exclusively .canvas files.

I smoke tested this briefly on my vault and didn't see any issues.

Other small changes

This change includes a few small performance improvements:

  • using a Set instead of an array for O(1) membership checks
  • only checking for the outFile until it's been found once

Some clarity improvements:

  • Renamed variables/methods to be more self-explanatory

@MostlyArmless
Copy link
Contributor Author

Apologies for the messy diff, I think my IDE applied some whitespace adjustments I didn't realize. If you view the diffs in VS Code it should be easier to read.

@Vinzent03
Copy link
Owner

Thanks for your contribution! I needed some time and fixed/changed some things, but this is now ready to go. 🎉

@Vinzent03 Vinzent03 changed the title Include canvas files when determining orphans feat: Include canvas files when determining orphans Mar 13, 2024
@Vinzent03 Vinzent03 merged commit 56900fe into Vinzent03:main Mar 13, 2024
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