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

Orphaned notes #457

Merged
merged 11 commits into from
Jan 26, 2021
Merged

Orphaned notes #457

merged 11 commits into from
Jan 26, 2021

Conversation

leonhfr
Copy link
Contributor

@leonhfr leonhfr commented Jan 23, 2021

Closes #367

Summary

This PR adds an Orphans panel that references all notes that have neither backlinks nor forward links.

There are two new settings:

  • foam.orphans.exclude: exclude some repositories from the orphans report (for example, excluding the /journal for daily notes)
  • foam.orphans.groupBy: either group orphans by folder, or not at all, defaults to folder. The orphans are then sorted alphabetically.

I had a first iteration that allowed creating an orphans.md note with a command. However, it feels redundant with the panel, which also has the advantage of self updating, so I think we could leave that part of the issue out.

Todo

  • Update documentation/recipe
  • Testing

Screenshot

orphans-1

Updating the groupBy setting on the fly (does not overwrite settings.json):

orphans-4

Toggle using the tree list / tree flat icons:

orphans-5

@leonhfr leonhfr marked this pull request as ready for review January 23, 2021 13:57
Copy link
Collaborator

@riccardoferretti riccardoferretti left a comment

Choose a reason for hiding this comment

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

This looks amazing! I left a few questions, in general I prefer it much more to the command approach

packages/foam-vscode/src/features/orphans.ts Outdated Show resolved Hide resolved
packages/foam-vscode/src/features/orphans.ts Outdated Show resolved Hide resolved
packages/foam-vscode/src/features/orphans.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@riccardoferretti riccardoferretti left a comment

Choose a reason for hiding this comment

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

everything looks good, I just left a question around an event listener disposal.
I think we only need tests and adding the feature to the docs - am I missing anything?

)
);

foam.notes.onDidUpdateNote(() => provider.refresh());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should add this to the subscription? so the listener is properly disposed

@SanketDG
Copy link
Contributor

This looks great, @leonhfr

I just have concern, does this necessarily need to be a pane, given that this just needs to be checked that whether a note is orphaned or not, can we just do a notification message: These are orphaned notes: <Note1> <Note2>

Panes, I personally feel, are for introspection and browsing. Given we willl have Backlinks, Tag Explorer, and Outline in any Foam setup do we need one more?

@leonhfr
Copy link
Contributor Author

leonhfr commented Jan 26, 2021

@SanketDG

I think the point is not to check that a given note is orphaned or not, but to be able to reference all current orphans, so they can be discovered / rediscovered / referenced with others. It does make sense then to use a panel instead of message or other solutions.

Copy link
Collaborator

@riccardoferretti riccardoferretti left a comment

Choose a reason for hiding this comment

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

Fantastic work!

@riccardoferretti riccardoferretti merged commit ea0edc5 into foambubble:master Jan 26, 2021
@riccardoferretti
Copy link
Collaborator

@allcontributors add @leonhfr for code

@allcontributors
Copy link
Contributor

@riccardoferretti

I've put up a pull request to add @leonhfr! 🎉

@leonhfr leonhfr deleted the feature/orphaned-notes branch January 26, 2021 15:09
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.

Feature Request: List all docs and images which are unlinked by others
3 participants