foambubble / foam

A personal knowledge management and sharing system for VSCode
https://foambubble.github.io/
Other
15.41k stars 661 forks source link

Foam always asks for a title when creating a new note from template #1243

Open redactedscribe opened 1 year ago

redactedscribe commented 1 year ago

Describe the bug

According to the documentation (and I think it was also previously and recently possible), Foam should only prompt for a title when using the variables FOAM_TITLE, FOAM_TITLE_SAFE, or FOAM_SLUG, but this is not the case.

Small Reproducible Example

No response

Steps to Reproduce the Bug or Issue

  1. Use the Create New Template command.
  2. Delete its contents.
  3. Save the file.
  4. Use the Create New Note From Template command.
  5. Foam prompts the user for a title when it should not.

Expected behavior

At step 5, create the note based upon the template without asking for a title unless the previously mentioned variables were used. The user can then save the new file manually.

Screenshots or Videos

No response

Operating System Version

Visual Studio Code Version

VSCodium 1.78.2

Additional context

No response

riccardoferretti commented 1 year ago

If you don't provide a file path Foam will ask for a title to name the file - have you tried that?

redactedscribe commented 1 year ago

If you don't provide a file path Foam will ask for a title to name the file - have you tried that?

I think I was misremembering. Right, if I have a filepath set in the template, no title is asked for.

I guess I was hoping for a way to open a new VS Code editor (tab) with the contents of the template evaluated by Foam without it being saved to a file. This way I can choose to save it in a directory of my choosing without having to have it predefined in a template. This also gives one the chance to decide upon the name after having started writing; as you might know, detailing a bug report can often change the initial title once the details have been better understood.

Also, using the Create New Note command has the same issue for me: It just creates the file in the workspace's root (not in the active file's directory which I believe the documentation states that it should) and this isn't ideal. In both cases just opening a new tab with the template / new note contents already present would be more flexible for me.

riccardoferretti commented 1 year ago

I guess I was hoping for a way to open a new VS Code editor (tab) with the contents of the template evaluated by Foam without it being saved to a file.

This is a really good idea, I wanna think about it

Also, using the Create New Note command has the same issue for me: It just creates the file in the workspace's root

There is a setting for that. If it doesn't work create a new issue as I want to issues to be single-topic so it easier to keep track of things.

redactedscribe commented 1 year ago

I guess I was hoping for a way to open a new VS Code editor (tab) with the contents of the template evaluated by Foam without it being saved to a file.

This is a really good idea, I wanna think about it

In my opinion, the flow I suggest for creating templates is what I'd expect to be the default, but it probably only makes sense being so when someone is using a hierarchical directory system (myself) rather than a flatter or flat one as is commonly recommended for PKMSes. Should Foam take a position on which organisational system should be used, if not, a flow that accommodates both equally would be a good balance to strike.

I also question why we avoid the OS's Save As dialogue window with the current way that note creation works. Is there a reason why we use that small pop-up for defining the new note's name? From my black-box perspective, it doesn't seem to serve a purpose and lacks all the niceties provided by a Save As dialogue window.

Hopefully these comments add to your thinking process.

redactedscribe commented 1 year ago

This is a really good idea, I wanna think about it

I think it would also be useful if the two Create New Note commands were accessible via VS Code's Explorer Folders panel. We could browse to the desired location, right-click and select New Note From Template for example.

Perhaps it's also possible to intercept the New File button action and offer these commands? If so, please also offer the standard VS Code option too (i.e. a blank file, nothing special):

2023-07-16_15-14-08

RasmusB commented 1 month ago

I'm not sure if this is 100% on-topic, but I think it is related. Sorry if it is not.

For some templates, I want the title popup to be auto populated with a suggested title. For example, I'd like one of my templates to generate a file with the current date and a generic name - for example '2024-09-17 - Time report'.

The document title itself is correctly populated, but can the suggestion in the title popup also be customized?