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.
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/