that's sad we still don't have $TM_METHOD_NAME
available, anyway here few snippets I use with $WORKSPACE_NAME
and $TM_FILENAME
to differentiate the output along with coloring:
{
"key": "cmd+alt+l",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "console.log(`%c[${WORKSPACE_NAME/(.*)/${1:/upcase}/}] ${CLIPBOARD}`, '${2|background: lightblue; color: #444;,background: lightgreen; color: #444;,background: lightsalmon; color: #444;,background: lightcyan; color: #444;,background: lightpink; color: #444;,background: lightseagreen; color: #444;,background: lightskyblue; color: #444;,background: lightsteelblue; color: #444;,background: khaki; color: #444;,background: purple; color: white;,background: salmon; color: white;,background: blue; color: white;,background: #444; color: white;,background: green; color: white;,background: mediumvioletred; color: white;,background: blueviolet; color: white;,background: chocolate; color: white;,background: mediumvioletred; color: white;,background: brown; color: white;,background: cadetblue; color: white;,background: cornflowerblue; color: white;,background: crimson; color: white;|} padding: 3px; border-radius: 5px;');"
}
},
{
"key": "cmd+alt+e",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "console.groupCollapsed('$TM_FILENAME');\nError.stackTraceLimit = ${0:4};\nconsole.log(new Error('$TM_FILENAME').stack);\nconsole.groupEnd();\n"
}
},
{
"key": "cmd+alt+shift+l",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "console.groupCollapsed(`%c[${WORKSPACE_NAME/(.*)/${1:/upcase}/}] ${CLIPBOARD}`, '${2|background: lightblue; color: #444;,background: lightgreen; color: #444;,background: lightsalmon; color: #444;,background: lightcyan; color: #444;,background: lightpink; color: #444;,background: lightseagreen; color: #444;,background: lightskyblue; color: #444;,background: lightsteelblue; color: #444;,background: khaki; color: #444;,background: purple; color: white;,background: salmon; color: white;,background: blue; color: white;,background: #444; color: white;,background: green; color: white;,background: mediumvioletred; color: white;,background: blueviolet; color: white;,background: chocolate; color: white;,background: mediumvioletred; color: white;,background: brown; color: white;,background: cadetblue; color: white;,background: cornflowerblue; color: white;,background: crimson; color: white;|} padding: 3px; border-radius: 5px;');\nconsole.log(${CLIPBOARD});\nconsole.groupEnd();\n"
}
},
drop this to keybindings.json