brackets-SASShints
brackets-SASShints copied to clipboard
Add recursive variables.
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.
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.
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?
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.
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
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.