syko / SublimeLogMagic

Javascript console.log statements at the tip of your fingers
25 stars 5 forks source link

log vars #2

Closed ctf0 closed 8 years ago

ctf0 commented 8 years ago

is there anyway u could add the ability to also log the vars ? like

var $xyz = something;
console.log($xyz);
syko commented 8 years ago

This is how it should work right now. Is it not working for you? image

It depends on the statement. In some cases it switches to logging the right side of the statement rather than the first. But this usually happens if you have a function definition or something (eg var $xyz = function(a,b) { // produces console.log('$xyz', 'a:', a, 'b:', b); when logged downwards)

ctf0 commented 8 years ago

i use the upward, and for some reason am getting console.log('L14') or something like that also the var it self is just getting the value of an input with jquery.

EDIT is there a debug option to check what is the errors in the console ?

btw am on OSX 10.11 ST 3109

syko commented 8 years ago

Hmm, you can check errors if you simply open up the Sublime Console (View -> Show Console) or "ctrl + "). But can you give me the exact line? Perhaps it has trouble parsing it and it simply falls back toL14` without spitting out any errors.

ctf0 commented 8 years ago

no errors in console and here is what i have

function main() {
    var $window = $(window).outerHeight(true);
    var $footer = $('.footer').outerHeight(true);
    var $nav = $('.navbar').outerHeight(true);
    var $total = $window - ($nav + $footer);
        console.log('L8')
}

the #8 change according to the line, it could be 5,15,80,etc...

syko commented 8 years ago

You're logging downwards or upwards? When you're on line $total... and log downwards it should output the variables nicely. It only considers the line your cursor is on so logging upwards would not produce anything useful in that case (when on line {).

ctf0 commented 8 years ago

got it all working now, i mis-understood how it works, u should put the cursor over the var or the thing u want to log then use the plugin, as b4 i was having it on the empty line under the var i want to log, thanx again for ur support :metal: