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

Dynamic tags API #291

Open
thehunmonkgroup opened this issue Apr 10, 2021 · 3 comments
Open

Dynamic tags API #291

thehunmonkgroup opened this issue Apr 10, 2021 · 3 comments

Comments

@thehunmonkgroup
Copy link
Member

I think it could be quite handy to have a simple API to apply 'dynamic tags' to tasks while VIT is running.

The key difference from regular tags is that they are not persisted to the task database, and are only retained for the length of a particular VIT session.

Here are two easy use cases:

  1. I've often found myself wanting some kind of short-term visual indicator for lists in some of my reports. Imagine a list of 20-ish tasks in a report, and say when I open VIT, I'd like to scan them once, 'mark' the ones that I want to punch out while I'm at my desk for the next few hours, then easily reference the marked ones as I knock out tasks. I don't need those indicators to be persisted, because they just help to hold the results of my first pass of the task list, in the context of the immediate work I'm doing.
  2. Over at Methods for modifying multiple tasks #240, there's a proposal to use standard TaskWarrior tags as a workaround to 'select' multiple tasks for editing. While this is a brilliant use of the existing tools, it does suffer from some problems:
    1. The TaskWarrior database is managing temporary data in long-term storage. This does things like polluting the sync logs.
    2. The intended temporary data could be mistakenly left during a crash, leading to unexpected results on the next run of VIT. Ideally any temporary data would vanish the moment a VIT run was over, for whatever reason.

We don't have to make this complicated. A simple DynamicTags class with methods like addTag(), addTaskToTag(), removeTaskFromTag(), removeTag(), removeTaskFromTags(), getTagTasks(), getTaskTags(). I bet the entire class could be built in an hour.

Once this class exists, we can add just enough features to begin to make it useful, such as:

  1. Integrate it with markers.
  2. Implement a few actions.
  3. Maybe expose it via keybindings

I'd be willing to write the class itself, it would be nice to get some help integrating it.

Before I do any work, though, would love input on the idea itself.

@kevinstadler
Copy link

Just in terms of the name, reusing 'tag' implies to me that it should be trivially possible to apply a runtime filter for an expression like +somepersistenttag or +somedynamictag, but any expression that mixes persistent and dynamic tags with an or will already not be trivial to support.

I can see a hard-coded (i.e. unnamed) 'multi-select' or 'multi-focus' whose selection/marking persists for the entire runtime being useful, but I wonder if there are enough use cases that would actually require the usage of 2 or more of such dynamic tags within one session to be worth the effort/complexity of a fully-blown named tag system?

@thehunmonkgroup
Copy link
Member Author

It's certainly possible this might be over-engineering the solution, but at the same time, the API I'm proposing seems so straightforward that I don't see a big downside in quickly implementing it and using it for the multi-select.

@thehunmonkgroup
Copy link
Member Author

I'm also not attached to the name 'Dynamic Tags' -- we may come up with one that's more accurate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants