foam icon indicating copy to clipboard operation
foam copied to clipboard

Allow completion for title in create note from template

Open dstengle opened this issue 8 months ago • 3 comments

Is your feature request related to a problem? Please describe.

I use templates that create a note with the date appended to the title in a specific daily directory. For instance I have a 1:1 meeting template where I use the name of the person as a title (and a wikilink inside the note).

Since there is no completion in the create note, I have to remember or copy the name of the person I am meeting with and this is a bit frustrating since I could get different spellings if I'm not careful. This is important because my template creates a wikilink based on name and I can easily cross-reference all of my meetings with someone.

The completion might not normally make sense, but in my case since I append the date the resulting filename will be unique.

Describe the solution you'd like

As a user, I would like the create from template command to allow completion of wikilinks in the title popup.

Describe alternatives you've considered

I've considered calling the command from a macro, but it doesn't appear to take arguments.

Screenshots or Videos

No response

dstengle avatar Dec 04 '23 15:12 dstengle

I don't believe VS Code supports autocompletion in the input box.

My preferred approach to solving your issue is passing arguments to the command. Also, the create-note command does take arguments - see here

Otherwise have individual templates for each person.

You could also (maybe) use a combination of FOAM_TITLE (which you will be prompted to provide) with FOAM_DATE_* variables to achieve what you want.

riccardoferretti avatar Dec 08 '23 19:12 riccardoferretti

I do use the Date already to make a new title from the one passed in to keep them all unique and easy to reference. Basically when I hover over someone's name, I get a dated list of all of the notes where I've mentioned them.

I'll take a look at the command docs. Maybe I could make my own command that takes a link to a person and creates a note from template and overwrites the link with the one for the specific note.

What about drop-down completion like the template selection itself, just like the list of templates or the general command drop-down?

dstengle avatar Dec 11 '23 15:12 dstengle

Yes that would be possible and actually the textbox would kinda mimic an autocomplete, thanks for pointing that out.

This would require some enhancements in the way variables are passed to the template, both to support custom variables (which I have been thinking of doing for some time) and, more critically, to define that a variable need be resolved amongst a list of values (in order to trigger the quickPick.

So, there is a design question to answer (how is such a thing exposed to the user) and the implementation itself. If someone is interested in giving it a go I can provide some pointers/guidance.

riccardoferretti avatar Dec 15 '23 21:12 riccardoferretti