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

Auto-suggest for dependencies restricts the characters that can be used when filtering task descriptions

Open claremacrae opened this issue 9 months ago • 0 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

When using auto-suggest to add tasks to the dependsOn field, I would sometimes like to use hyphen, underscore and punctuation in my searches.

Other users may want to search for letters with accents, non-Latin characters.

Current behaviour

The characters recognised when searching task descriptions are defined here:

https://github.com/obsidian-tasks-group/obsidian-tasks/blob/bcee94a9e5eaa32a3dd2068de56824bb2878c3d2/src/Suggestor/Suggestor.ts#L446

The current options are: [0-9a-zA-Z ^,]

Steps to reproduce

  1. Create a note in Obsidian
  2. Paste in these lines
- [ ] #task Book the café
- [ ] #task Pay the café
  1. Put the cursor at end of second line
  2. Type [space]dep
  3. Select the 'depends on' option
  4. Type caf - note that first task is in the suggestions list
  5. Type é - note that the first task disappears from the suggestions list

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

  • [ ] I have tried it with all other plugins disabled and the error still occurs

Possible solution

I tried just increasing the range of characters allowed in the above regex, but then found that if the cursor was after dependsOnin the middle of an existing line, such as with a due date afterwards, the later text in the line was included in the filtering of tasks to add to the suggest drop-down, which usually meant that no tasks were found.

I think the regex is going to need to be changed to something like:

  • Allow any character except:
    • Any of the emojis used by Tasks
    • []() in case it's dataview format

This is going to be rather hard to write automated tests for, due to all the positioning of cursors required...

claremacrae avatar May 15 '24 06:05 claremacrae