V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
chenqh
V2EX  ›  Visual Studio Code

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

  •  
  •   chenqh · 2019-03-19 15:41:47 +08:00 · 1808 次点击
    这是一个创建于 2085 天前的主题,其中的信息可能已经有所发展或是发生改变。

    抄了一个 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"
            ]
          }
    
        ],
    
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2770 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 15:19 · PVG 23:19 · LAX 07:19 · JFK 10:19
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.