Variable Dumper Macro

Macro Monday – a new macro to dig into every Monday!

For quick and simple debugging of code at runtime, I will often use a print or
log statement to check what a variable is set to. This macro quickly creates the
boilerplate for the print statement according to the language I am currently
editing.

## Examples

Given this piece of JavaScript code:

~~~javascript
window.myvariable = someFunction(x, y, z);
~~~

if you place your caret anywhere in the *myvariable* word, then invoke the
macro, you’d see a *console.log()* statement on the next available line:

~~~javascript
window.myvariable = someFunction(x, y, z);
console.log(‘window.myvariable: ‘, window.myvariable);
~~~

and when using Python code, the macro would generate a *print()* statement
instead:

~~~python
window.myvariable = someFunction(x, y, z)
print(‘window.myvariable: %r’ % (window.myvariable, ))
~~~

### Installation

To install the macro simply hit the download button below, then drag the downloaded
file into your [Komodo toolbox](https://docs.activestate.com/komodo/latest/toolbox.html).
Once in your toolbox double click the macro to activate it. The macro will
automatically activate itself the next time you start Komodo, you only need to
do this manually the first time.

### Related Materials

* [Komodo Developer Extension](https://community.activestate.com/node/1824)
– play around with JavaScript or Python code in the context of the Komodo window
* [Komodo Macro API](https://docs.activestate.com/komodo/latest/macroapi.html)
– to programatically interact with the Komodo editor
* [Editor API](http://www.scintilla.org/ScintillaDoc.html)
– the Komodo editor provides a wrapper around the Scintilla API

Recent Posts

Tech Debt Best Practices: Minimizing Opportunity Cost & Security Risk

Tech debt is an unavoidable consequence of modern application development, leading to security and performance concerns as older open-source codebases become more vulnerable and outdated. Unfortunately, the opportunity cost of an upgrade often means organizations are left to manage growing risk the best they can. But it doesn’t have to be this way.

Read More
Scroll to Top