How can I insert a snippet on a new line with vscode?

后端 未结 2 654
再見小時候
再見小時候 2021-01-20 18:26

I\'m trying to make a vscode snippet for python. Suppose I have a line of code like this:

my_var = call_some_function()

I\'d like to double

2条回答
  •  醉酒成梦
    2021-01-20 19:23

    This isn't exactly what was asked for, but is close, using the $CLIPBOARD variable:

    "log-clipboard": {
        "prefix": "log-clipboard",
        "body": [
            "LOGGER.debug('$CLIPBOARD: %s', $CLIPBOARD)",
            "$0"
        ],
        "description": "Log an expression from the clipboard"
    }
    

    To use:

    1. Select what you want to log and hit Copy
    2. Go to where you want the log it
    3. Type log-clipboard and hit enter

    Pretty close.

提交回复
热议问题