项目作者: unknownuser88

项目描述 :
This plugin helps you to work easily with log statements
高级语言: Python
项目地址: git://github.com/unknownuser88/consolewrap.git
创建时间: 2014-02-07T07:51:50Z
项目社区:https://github.com/unknownuser88/consolewrap

开源协议:MIT License

下载


Console Wrap


Release version
Stability: Stable
Package Control
License: MIT

This plugin helps you easily create (comment, remove, show all) log statements (console.log, print etc.)

It places selected variable in log statement like console.log(“variable”, variable);

This is not a snippet.

Supported languages

  • Javascript
  • Python
  • Php
  • Go

Usage

First you need to select a variable (or put cursor on it) and press "ctrl+shift+q". The log line will appear on the next line. Press "ctrl+shift+q" again to change wrapping (info,warn etc.)

You can Also remove, comment or remove commented log statements from your selsection or from all document
you can find that functionality in context menu (right click) or Command Palette (command+shift+p on OS X, control+shift+p on Linux/Windows).

Screenshots

Javascript
Javascript
Python
Python
Php
Php
All Logs
All Logs

Key Binding

The default key binding is "ctrl+shift+q" and "ctrl+shift+alt+q" (insert before selection).

  1. {
  2. "keys": ["ctrl+shift+q"],
  3. "command": "console_wrap",
  4. "args": {"insert_before": false}
  5. },
  6. {
  7. "keys": ["ctrl+shift+alt+q"],
  8. "command": "console_wrap",
  9. "args": {"insert_before": true}
  10. }

Commands

  1. {
  2. "caption": "Console Wrap: Create logs",
  3. "command": "console_wrap"
  4. }, {
  5. "caption": "Console Wrap: Remove logs",
  6. "command": "console_action",
  7. "args": {"action": "remove"}
  8. }, {
  9. "caption": "Console Wrap: Remove Commented logs",
  10. "command": "console_action",
  11. "args": {"action": "remove_commented"}
  12. }, {
  13. "caption": "Console Wrap: Comment logs",
  14. "command": "console_action",
  15. "args": {"action": "comment"}
  16. }, {
  17. "caption": "Console Wrap: Show all logs",
  18. "command": "console_action",
  19. "args": {"action": "show_quick_nav"}
  20. }

Settings

  1. {
  2. "js": {
  3. "consoleStr" : "{title}, {variable}", // "{title}, tmpVal = {variable}" to assigne value to temporary parameter output: console.log('title', tmpVal = variable);
  4. "consoleFunc" : ["console", "log"], // You can change default log statement for example ["logger", "info"] output: logger.info('title', variable);
  5. "single_quotes": false, // If true output: console.log('title', variable);
  6. "semicolon" : true, // If false, will not add semicolon at end of line
  7. "log_types" : ["log", "info", "warn", "error"]
  8. },
  9. "py": {
  10. "consoleStr" : "{title}, {variable}",
  11. "consoleFunc" : ["print"],
  12. "single_quotes": false
  13. },
  14. "php": {
  15. "consoleFunc" : ["print_r"], // var_dump or if you have custom logger ["$logger", "debug"] output: $logger->debug($variable);
  16. "preTag" : true, // Put log in pre tag like echo '<pre>'; print_r($variable); echo '</pre>';
  17. "dieAfterLog" : false // echo '<pre>'; print_r($variable); echo '</pre>'; die();
  18. },
  19. "go": {
  20. "consoleStr" : "{title}, {variable}",
  21. "consoleFunc" : ["fmt", "Println"],
  22. "single_quotes": false,
  23. "log_types" : ["Print", "Printf"]
  24. },
  25. "fileTypeMap" : { // Maps file type to wrapper. For example "text.html.vue": "js" means use js wrapper in vue js files
  26. "text.html.vue" : "js", // php,python,js is included by dafault ("embedding.php": "php", "source.js": "js", "source.python": "py")
  27. "source.ts" : "js",
  28. "source.tsx" : "js",
  29. "source.coffee" : "js",
  30. "text.html.basic": "js",
  31. "text.html.blade": "js",
  32. "text.html.twig" : "js"
  33. }
  34. }

How to install

With Package Control:

  1. Run “Package Control: Install Package” command, find and install Console Wrap plugin.
  2. Restart Sublime Text editor (if required)

Manually:

  1. Clone or download git repo into your packages folder (in Sublime Text, find Browse Packages… menu item to open this folder)
  2. Restart Sublime Text editor (if required)