]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
docs: add vscode snippets
authorEduardo San Martin Morote <posva13@gmail.com>
Wed, 7 Jun 2023 10:06:51 +0000 (12:06 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Wed, 7 Jun 2023 10:06:51 +0000 (12:06 +0200)
packages/docs/.vitepress/config/en.ts
packages/docs/.vitepress/config/zh.ts
packages/docs/.vitepress/theme/styles/vars.css
packages/docs/cookbook/vscode-snippets.md [new file with mode: 0644]

index 13e55dcb712fb65e73bd27a7ab84c39ab613da08..f6ac8759667a9319b9749901a977849a517faf12 100644 (file)
@@ -104,7 +104,6 @@ export const enConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
         },
         {
           text: 'Cookbook',
-          collapsible: true,
           collapsed: false,
           items: [
             {
@@ -131,6 +130,14 @@ export const enConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
               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',
index aa9ddaf57f08e6f7445b2bb3893a930d3e50b8b3..e456e2ef764bfb18dfa2a5250c7e3549f9f71e70 100644 (file)
@@ -112,7 +112,6 @@ export const zhConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
         },
         {
           text: '手册',
-          collapsible: true,
           collapsed: false,
           items: [
             {
index 082cd485cbaf90614036f89f985f4731b201aa4f..212e7a45e47ebd6e9bcb79d7e8a1fda0da136014 100644 (file)
@@ -87,6 +87,7 @@ html.dark:root {
 
   --vp-c-bg: var(--vp-c-black);
   --vp-c-bg-soft: var(--vp-c-black-light);
+  --vp-c-bg-soft-up: var(--vp-c-black-lighter);
   --vp-c-bg-mute: var(--vp-c-black-light);
   --vp-c-bg-soft-mute: var(--vp-c-black-lighter);
   --vp-c-bg-alt: #0d121b;
diff --git a/packages/docs/cookbook/vscode-snippets.md b/packages/docs/cookbook/vscode-snippets.md
new file mode 100644 (file)
index 0000000..cdd714d
--- /dev/null
@@ -0,0 +1,49 @@
+# 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"
+  }
+}
+```