Quick Commands to generate Python's most useful prints in Visual Studio Code.
- Commands for print statements:
dir
,type
,repr
,help
,id
and basicprint
. - Commands for logging statements:
debug
,info
,warning
,error
, andcritical
. - Personalize each command with text or default placeholders.
- Commands can be activated by text selection or by hovering the cursor over.
- Quickly jump between prints made by the extension.
- Custom command.
- Comment, uncomment and delete statements made by the extension.
- Postfix completions: type
variable.print
or any other available statement.
Manually select a piece of text or hover over it with the cursor and use one of the commands provided.
NOTE: The extension could remove the default key bindings in future versions to avoid shortcut conflicts.
All commands are available by opening the Command Palette (Command+Shift+P
on macOS and Ctrl+Shift+P
on Windows/Linux) and typing: Python EasyPrint...
Command ID | Shortcut |
---|---|
python-easy-print.easyPrint |
ctrl+shift+l p |
python-easy-print.easyPrintDir |
ctrl+shift+l d |
python-easy-print.easyPrintType |
ctrl+shift+l t |
python-easy-print.easyPrintRepr |
ctrl+shift+l r |
python-easy-print.easyPrintId |
ctrl+shift+l i |
python-easy-print.easyHelp |
|
python-easy-print.easyCustom |
ctrl+shift+l c |
python-easy-print.easyJumpNext |
ctrl+shift+l j |
python-easy-print.easyJumpPrevious |
ctrl+shift+l k |
python-easy-print.commentPrintLines |
|
python-easy-print.deletePrintLines |
|
python-easy-print.easyLogDebug |
|
python-easy-print.easyLogInfo |
|
python-easy-print.easyLogWarning |
|
python-easy-print.easyLogError |
|
python-easy-print.easyLogCritical |
- The main shortcut to remember is
ctrl+shift+l
, plus the initial letter of the action you want to execute:p
forprint
,d
fordir
,t
fortype
,c
for custom, etc. - Every command can be re-assigned to a new shortcut.(see Key Bindings for Visual Studio Code for more information). See Example Key Bindings for more shortcuts examples
-
pythonEasyPrint.prints.addCustomMessage
:string
Customize the print message by adding some extra information with some text or by using one of the placeholders provided:
%f
: File name.%l
: Line number.%F
: Function parent.%w
: Relative path of the active file from workspace root.
Examples:
- VS Code friendly terminal hyperlink:
%w:%l
-
pythonEasyPrint.prints.useDoubleQuotes
:boolean
If
true
, the print statement will use double quotes instead of single quotes. -
pythonEasyPrint.multipleStatements
:boolean
If
true
, when manually selecting multiple statements (e.g.,foo, bar
), print each one individually. -
pythonEasyPrint.printToNewLine
:boolean
If
true
, it will insert a newline character inside the print -
pythonEasyPrint.customSymbol
:string
Modify the default Unicode symbol for the prints. It could be an emoji: 👉 (as symbol representation, not the Unicode code point).
-
pythonEasyPrint.customStatement
:string
A custom statement you can use with the
Python EasyPrint: custom
command. In addition to the placeholders mentioned in Add Custom Message, the following two placeholders are be available:{text}
: The selected/hover text.{symbol}
: The Unicode character.
Examples:
print('{symbol} {text} ->', {text}, '<-')
print('─' * 50, '\n┌─ %w:%l - {text}\n└─', {text})
customFunction({text})
-
pythonEasyPrint.hover.includeParentCall
:boolean
If
true
, when hovering over a word (e.g., hovering overbar
offoo.bar
), include the parent/s to the print. -
pythonEasyPrint.hover.includeParentheses
:boolean
If
true
, when hovering over a word (e.g., hovering overbar
ofbar(foo)
), include the function parentheses to the print. -
pythonEasyPrint.logging.useRepr
:boolean
If
true
, the log command will include therepr
method into its statement:logging.debug("name: %s", repr(name))
-
pythonEasyPrint.logging.customLogName
:string
Specify a different logging instance name for the log commands. If empty will default to
logging
. For example, specifyingLOGGER
as a value will result in:LOGGER.debug("name: %s", name)
Prints
[
{
"key": "ctrl+shift+l p",
"command": "python-easy-print.easyPrint",
"when": "editorTextFocus"
},
{
"key": "ctrl+shift+l t",
"command": "python-easy-print.easyPrintType",
"when": "editorTextFocus"
},
{
"key": "ctrl+shift+l r",
"command": "python-easy-print.easyPrintRepr",
"when": "editorTextFocus"
},
{
"key": "ctrl+shift+l d",
"command": "python-easy-print.easyPrintDir",
"when": "editorTextFocus"
},
{
"key": "ctrl+shift+l h",
"command": "python-easy-print.easyHelp",
"when": "editorTextFocus"
},
{
"key": "ctrl+shift+l i",
"command": "python-easy-print.easyPrintId",
"when": "editorTextFocus"
},
{
"key": "ctrl+shift+l c",
"command": "python-easy-print.easyCustom",
"when": "editorTextFocus"
}
]
Logging
[
{
"key": "ctrl+alt+l d",
"command": "python-easy-print.easyLogDebug",
"when": "editorTextFocus"
},
{
"key": "ctrl+alt+l i",
"command": "python-easy-print.easyLogInfo",
"when": "editorTextFocus"
},
{
"key": "ctrl+alt+l w",
"command": "python-easy-print.easyLogWarning",
"when": "editorTextFocus"
},
{
"key": "ctrl+alt+l e",
"command": "python-easy-print.easyLogError",
"when": "editorTextFocus"
},
{
"key": "ctrl+alt+l c",
"command": "python-easy-print.easyLogCritical",
"when": "editorTextFocus"
}
]
Document
[
{
"key": "ctrl+shift+l j",
"command": "python-easy-print.easyJumpNext",
"when": "editorTextFocus"
},
{
"key": "ctrl+shift+l k",
"command": "python-easy-print.easyJumpPrevious",
"when": "editorTextFocus"
},
{
"key": "ctrl+shift+l c",
"command": "python-easy-print.commentPrintLines",
"when": "editorTextFocus"
},
{
"key": "ctrl+shift+l x",
"command": "python-easy-print.deletePrintLines",
"when": "editorTextFocus"
}
]
The commands Python EasyPrint: print
and Python EasyPrint: custom
can be
executed on non-Python files, as long as the syntax is supported (e.g., Lua
).
- When using the delete or comment commands, the extension will ignore the
help
statement and thecustom
statement. - Temporary removed the test suite
Logging
Comment, Uncomment & Delete
Vscode Terminal Hyperlink
Extra Selections
Multiple Prints