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

fix: detect changes in query file path and query properties #3281

Merged
merged 19 commits into from
Jan 20, 2025

Conversation

claremacrae
Copy link
Collaborator

@claremacrae claremacrae commented Jan 20, 2025

Types of changes

Changes visible to users:

Internal changes:

  • Tests (prefix: test - additions and improvements to unit tests and the smoke tests)

Description

Summary: This is all about making the following features releasable, by fixing bugs in the initial implementation and adding documentation:

Detail:

  1. When the user edits any Obsidian properties in the query file, refresh the query, in case any frontmatter properties were used in the query
  2. When the user moves or renames the file containing the query, refresh the query, in case the query's path used in the query, such as via placeholders
  3. Add some initial documentation for query.file.hasProperty() and query.file.property()

Motivation and Context

This builds on the following PRs:

They enabled queries to access query.file.hasProperty() and query.file.property(), but with the major limitation that the query file had to be re-opened for the changes to take effect.

How has this been tested?

  • Automated tests, where possible.
  • Lots of exploratory testing

Screenshots (if appropriate)

Video coming soon

Checklist

Terms

@claremacrae claremacrae added scope: filters Additions and modifications to the search filters scope: scripting Issues to do with custom filters, custom sorting and similar labels Jan 20, 2025
@claremacrae claremacrae added the scope: documentation Improvements or additions to documentation label Jan 20, 2025
@claremacrae claremacrae merged commit f4d18e1 into main Jan 20, 2025
4 checks passed
@claremacrae claremacrae deleted the fix-detect-query-property-edits branch January 20, 2025 21:55
@holroy
Copy link

holroy commented Jan 21, 2025

I just came looking for the possibility to do path includes {{query.file.property(...)}}, and found you were working on it. I did however discover that the documentation says Tasks X.Y.Z in the current code base, is that something which is automatically updated by your build scripts?

@claremacrae
Copy link
Collaborator Author

Hi @holroy....

Current status

yes, that's right. The release script updates the version number, as it's only at that point I know if it's going to be a minor, major or breaking version number.

There's a lot to do before the next release, so I don't know when it will be.

Request for feedback

However, I do have a favour to ask of you.

Would you be willing to try out a build of Tasks with this code in for a few days - and give me feedback on the docs and the behaviour please?

I am confident enough in the code to be using it in my own vault, and it is working pretty well.

Getting the latest build

The build is here:
https://github.com/obsidian-tasks-group/obsidian-tasks/actions/runs/12876584302

The files in the build are described here:
https://publish.obsidian.md/tasks-contributing/Testing/How+do+I+test+a+GitHub+build+of+the+Tasks+plugin

Please note any feedback as comments on this PR - and also, if you have any example uses that would be good for the docs, that would be welcome too.

@claremacrae claremacrae changed the title Fix detect query property edits fix: detect changes in query file path and query properties Jan 23, 2025
claremacrae added a commit that referenced this pull request Jan 23, 2025
In #3281 I made the query refresh when its path changes,
to update the effects of any placeholders.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: documentation Improvements or additions to documentation scope: filters Additions and modifications to the search filters scope: scripting Issues to do with custom filters, custom sorting and similar
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants