~havi/nvim.d

ba47fc419422c8aba8cc4544b0d276287c408aaa — havi 4 months ago 4d28a50
style(snippets/json): fix formatting
M lua/snippets/json/hcl.json => lua/snippets/json/hcl.json +11 -12
@@ 2,16 2,15 @@
  "Synopsis": {
    "prefix": "comment",
    "body": [
"# ─── NOTE ───────────────────────────────────────────────────────────────────────",
"# $1",
"# ─── SNIPPETS ───────────────────────────────────────────────────────────────────",
"# $2",
"# ─── REFERENCES ─────────────────────────────────────────────────────────────────",
"# - $3",
"# ────────────────────────────────────────────────────────────────────────────────",
"$0",
        ],
      "# ─── NOTE ───────────────────────────────────────────────────────────────────────",
      "# $1",
      "# ─── SNIPPETS ───────────────────────────────────────────────────────────────────",
      "# $2",
      "# ─── REFERENCES ─────────────────────────────────────────────────────────────────",
      "# - $3",
      "# ────────────────────────────────────────────────────────────────────────────────",
      "$0"
    ],
    "description": "Comment for resource"
    }
}

  }
}
\ No newline at end of file

M lua/snippets/json/lua.json => lua/snippets/json/lua.json +1 -1
@@ 185,7 185,7 @@
  },
  "select": {
    "body": "select(${1:index}, ${2:...})",
    "description": "5.1,5.2,5.3\n\nselect (index, \u00b7\u00b7\u00b7)",
    "description": "5.1,5.2,5.3\n\nselect (index, ···)",
    "prefix": "select",
    "scope": "source.lua"
  },

M lua/snippets/json/markdown.json => lua/snippets/json/markdown.json +1 -3
@@ 47,7 47,6 @@
    ],
    "description": "Feature Request Template"
  },

  "Backlog Bug Report": {
    "prefix": "backlog-bug-report",
    "body": [


@@ 119,7 118,6 @@
    ],
    "description": "Task Template"
  },

  "Backlog Test Case": {
    "prefix": "backlog-test-case",
    "body": [


@@ 150,4 148,4 @@
    ],
    "description": "Test Case Template"
  }
}
}
\ No newline at end of file

M lua/snippets/json/package.json => lua/snippets/json/package.json +5 -2
@@ 41,7 41,10 @@
        "path": "./react-ts.json"
      },
      {
        "language": ["react","javascript"],
        "language": [
          "react",
          "javascript"
        ],
        "path": "./react.json"
      },
      {


@@ 50,4 53,4 @@
      }
    ]
  }
}
}
\ No newline at end of file

M lua/snippets/json/react-ts.json => lua/snippets/json/react-ts.json +18 -6
@@ 1,11 1,15 @@
{
  "destructuring of props": {
    "prefix": "dp",
    "body": ["const { ${1:name} } = this.props"]
    "body": [
      "const { ${1:name} } = this.props"
    ]
  },
  "destructuring of state": {
    "prefix": "ds",
    "body": ["const { ${1:name} } = this.state"]
    "body": [
      "const { ${1:name} } = this.state"
    ]
  },
  "reactClassCompoment": {
    "prefix": "rcc",


@@ 289,7 293,11 @@
  },
  "useEffect": {
    "prefix": "ue",
    "body": ["useEffect(() => {", "\t$1", "}, [${3:dependencies}])$0"],
    "body": [
      "useEffect(() => {",
      "\t$1",
      "}, [${3:dependencies}])$0"
    ],
    "description": "React useEffect() hook"
  },
  "useEffect with cleanup": {


@@ 315,12 323,16 @@
  },
  "useContext": {
    "prefix": "uc",
    "body": ["const $1 = useContext($2)$0"],
    "body": [
      "const $1 = useContext($2)$0"
    ],
    "description": "React useContext() hook"
  },
  "useRef": {
    "prefix": "ur",
    "body": ["const ${1:elName}El = useRef(null)$0"],
    "body": [
      "const ${1:elName}El = useRef(null)$0"
    ],
    "description": "React useContext() hook"
  },
  "useCallback": {


@@ 342,4 354,4 @@
    ],
    "description": "React useMemo() hook"
  }
}
}
\ No newline at end of file

M lua/snippets/json/react.json => lua/snippets/json/react.json +5 -6
@@ 1,11 1,10 @@
{
  "React Component": {
  "prefix": "react-component",
  "body": [
    "prefix": "react-component",
    "body": [
      "import React, { useState, useEffect } from \"react\";",
      "",
      "const ${1:${2:NameOfComponent}${3:$TM_FILENAME_BASE}}} = () => {",
      
      "  return (",
      "    <>",
      "       ${4:<div>Hello World</div>}",


@@ 14,7 13,7 @@
      "};",
      "",
      "export default $1;"
      ],
  "description": "Task Template"
}
    ],
    "description": "Task Template"
  }
}
\ No newline at end of file

M lua/snippets/json/toml.json => lua/snippets/json/toml.json +9 -9
@@ 2,13 2,13 @@
  "Rust Binary Path": {
    "prefix": "rs-bin",
    "body": [
        "[[bin]]",
        "name = \"$1\"",
        "path = \"src/$2\"",
        "test = ${3:false}",
        "doctest = ${4:false}",
        "$0"
        ],
      "[[bin]]",
      "name = \"$1\"",
      "path = \"src/$2\"",
      "test = ${3:false}",
      "doctest = ${4:false}",
      "$0"
    ],
    "description": "Rust Binary target settings"
    }  
}
  }
}
\ No newline at end of file

M lua/snippets/json/typescript.json => lua/snippets/json/typescript.json +104 -22
@@ 1,7 1,15 @@
{
  "Constructor": {
    "prefix": "ctor",
    "body": ["/**", " *", " */", "constructor() {", "\tsuper();", "\t$0", "}"],
    "body": [
      "/**",
      " *",
      " */",
      "constructor() {",
      "\tsuper();",
      "\t$0",
      "}"
    ],
    "description": "Constructor"
  },
  "Class Definition": {


@@ 17,17 25,30 @@
  },
  "Public Method Definition": {
    "prefix": "public method",
    "body": ["/**", " * ${1:name}", " */", "public ${1:name}() {", "\t$0", "}"],
    "body": [
      "/**",
      " * ${1:name}",
      " */",
      "public ${1:name}() {",
      "\t$0",
      "}"
    ],
    "description": "Public Method Definition"
  },
  "Private Method Definition": {
    "prefix": "private method",
    "body": ["private ${1:name}() {", "\t$0", "}"],
    "body": [
      "private ${1:name}() {",
      "\t$0",
      "}"
    ],
    "description": "Private Method Definition"
  },
  "Import external module.": {
    "prefix": "import statement",
    "body": ["import { $0 } from \"${1:module}\";"],
    "body": [
      "import { $0 } from \"${1:module}\";"
    ],
    "description": "Import external module."
  },
  "Property getter": {


@@ 43,17 64,26 @@
  },
  "Log to the console": {
    "prefix": "log",
    "body": ["console.log($1);", "$0"],
    "body": [
      "console.log($1);",
      "$0"
    ],
    "description": "Log to the console"
  },
  "Log warning to console": {
    "prefix": "warn",
    "body": ["console.warn($1);", "$0"],
    "body": [
      "console.warn($1);",
      "$0"
    ],
    "description": "Log warning to the console"
  },
  "Log error to console": {
    "prefix": "error",
    "body": ["console.error($1);", "$0"],
    "body": [
      "console.error($1);",
      "$0"
    ],
    "description": "Log error to the console"
  },
  "Define a full property": {


@@ 73,7 103,10 @@
  },
  "Triple-slash reference": {
    "prefix": "ref",
    "body": ["/// <reference path=\"$1\" />", "$0"],
    "body": [
      "/// <reference path=\"$1\" />",
      "$0"
    ],
    "description": "Triple-slash reference"
  },
  "Property setter": {


@@ 89,7 122,10 @@
  },
  "Throw Exception": {
    "prefix": "throw",
    "body": ["throw \"$1\";", "$0"],
    "body": [
      "throw \"$1\";",
      "$0"
    ],
    "description": "Throw Exception"
  },
  "For Loop": {


@@ 104,7 140,11 @@
  },
  "For-Each Loop using =>": {
    "prefix": "foreach =>",
    "body": ["${1:array}.forEach(${2:element} => {", "\t$0", "});"],
    "body": [
      "${1:array}.forEach(${2:element} => {",
      "\t$0",
      "});"
    ],
    "description": "For-Each Loop using =>"
  },
  "For-In Loop": {


@@ 121,27 161,47 @@
  },
  "For-Of Loop": {
    "prefix": "forof",
    "body": ["for (const ${1:iterator} of ${2:object}) {", "\t$0", "}"],
    "body": [
      "for (const ${1:iterator} of ${2:object}) {",
      "\t$0",
      "}"
    ],
    "description": "For-Of Loop"
  },
  "Function Statement": {
    "prefix": "function",
    "body": ["function ${1:name}(${2:params}:${3:type}) {", "\t$0", "}"],
    "body": [
      "function ${1:name}(${2:params}:${3:type}) {",
      "\t$0",
      "}"
    ],
    "description": "Function Statement"
  },
  "If Statement": {
    "prefix": "if",
    "body": ["if (${1:condition}) {", "\t$0", "}"],
    "body": [
      "if (${1:condition}) {",
      "\t$0",
      "}"
    ],
    "description": "If Statement"
  },
  "If-Else Statement": {
    "prefix": "ifelse",
    "body": ["if (${1:condition}) {", "\t$0", "} else {", "\t", "}"],
    "body": [
      "if (${1:condition}) {",
      "\t$0",
      "} else {",
      "\t",
      "}"
    ],
    "description": "If-Else Statement"
  },
  "New Statement": {
    "prefix": "new",
    "body": ["const ${1:name} = new ${2:type}(${3:arguments});$0"],
    "body": [
      "const ${1:name} = new ${2:type}(${3:arguments});$0"
    ],
    "description": "New Statement"
  },
  "Switch Statement": {


@@ 160,32 220,54 @@
  },
  "While Statement": {
    "prefix": "while",
    "body": ["while (${1:condition}) {", "\t$0", "}"],
    "body": [
      "while (${1:condition}) {",
      "\t$0",
      "}"
    ],
    "description": "While Statement"
  },
  "Do-While Statement": {
    "prefix": "dowhile",
    "body": ["do {", "\t$0", "} while (${1:condition});"],
    "body": [
      "do {",
      "\t$0",
      "} while (${1:condition});"
    ],
    "description": "Do-While Statement"
  },
  "Try-Catch Statement": {
    "prefix": "trycatch",
    "body": ["try {", "\t$0", "} catch (${1:error}) {", "\t", "}"],
    "body": [
      "try {",
      "\t$0",
      "} catch (${1:error}) {",
      "\t",
      "}"
    ],
    "description": "Try-Catch Statement"
  },
  "Set Timeout Function": {
    "prefix": "settimeout",
    "body": ["setTimeout(() => {", "\t$0", "}, ${1:timeout});"],
    "body": [
      "setTimeout(() => {",
      "\t$0",
      "}, ${1:timeout});"
    ],
    "description": "Set Timeout Function"
  },
  "Region Start": {
    "prefix": "#region",
    "body": ["//#region $0"],
    "body": [
      "//#region $0"
    ],
    "description": "Folding Region Start"
  },
  "Region End": {
    "prefix": "#endregion",
    "body": ["//#endregion"],
    "body": [
      "//#endregion"
    ],
    "description": "Folding Region End"
  }
}
}
\ No newline at end of file