pajoma/vscode-journal

Use Vscode Snippets instead of own templates

Opened this issue · 3 comments

The extension already defines snippets, which are added the global user snippets. The snippets have names, which we could also reference in the settings.

So instead of

 "journal.templates": [
    {
      "name": "memo", 
      "template": "- ${d:HHmm}: ${input}", 
      "after": "## Notes"
    }
  ]

we would write

 "journal.templates": [
    {
      "name": "memo", 
      "snippet": "Add memo"
      "after": "## Notes"
    }
  ]

with the snippet

{
    "Add memo": {
        "prefix": "memo",
        "body": [
            "- Memo: $CURRENT_HOUR:$CURRENT_MINUTE ${1:description}"
        ],
        "description": "Snippet for adding a new memo"
    }
}

We still need the template definition to configure where the generate snippet has to be inserted, but we could get rid of the formatting instructions.

@mameen is this approach a solution for your idea in #19 (comment)?

regarding where to insert the snippet I just use Ctrl+SPACE in the place I want to add it.. and all snippets that apply show up! sorry if this is already a known fact! just my 2 cents!

I can't find any api to access the available snippets (which I would need to access to inject the tasks, memos, etc.).