foam icon indicating copy to clipboard operation
foam copied to clipboard

Add ability to use "advanced new file" interface with "create new note"

Open Lyzod opened this issue 2 years ago • 8 comments

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

This plugin adds the abilty to create a new file and the directory if missing in one go which makes it much easier to create Notes in the places they should be. https://marketplace.visualstudio.com/items?itemName=patbenatar.advanced-new-file

Dendron and Obsidian both let you adapt this to the workflow, not leaving the program and creating everything via CLI and TUI which is more comfortable for most developers. Having to leave the program to create the folder can also produce problems with workspace. The better solution is to create folders from within VS Code.

The current use of advanced new file produces a completely empty file, so neither the new file template nor a sepcilized one can be used.

Describe the solution you'd like

A command eg "advanced new note" lets you choose a directory and creates a sub directory if it doesn't exist. New notes template applies, optionally also one you can choose.

Describe alternatives you've considered

Using Advanced new file plugin as it is, but putting the content in via a snippet is rather inconvenient and can produce errors as you have to typethe file type etc correctly.

Screenshots or Videos

No response

Lyzod avatar Feb 18 '24 08:02 Lyzod

Do I understand correctly that basically what you are asking is that, when inputting the name of the note, you can provide a / divided path, and create it in the process? e.g. my/subdir/The Title of my note

riccardoferretti avatar Feb 19 '24 09:02 riccardoferretti

I think so? It creates the directory if you give it a relative path that doesn't exist. Ideally, it asks you before which existing directory the new note should be created in. You can also create the note without the extra new directory. Depends on the input. It has a nice TUI design.

Lyzod avatar Feb 21 '24 19:02 Lyzod

The way you would achieve some of that is via templates in Foam, but I don't think that's what you are referring to. Yet from the various cases you are describing I am struggling to get the full idea.

IIUC you would like to:

  • when creating a new note, without having set up any specific template, you would normally input the name of the note, and that would resolve based on the currently open file or root, based on configuration
  • if the name of the note contains /, it would be considered a relative (or absolute) path (instead of part of the name of the note)
  • when such "special path-title combo" is used, you would like to see where the note will be created before confirming the operation

Is that about right?

riccardoferretti avatar Feb 22 '24 18:02 riccardoferretti

Sorry for the late continued convo. Life got in the way.

The main difference is that instead of choosing the directory by opening it and then creating a note within, you open a modal specifying the location and using the "new note" behavior in built already in foam with the templates.

I would like to have something similar to this modal/ TUI behavior:

  1. use command "new advanced note"
  2. type in directory or leave empty (root) of existing directories to choose location of the new file
  3. type in the name of the new note OR the relative path of the note (incl the name) as a divided path without needing to specify the file extension (would be cool if there was a way to override, but not necessary imho)
  4. type enter to confirm your entry

This should lead to following behavior:

If there was no divided path given, the note gets created in the chosen existing directory and the foam template gets applied.

If there was a divided part given, the new directory/folder gets created, the new note within that and the foam template gets applied.

Is that a bit clearer now what I mean? Sorry, I am not so good in explaining. I would encourage to look at the new advanced file extension documentation which also shows what I mean without you needing to install it.

Lyzod avatar Mar 14 '24 07:03 Lyzod

Sounds good, thanks for the explanation, will keep this open to see what level of interest is out there for the functionality

riccardoferretti avatar Mar 15 '24 10:03 riccardoferretti