Use the predefined keybinding (e.g., Ctrl+l or Cmd+l on macOS) or right-click and select(Ctrl+l or Cmd+l)
The "code-logger" extension for Visual Studio Code allows you to quickly log selected text using console.log statements. This extension simplifies the process of adding temporary logging statements for debugging purposes, making it easier to understand the flow of your code.
Features
Select any text in the editor and trigger the command to insert a console.log(selectedText); statement on the next line.
Works in various programming languages supported by Visual Studio Code, such as JavaScript, TypeScript, Python, etc.
Installation
Launch Visual Studio Code.
Go to the Extensions view by clicking on the Extensions icon in the Activity Bar on the side of the window.
Search for "Log Selected Text with Console.log" in the Extensions view search box.
Click on the Install button to install the extension.
Reload Visual Studio Code to activate the extension.
Usage
Open a file containing the code you want to log.
Select the text you want to log.
Use the predefined keybinding (e.g., Ctrl+l or Cmd+l on macOS) or right-click and select the "Log Selected Value" command from the context menu.
A new line with console.log(selectedText); will be inserted below the selected text.
Contributing
Contributions are welcome! If you encounter any issues or have suggestions for improvement, please open an issue or submit a pull request on the GitHub repository.