brackets-SASShints icon indicating copy to clipboard operation
brackets-SASShints copied to clipboard

Add recursive variables.

Open sava1192 opened this issue 9 years ago • 3 comments

Hi, I found that in my project a lot of variables are referenced to another, so it would be nice to show real value, even if its taken from another variable, and to know from what variable it was taken. screenshot3

If value of one variable is another variable, value is recursively taken from the next variable. Name(s) of one or more variable from witch value was taken is shown too.

sava1192 avatar Mar 12 '15 12:03 sava1192

Hey, thank you for your work! Could you please rebase the Pull Request?

Did you test this for some scenario like the following?

$first = $second;
$second = $first;

What happens then? Could there be a endless running loop?

konstantinkobs avatar Mar 17 '15 11:03 konstantinkobs

Endless loop is imposibble because of max recursion deph, which is set in first call of setupRef function. Now it is 100.

matches.forEach(function (match){
  setupRef(match, 100);
});

I tried to avoid circles by checking each element in path but it caused performance problems. On my pc with core i5, 8gb ram, hdd and project with 4K+ vars in 500+ files it sometimes took more than 1-2 second to parse all variables, and it is quite not comfortable to use plugin with such delay.

Maybe later, if i coud do something with performance i will add this check, or maybe create some parameter for people with small projects and/or SSD/faster hardware.

sava1192 avatar Mar 17 '15 12:03 sava1192

Hi, sorry for so long answer :) I`ve added circles check for any circle length. So now it works even for such cases:

$first: $last;
$second: $first;
$last: $second;

Also, it is shown in the hint, that there is a circle image

I made some code refactoring and optimization, and added variable `maxRecustionDepth' to constructor function for fast and comfortable changing if needed. And also, rebased a pull request.

sava1192 avatar Mar 30 '15 10:03 sava1192