抄了一个 vscode Python postfix template, 大家帮忙看下

2019-03-19 15:41:47 +08:00
 chenqh

抄了一个 vscode python postfix template, 大家帮忙看下,有什么 bug 可以提,虽然我不一定改得了

https://marketplace.visualstudio.com/items?itemName=cqh.postfix-template-py

我的 customTemplates

"postfix-py.customTemplates": [{
        "name": "self",
        "body": "self.{{expr}} = {{expr}}",
        "description": "self",
        "when": [
          "identifier", "unary-expression", "binary-expression", "expression", "function-call"
        ]
      },
      {
        "name": "apply_self",
        "body": "{{expr}} = self.{{expr}}",
        "description": "apply self",
        "when": [
          "identifier", "unary-expression", "binary-expression", "expression", "function-call"
        ]
      },
      {
        "name": "apply",
        "body": "{{expr}} = {{expr}}",
        "description": "apply",
        "when": [
          "identifier", "unary-expression", "binary-expression", "expression", "function-call"
        ]
      },
      {
        "name": "none",
        "body": "{{expr}}, self.{{expr}} = self.{{expr}}, None",
        "description": "self value none",
        "when": [
          "identifier", "unary-expression", "binary-expression", "expression", "function-call"
        ]
      },
      {
        "name": "raise",
        "body": "raise {{expr}}",
        "description": "raise ",
        "when": [
          "identifier", "unary-expression", "binary-expression", "expression", "function-call"
        ]
      },
      {
        "name": "n",
        "body": "{{expr}} is None",
        "description": "is None",
        "when": [
          "identifier", "unary-expression", "binary-expression", "expression", "function-call"
        ]
      },
      {
        "name": "nn",
        "body": "{{expr}} is not None",
        "description": "is not None",
        "when": [
          "identifier", "unary-expression", "binary-expression", "expression", "function-call"
        ]
      },
      {
        "name": "str",
        "body": "str({{expr}})",
        "description": "double expr",
        "when": [
          "identifier", "unary-expression", "binary-expression", "expression", "function-call"
        ]
      },
      {
        "name": "len",
        "body": "len({{expr}})",
        "description": "double expr",
        "when": [
          "identifier", "unary-expression", "binary-expression", "expression", "function-call"
        ]
      },
      {
        "name": "apply_none",
        "body": "{{expr}} = None",
        "description": "apply none value",
        "when": [
          "identifier", "unary-expression", "binary-expression", "expression", "function-call"
        ]
      },
      {
        "name": "apply_true",
        "body": "{{expr}} = True",
        "description": "apply true value",
        "when": [
          "identifier", "unary-expression", "binary-expression", "expression", "function-call"
        ]
      },
      {
        "name": "apply_false",
        "body": "{{expr}} = False",
        "description": "apply false value",
        "when": [
          "identifier", "unary-expression", "binary-expression", "expression", "function-call"
        ]
      },
      {
        "name": "apply_dict",
        "body": "{{expr}} = {}",
        "description": "apply dict value",
        "when": [
          "identifier", "unary-expression", "binary-expression", "expression", "function-call"
        ]
      },
      {
        "name": "apply_empty",
        "body": "{{expr}} = \"\"",
        "description": "apply empty string",
        "when": [
          "identifier", "unary-expression", "binary-expression", "expression", "function-call"
        ]
      },
      {
        "name": "apply_list",
        "body": "{{expr}} = []",
        "description": "apply list",
        "when": [
          "identifier", "unary-expression", "binary-expression", "expression", "function-call"
        ]
      },
      {
        "name": "yield",
        "body": "yield {{expr}}",
        "description": "yield value",
        "when": [
          "identifier", "unary-expression", "binary-expression", "expression", "function-call"
        ]
      },
      {
        "name": "apply_yield",
        "body": "{{expr}} = yiled {{expr}}",
        "description": "double expr",
        "when": [
          "identifier", "unary-expression", "binary-expression", "expression", "function-call"
        ]
      },
      {
        "name": "self_apply_none",
        "body": "self.{{expr}} = None",
        "description": "double expr",
        "when": [
          "identifier", "unary-expression", "binary-expression", "expression", "function-call"
        ]
      },
      {
        "name": "self_apply_true",
        "body": "self.{{expr}} = True",
        "description": "double expr",
        "when": [
          "identifier", "unary-expression", "binary-expression", "expression", "function-call"
        ]
      },
      {
        "name": "if",
        "body": "if {{expr}}",
        "description": "double expr",
        "when": [
          "identifier", "unary-expression", "binary-expression", "expression", "function-call"
        ]
      },
      {
        "name": "self_apply_false",
        "body": "self.{{expr}} = False",
        "description": "double expr",
        "when": [
          "identifier", "unary-expression", "binary-expression", "expression", "function-call"
        ]
      },
      {
        "name": "self_apply_emtpy",
        "body": "self.{{expr}} = \"\"",
        "description": "double expr",
        "when": [
          "identifier", "unary-expression", "binary-expression", "expression", "function-call"
        ]
      }
      {
        "name": "self_apply_dict",
        "body": "self.{{expr}} = {}",
        "description": "apply dict value",
        "when": [
          "identifier", "unary-expression", "binary-expression", "expression", "function-call"
        ]
      },
      {
        "name": "ifn",
        "body": "if {{expr}} is None:",
        "description": "if is None",
        "when": [
          "identifier", "unary-expression", "binary-expression", "expression", "function-call"
        ]
      },
      {
        "name": "ifnn",
        "body": "if {{expr}} is not None",
        "description": "if is not None",
        "when": [
          "identifier", "unary-expression", "binary-expression", "expression", "function-call"
        ]
      }

    ],
1822 次点击
所在节点    Visual Studio Code
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/546222

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX