},
{
text: 'Cookbook',
- collapsible: true,
collapsed: false,
items: [
{
text: 'Composing Stores',
link: '/cookbook/composing-stores.html',
},
+ {
+ text: 'VSCode Snippets',
+ link: '/cookbook/vscode-snippets.html',
+ },
+ {
+ text: 'Migration from Vuex',
+ link: '/cookbook/migration-vuex.html',
+ },
{
text: 'Migration from v0/v1 to v2',
link: '/cookbook/migration-v1-v2.html',
--- /dev/null
+# VSCode Snippets
+
+These are some snippets that I use in VSCode to make my life easier.
+
+Manage user snippets with <kbd>⇧</kbd> <kbd>⌘</kbd> <kbd>P</kbd> / <kbd>Ctrl</kbd> <kbd>⇧</kbd> <kbd>P</kbd> and then `Snippets: Configure User Snippets`.
+
+```json
+{
+ "Pinia Options Store Boilerplate": {
+ "scope": "javascript,typescript",
+ "prefix": "pinia-options",
+ "body": [
+ "import { defineStore, acceptHMRUpdate } from 'pinia'",
+ "",
+ "export const use${TM_FILENAME_BASE/^(.*)$/${1:/pascalcase}/}Store = defineStore('$TM_FILENAME_BASE', {",
+ " state: () => ({",
+ " $0",
+ " }),",
+ " getters: {},",
+ " actions: {},",
+ "})",
+ "",
+ "if (import.meta.hot) {",
+ " import.meta.hot.accept(acceptHMRUpdate(use${TM_FILENAME_BASE/^(.*)$/${1:/pascalcase}/}Store, import.meta.hot))",
+ "}",
+ ""
+ ],
+ "description": "Bootstrap the code needed for a Vue.js Pinia Options Store file"
+ },
+ "Pinia Setup Store Boilerplate": {
+ "scope": "javascript,typescript",
+ "prefix": "pinia-setup",
+ "body": [
+ "import { defineStore, acceptHMRUpdate } from 'pinia'",
+ "",
+ "export const use${TM_FILENAME_BASE/^(.*)$/${1:/pascalcase}/}Store = defineStore('$TM_FILENAME_BASE', () => {",
+ " $0",
+ " return {}",
+ "})",
+ "",
+ "if (import.meta.hot) {",
+ " import.meta.hot.accept(acceptHMRUpdate(use${TM_FILENAME_BASE/^(.*)$/${1:/pascalcase}/}Store, import.meta.hot))",
+ "}",
+ ""
+ ],
+ "description": "Bootstrap the code needed for a Vue.js Pinia Setup Store file"
+ }
+}
+```