Skip to content

Conversation

@platers
Copy link
Contributor

@platers platers commented Dec 30, 2020

Plugin to keep track of deadlines

Creates a "Deadlines" node at the root.
All nodes with deadlines will be automatically cloned in the Deadlines node in sorted order
Add a deadline to a node by adding a child of the form "due YYYY-MM-DD" or "due MM-DD"
Capture

Copy link
Owner

@WuTheFWasThat WuTheFWasThat left a comment

Choose a reason for hiding this comment

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

thanks for working on this!

BTW, related plugin, in case you haven't seen: #300

never ended up merging it though

}
}

private async getNodeWithText(root: Path, text: String): Promise<Path | null> {
Copy link
Owner

Choose a reason for hiding this comment

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

for efficiency, you could consider using the Marks feature

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I dont think its worth it to change it since this function is used in other places for error checking. Nodes probably don't have many children.

Copy link
Owner

Choose a reason for hiding this comment

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

it's only ever used to search for "deadlines" right?

some other benefits:

  • you can have the deadlines node wherever you want, instead of at the document root
  • uniqueness is guaranteed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah you're right. I'm having trouble figuring out how to check if the mark exists. I see theres a public method listMarks but I don't know how to call it.

Copy link
Owner

Choose a reason for hiding this comment

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

ahh, yeah, sorry! I think I need to add something to PluginAPI so that you can access other plugins. let me try briefly, the daily notes plugin has a similar issue

Copy link
Owner

Choose a reason for hiding this comment

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

i added a way to do this, see bb6c81e

let me know if you have questions, it's totally new so not very tested

// check if row is in top level of deadlines
this.log('inDeadlines', row);
const root = await this.getDeadlinesRoot();
const children = await this.getChildren(root);
Copy link
Owner

Choose a reason for hiding this comment

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

might be slightly better to check getParents of row instead

@platers
Copy link
Contributor Author

platers commented Dec 30, 2020

Thanks, I didn't see #300. A fuller featured todo plugin would be great, I might work on that later. I guess #249 would have to come first though.

private async setMark(path: Path, mark: string) {
this.log('setMark', path, mark);
let info = await this.api.session.document.getInfo(path.row);
if (info.pluginData && info.pluginData.marks && info.pluginData.marks.mark !== mark) {
Copy link
Owner

Choose a reason for hiding this comment

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

when would this happen?

@WuTheFWasThat
Copy link
Owner

took a quick look and this looks better now! is it ready for merge?

@platers
Copy link
Contributor Author

platers commented Jan 6, 2021

yup thanks for the help!

@WuTheFWasThat WuTheFWasThat merged commit db4c051 into WuTheFWasThat:master Jan 6, 2021
@platers platers deleted the deadlines branch March 24, 2021 04:26
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