Templater
Templater copied to clipboard
Docs don't show which functions return a Promise and need `await`
Plugin information (please complete the following information):
- Templater version: 1.12.0
Describe the bug
The API docs don't specify which functions are async (i.e., return a Promise), and thus require the use of await
.
Expected behavior
All API functions should have a **Returns**
section which is clear whether a Promise is returned or the expected content.
Example: https://silentvoid13.github.io/Templater/internal-functions/internal-modules/file-module.html#tpfileincludeinclude_link-string--tfile
Screenshots If applicable, add screenshots to help explain your problem.
Additional context
Examples of confusion:
- https://github.com/SilentVoid13/Templater/issues/445#issuecomment-1059815715
- https://github.com/SilentVoid13/Templater/discussions/320#discussioncomment-3292361
Would you mind adding it to the docs? They could use some love.
Interestingly, tp.file.exists
, which calls app.vault.exists
, just switched from sync to async in Obsidian v0.16.3
Yeahhhhh it was using a sync method that didn't account for folders, so I changed it.
I tested it without an await
and was getting results so thought I dodged a breaking change bullet, but it was a pretty basic test.