pajoma / vscode-journal

Lightweight journal and simple notes support for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=pajoma.vscode-journal
GNU General Public License v3.0
233 stars 40 forks source link

Use Vscode Snippets instead of own templates #90

Open pajoma opened 3 years ago

pajoma commented 3 years ago

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 commented 3 years ago

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

mameen commented 3 years ago

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!

pajoma commented 2 years ago

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