This extension make debugging much easier by automating the operation of writing meaningful log message.
I) Insert meaningful log message automatically
Two steps:
-
Selecting or hovering the variable which is the subject of the debugging (Manual selection will always take over the hover selection)
-
Pressing ctrl + alt + L (Windows) or ctrl + option + L (Mac)
The log message will be inserted in the next line relative to the selected variable like this:
console.log("SelectedVariableEnclosingClassName -> SelectedVariableEnclosingFunctionName -> SelectedVariable", SelectedVariable)
Multiple cursor support:
Properties:
-
turboConsoleLog.logFunction (string): Custom log function to use in the inserted log message, when specified logType property will be ignored
-
turboConsoleLog.logType (enum): "log","warn", "error","debug","table"
-
turboConsoleLog.wrapLogMessage (boolean): Whether to wrap the log message or not.
-
turboConsoleLog.logMessagePrefix (string): The prefix of the log message (default one is ๐ ).
-
turboConsoleLog.logMessageSuffix (string): The suffix of the log message (default one is
:
). -
turboConsoleLog.addSemicolonInTheEnd (boolean): Whether to put a semicolon in the end of the log message or not.
-
turboConsoleLog.insertEnclosingClass (boolean): Whether to insert or not the enclosing class of the selected variable in the log message.
-
turboConsoleLog.insertEnclosingFunction (boolean): Whether to insert or not the enclosing function of the selected variable in the log message.
-
turboConsoleLog.insertEmptyLineBeforeLogMessage (boolean): Whether to insert an empty line before the log message or not.
-
turboConsoleLog.insertEmptyLineAfterLogMessage (boolean): Whether to insert an empty line after the log message or not.
-
turboConsoleLog.delimiterInsideMessage (string): The delimiter that will separate the different log message elements (file name, line number, class, function and variable)
-
turboConsoleLog.includeFileNameAndLineNum (boolean): Whether to include the file name and the line number of the log message.
-
turboConsoleLog.quote (enum): Double quotes (""), single quotes ('') or backtick(``).
A wrapped log message :
II) Comment all log messages, inserted by the extension, from the current document
All it takes to comment all log messages, inserted by the extension, from the current document is to press alt + shift + c (Windows) or option + shift + c (Mac)
III) Uncomment all log messages, inserted by the extension, from the current document
All it takes to uncomment all log messages, inserted by the extension, from the current document is to press alt + shift + u (Windows) or option + shift + u (Mac)
IV) Delete all log messages, inserted by the extension, from the current document
All it takes to delete all log messages, inserted by the extension, from the current document is to press alt + shift + d (Windows) or option + shift + d (Mac)
Initial release of Turbo Console Log
- New feature: The possibility of wrapping the log message is added
- New feature: Comment all log messages inserted by the extension
- New feature: Uncomment all log messages inserted by the extension
- When requested, only the log messages inserted by the extension will be commented, uncommented or deleted
- Multiple cursor support
- The extension will comment, uncomment and delete all log messages in the current file whether they have been inserted by it or not
- The extension is rewrited with Typescript with a whole new architecture
- File name and line number are added to the log message
- The delimiter of elements inside the log message can be customised
- Comment, uncomment and delete only the log messages inserted by the extension
- Specify custom log function to use instead of the default console.log
- Specify log function type (log, warn, error, debug, table)
- Possibility to insert the log message by hovering the variable
- Manual selection will always take over the hover selection
- insertEmptyLineBeforeLogMessage extension property is added
- insertEmptyLineAfterLogMessage extension property is added
- Support arrow function transformation
- Build the extension with esbuild
You're more than welcome to participate in the development of the extension by creating pull requests and submitting issues, link of the project in github: https://github.com/Chakroun-Anas/turbo-console-log
You can contact me on the following mail: [email protected]
MIT ยฉ Chakroun Anas
Buying me a coffe will definitely help me to keep working in this project and other open source projects <3
Enjoy!