obsidian-tasks icon indicating copy to clipboard operation
obsidian-tasks copied to clipboard

Adding dependsOn field via auto-suggest rewrites lines with existing IDs unnecessarily

Open claremacrae opened this issue 9 months ago • 1 comments

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:

  1. Create a new note - with any name
  2. Paste in this text
- [ ] #task Step 1 📅 2024-05-15 🆔 step-1
- [ ] #task Step 2
  1. Put the cursor at the end of line 2
  2. Type `[space]dep
  3. Select the depends on option: image
  4. Select Step 1 image

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.

claremacrae avatar May 15 '24 06:05 claremacrae