obsidian-tasks
obsidian-tasks copied to clipboard
Adding dependsOn field via auto-suggest rewrites lines with existing IDs unnecessarily
Please check that this issue hasn't been reported before.
- [X] I searched previous Bug Reports didn't find any similar reports.
Expected Behavior
Given this starting state...
- [ ] #task Step 1 📅 2024-05-15 🆔 step-1
- [ ] #task Step 2
... when I use auto-suggest to make Step 2 depend on Step 1, I expect the Step 1 line not to be modified.
So after adding the dependency, I expect this output:
- [ ] #task Step 1 📅 2024-05-15 🆔 step-1
- [ ] #task Step 2 ⛔ step-1
Current behaviour
Line 1 is rewritten, with a different field order:
- [ ] #task Step 1 🆔 step-1 📅 2024-05-15
- [ ] #task Step 2 ⛔ step-1
Steps to reproduce
With a build of Tasks that has the un-released addition of dependencies to auto-select present:
- Create a new note - with any name
- Paste in this text
- [ ] #task Step 1 📅 2024-05-15 🆔 step-1
- [ ] #task Step 2
- Put the cursor at the end of line 2
- Type `[space]dep
- Select the
depends on
option: - Select Step 1
See above for Expected and Actual...
Which Operating Systems are you using?
- [ ] Android
- [ ] iPhone/iPad
- [ ] Linux
- [X] macOS
- [ ] Windows
Obsidian Version
1.6.0
Tasks Plugin Version
pre-7.2.0 development release
Checks
- [X] I have tried it with all other plugins disabled and the error still occurs
Possible solution
Change the auto-suggest code so that it does not rewrite any task lines being depended on, when they already have an ID.