CoffeeScript debugger in RubyMine 6 - Not Stopping at Breakpoints

CoffeeScript debugger set up in in RubyMine 6 per these instructions: http://confluence.jetbrains.com/display/RUBYDEV/Debugging+CoffeeScript+Code

Everything seems just right ...

Gem loaded and server starts with no errors .... gem "intellij-coffee-script-debugger", :git => "git://github.com/JetBrains/intellij-coffee-script-debugger.git"

Set up a JavaScript debug configuration:
- Specified URL to my app
- Browser is Chrome
- Provided the mapping to my assets directory
(In RM 6.0.3 there does not seem to any longer show a "remote" option as a "Javascript debug" type

Run CoffeeScript debug configuration and there is a yellow bar with the text "JetBrains IDE Support is debugging this tab."

Then, I go to a .coffee file and put a breakpoint and then run the program past that spot in the code by running the program in Chrome.

The console in RM shows the activity, but the program does not stop at the breakpoint.

Am I missing something in how to conduct the debugging?



Attachment(s):
Screen Shot 2014-03-30 at 5.47.51 AM.png
9 comments

First we need to check if chrome gets CoffeeScript source file and source maps.

Let's assume that you try to debug file assets/javascript/file.js.coffee

Compiled code located by url: http://localhost:3000/assets/file.js
Source code located by url: http://localhost:3000/assets/file.js.coffee
Source maps located by url: http://localhost:3000/assets/file.js.map

Could you check if your app returns right response for these three URL above?

0

Hi Andrey,

I start out with:
http://localhost:3000/assets/application.js (usual file)

I cannot browse to the other to files. As a note, my Angular router does not recognize that route and gives me the Angular 404 screen.

But I can browse to, for example,
http://localhost:3000/assets/application.css
... so I assume I could browse to them if they were there?

Of course I'm running a Rails server, so I just don't know what Rails will serve, what gets past the Angular router, but I'm going to say I don't think those second two files are there.

     . . .

I've also noticed that after hitting "save" on a changed file my app's js crashes with "Uncaught SyntaxError: Unexpected token }"

When I look at the .js file I now see a new reference it the .js file to: "sourceMappingURL" directly above where the error occured (see attached screen shot).

Still after the crash (and now the Angular router down) I don't see the map or coffee file on the Chrome side.

At this point I have to remove the redux-coffee gem, change the changed file, restart my server to get the .js file to regenerate w/o the "sourceMappingURL" line to get the .js file to run again.



Attachment(s):
Screen Shot 2014-03-30 at 2.34.39 PM.png
0

I suppose in your environment Rails Asset Pipeline enabled. All your compiled CoffeeScript code merged into one file. Do you run your app in Development environment?

0

Asset Pipeline: yes
All Coffee compiles into a single JS file: yes
Running in Development mode: yes

0

In order to debug CoffeeScript code in Rails app you should to make your app to provide separated JS files. Could you make sure that you don't have line like:

config.assets.debug = false


in config/environments/development.rb. If you have try to change it to true.

0

That was it, Andrey!

After over a year of trying off and on, I finally have CoffeeScript debugging.

Whew! :p

Thanks so much.

/kim

btw: Simple thing to add [to the instructions](http://confluence.jetbrains.com/display/RUBYDEV/Debugging+CoffeeScript+Code), maybe as a footnote to step 1?

0

I updated the instruction. Thanks

0

Please sign in to leave a comment.