Open wmertens opened 11 years ago
+1. I just don't know how to do it yet (and there are some bigger issues to address at the moment).
node-theseus uses the esprima library to instrument pure JavaScript code. We could keep doing that and use a source map in Brackets to tell what lines of CoffeeScript correspond to which JavaScript functions, or use another library for rewriting the CoffeeScript directly. I'm not sure which approach is better yet.
Source maps may keep the implementation more flexible, such as built-in support for TypeScript or any other new transpiler that comes along.
I want it too.
:thumbsup: This would be super cool.
is there any update on this
No, not yet. :\
I'd definitely like this as well, so that I can debug (server-side) CoffeeScript from Brackets.
:+1: This would also be awesome to allow for using Babel or other ES6 compilers.
Awesome enough to supply a patch? :kissing_closed_eyes:
+1 for debugging with sourcemaps.
The number of people using one or more of babel, traceur, coffeescript, sweetjs, or something else in the rest if the altjs world is already pretty substantial, and it's growing.
For sure! Nobody's happy with plain JavaScript these days. This just happens to be a massive undertaking. :\
node-theseus uses the esprima library to instrument pure JavaScript code. We could keep doing that and use a source map in Brackets to tell what lines of CoffeeScript correspond to which JavaScript functions.
@alltom I think this is exactly the direction that should be taken. Brackets with semantic colouring, sourcemap recognition, and theseus, would then work beautifully with all compile-to-js languages (maybe)!
Should this be tracked as an issue in Brackets directly?
I think this is the right place.
I've never looked at the source code to Brackets or Theseus but I've had a little look at https://github.com/mozilla/source-map/ and it seems to make sense. Where would you recommend I start looking within the brackets or theseus source code if I want to take a stab at wiring things up?
Module._extensions['.js']
(deprecated) to rewrite JavaScript source code when it's require()
'd. If the non-JS scripts are dynamically compiled to JavaScript using a similar method, then this needs to be made to cooperate with it.node.loc.start
, node.loc.end
, and options.path
, it should run those locations backwards through the source map and store the locations from the original CoffeeScript or whatever.I think these are the main integration points.
Ah, I just remembered that fondue/master is in an unstable state. If you want to work off the 0.6.1 release at adobe-research/fondue@f7a3bc6 then I'd have no problem porting it forward for you. (The new code is much easier to follow, but hasn't gone through the same hardening process as the 0.6.1 release.)
It would be great if Theseus could support coffeescript. I converted node-theseus to coffeescript with js2coffee (remove the hashbang first) and it then ran CoffeeScript files just fine but Brackets doesn't know what to do with them.
If I compile the coffeescript first to JS it works but then all dependencies need to be converted as well, plus it clutters up the project directory.
Ideally Theseus has native support for showing debugging CoffeeScript but just showing an on-the-fly compiled version of the script would already be very nice.