Search code examples
coffeescriptline-numbers

CoffeeScript: Synchronize the resulting JavaScript line numbers


I like some of what CoffeeScript offers, but the one thing that prevents me from switching is the lack of line number sync. I know this may be against common practice, but I often make JavaScript code that ends up to be over 1000 lines long, and this happens repeatedly.

Also, I often end up with errors during development. Unfortunately, the JavaScript line numbers do not at all match up with the CoffeeScript. This means I have to debug in JavaScript, just to bring the fixes back into CoffeeScript, which I imagine can become a little difficult as the file grows.

Can I synchronize the line numbers somehow?


Solution

  • No, but it is being worked on. I guess it is a problem for anything using the Google Closure tools (like ClojureScript does; at least for aggressive optimization I guess), since it has rather aggressive rewriting of the code and variable renaming. But for other langauges (like CoffeeScript) it's not a big problem, as functions and variables keep their name in their javascript output, and the generated code is easy to read and comprehend.