integrated optional line numbering functionality#266
integrated optional line numbering functionality#266gerhard-boden wants to merge 34 commits intoleafo:masterfrom
Conversation
…r easier frontend debugging call "setLineNumbers(true)" when creating a new instance of the compiler.php to output scss line numbers within the css file
This reverts commit 06c5862.
This reverts commit 0fa3ad9.
This reverts commit 77c6507.
for filepath output within line number commentary
* included scss files will now be considered (thanks to @handyface for the hint) * bugfix for scss functions in combination with line numbers * less empty line numbers
* small test scss provided * if, else, for, while and each won't get a line numbering comment
now we have a test to cover all scss test scenarios with integrated line numbers
note: Travis CI keeps failing 3 tests (for no apparent reason) but locally all tests pass
note: maybe the reason for the Travis CI failures
since he keeps failing (differences on certain lines with CR and LF)
... since travis has now compiled the files himself and formatted the LF and CR as he thinks it's correct for the assertions (finally)
since \n is also used in other parts of the project. this may solve the travis assertion issue
now you can also call the 'compile' method directly when using line numbering (for more detailed information see readme)
better support for "map_get" in combination with curly braces
…r better frontend debugging. works great in combination with frontend debugging tools like https://addons.mozilla.org/de/firefox/addon/firecompass-for-firebug/ to activate this feature you need to call ->setLineNumbers(true) after creating a new instance of compiler.php For full description see: https://github.com/Screenchecker/scssphp/tree/develop#optional-output-scss-line-numbers latest update (10.6.2015) * fixed test case issue * better support for "map_get" in combination with curly braces
|
It seems you weren't able to rebase and squash, so I opted to instead cherry-pick 2aab9e7 into the https://github.com/leafo/scssphp/tree/line-numbers-v2 I'll finish reviewing the PR this week. |
|
That's odd, git reported "successfully rebased and updated" without any conflict or error, but you're right. For some reason all the commits (or at least most of them) are still there. The cherry pick strategy seems to be a good call, since there were only very minor changes since the first version of the "line-numbers" branch last week. Tests need to be rebuild of course, since the output will be different now. |
|
Seems to still have some edge cases, such as unexpected and/or missing line comments, e.g.,
Instead of the extra pass, maybe we could add hints to the Parser. I created an
|
|
The extra pass is indeed not the perfect solution. When I wrote the basic first version in a couple of hours I tried to interfere with the core scssphp parser as little as possible since I was looking for a quick solution. It's a more modular approach. Like I said in the old PR the line comment output might not always be perfect, but in 99% of the real life cases the overhead is very low and the firebug debugger extension will get it right. Some scss input used for the test cases can't be described as realistic code (which is deliberate to cover a lot of scenarios of course). Nonetheless, I welcome the new approach to integrate the line number functionality directly into the parser and I'm very happy to help. This would also be a great chance to integrate sourcemaps, since the basic approach would be the same. Or should we drop line numbers completely in favour of sourcemaps which would be a more elegant debugging solution? update: on second thought i don't think that we can completely drop the line number debugging in favour of sourcemaps, since some people want to use the output as string(s) and not seperate file(s). |
|
Both approaches have their +/-. I agree this will probably set the stage for source maps. Let's tinker with this a bit. |
|
will the Or will |
|
I'm going to keep both branches updated until a decision is made on which to mainline. I've started looking at source maps support, so that will weigh in. |
|
That is awesome! I think it's worth mentioning that the line number branches will still receive the latest updates here: #88 (comment) So people know that they can use it without having to use an older version of scssphp. Source maps: But i guess it will be tricky knowing the exact line number for the final CSS file while parsing trough the SCSS code. Especially includes and functions will make things interesting. |
output the original SCSS line numbers within the compiled CSS file for better frontend debugging.
works great in combination with frontend debugging tools like https://addons.mozilla.org/de/firefox/addon/firecompass-for-firebug/
to activate this feature you need to call ->setLineNumbers(true) after creating a new instance of compiler.php
For full description see:
https://github.com/Screenchecker/scssphp/tree/develop#optional-output-scss-line-numbers