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

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

Closed
2 of 7 tasks
claremacrae opened this issue May 15, 2024 · 0 comments · Fixed by #2877
Closed
2 of 7 tasks
Labels
scope: auto-suggest The pop-up menu that helps with editing tasks directly in markdown notes scope: task dependencies Anything to do with making tasks aware of other tasks type: bug Something isn't working

Comments

@claremacrae
Copy link
Collaborator

Please check that this issue hasn't been reported before.

  • 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:

const dependsOnRegex = new RegExp(`(${dependsOnSymbol})([0-9a-zA-Z-_ ^,]*,)*([0-9a-zA-Z ^,]*)`, 'ug');

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
  • 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 claremacrae added type: bug Something isn't working scope: auto-suggest The pop-up menu that helps with editing tasks directly in markdown notes scope: task dependencies Anything to do with making tasks aware of other tasks labels May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: auto-suggest The pop-up menu that helps with editing tasks directly in markdown notes scope: task dependencies Anything to do with making tasks aware of other tasks type: bug Something isn't working
Projects
Status: 🎉 Released
1 participant