This Question is Answered

1 "correct" answer available (4 pts) 1 "helpful" answer available (2 pts)
2 Replies Last post: Apr 30, 2012 6:16 PM by James Garza  
James Garza Newbie 5 posts since
Aug 8, 2011
Currently Being Moderated

Apr 30, 2012 8:19 AM

SSR and Coffeescript?

Been playing around with Structural Search and Replace in INTELLJ 11.1.1.

 

1. I've set the file type to Coffeescript.

2. Search pattern is ==

3. Replace pattern is (literal) is.

4. All else default.

 

SSR finds the pattern in my code:

 

if foo == bar then console.log "foo is bar!"

 

I hit Alt-Enter and choose Replace with "is".

 

Expected : Text replaced with if foo is bar

Actual: Text does not change.

 

Is SSR REALLY supposed to work with Coffeescript?  SSR for Coffeescript feels really unsolid. Here are some other patterns that are not working:

 

Ternary to coffeescript if/then/else

$boolean$ ? $result1$ : $result2$  replaced with if $boolean$ then $result1$ else $result2$

 

Here's the source I'm testing with:  console.log (zit > zot ? "OK" : "NOT OK")

 

This kind of works but $boolean$ only matches on "zot" and not on the whole boolean expression (zit > zot)  I've tried various regex definitions but SSR always wants to treat $boolean$ as just zot.  On a side note:  Ternary expressions aren't allowed in Coffeescript but the Coffeescript compiler doesn't treat them as errors, so Intellij is in good company :).

 

Not Equals to literal not

!= to is not

 

Works just like ==,  Nothing happens.


Would love to put this through it's paces but need to get verification that this is working as it should.  I'm also willing to beta test any fixes.

Dmitry Jemerov JetBrains 12,178 posts since
Aug 19, 2002
Currently Being Moderated
Apr 30, 2012 1:21 PM in response to: James Garza
Re: SSR and Coffeescript?

We haven't done any work at all to support SSR for CoffeeScript. Whatever works right now is mostly by accident.

You're welcome to file a feature request at http://youtrack.jetbrains.com/

More Like This

  • Retrieving data ...