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

Creating a note from a template via wikilink doesn't work if the template has a custom filepath #1327

Closed
JosNun opened this issue Jan 26, 2024 · 3 comments · Fixed by #1344
Closed
Labels
bug Something isn't working foam-vscode Foam for VSCode extension in packages/foam-vscode
Milestone

Comments

@JosNun
Copy link

JosNun commented Jan 26, 2024

Describe the bug

When using the tooltip to create a note from a template, and the template has a filepath specified, the wikilink is not linked up. I assume this is because the filepath no longer matches the text in the wikilink.

Small Reproducible Example

No response

Steps to Reproduce the Bug or Issue

  • Create a template that changes the filepath of notes created with it
  • Create a wikilink, and use the hover tooltip "Create note from template" option to create the note
  • Note is created with the correct filename, but the wikilink is not updated with the right name

Example Template:

---
foam_template:
  name: 'Example Template'
  description: 'An example for reproducing a bug'
  filepath: '$FOAM_DATE_DATE-$FOAM_SLUG.md'
---

Expected behavior

The text of the wikilink should be updated to match the new notes title.
For example:

  • Given a wikilink [[test]], and a template that creates a file named 2024-01-26-test.md
  • I would expect that the wikilink gets updated to either [[2024-01-26-test]], (test)[2024-01-26-test] (probably not accurate, since it creates a markdown link instead of a wikilink), or create a link reference definitioon at the bottom of the page

Screenshots or Videos

Screen.Recording.2024-01-26.at.9.50.06.AM.mov

Operating System Version

macOS 14.3

Visual Studio Code Version

1.85.2 (Universal)

Additional context

No response

@riccardoferretti
Copy link
Collaborator

Thanks for the clear bug report.
Yes, this definitely needs to be addressed, the expected behavior is that the wikilink will point to the new note using the appropriate Foam Identifier.

@riccardoferretti riccardoferretti added bug Something isn't working foam-vscode Foam for VSCode extension in packages/foam-vscode labels Jan 26, 2024
@riccardoferretti riccardoferretti added this to the backlog milestone Jan 26, 2024
@JosNun
Copy link
Author

JosNun commented Jan 26, 2024

For posterity sake, a good spot to start reverse-engineering this would be taking a look at where it's implemented https://github.com/foambubble/foam/pull/1061/files

@riccardoferretti
Copy link
Collaborator

Fixed in 0.25.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working foam-vscode Foam for VSCode extension in packages/foam-vscode
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants