vscode-journal icon indicating copy to clipboard operation
vscode-journal copied to clipboard

Use Vscode Snippets instead of own templates

Open pajoma opened this issue 3 years ago • 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.

pajoma avatar Jul 08 '21 08:07 pajoma

@mameen is this approach a solution for your idea in https://github.com/pajoma/vscode-journal/issues/19#issuecomment-870177168?

pajoma avatar Jul 08 '21 08:07 pajoma

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!

mameen avatar Jul 09 '21 02:07 mameen

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

pajoma avatar Apr 28 '22 19:04 pajoma