Monday, June 3, 2024
51
rated 0 times [  52] [ 1]  / answers: 1 / hits: 16339  / 13 Years ago, tue, april 26, 2011, 12:00:00

I'm creating a Grails app in IntelliJ 10 and have a javascript file that is created dynamically, as a Grails view.



For that reason the javascript file doesn't end in '.js'. It ends in '.gsp' because it's a Groovy Server Page that spits out javascript.



IntelliJ doesn't know it's a javascript file so it doesn't give me code completion or warnings.



I want my code complete and syntax checking! Is there a way to force IntelliJ to treat this specific file as Javascript, WITHOUT messing up the IntelliJ's correct treatment of .gsp files everywhere else?



Thanks!


More From » intellij-idea

 Answers
17

The above answer is slightly outdated. You can do the same in IntelliJ 14 by doing the following:




  1. Go to Preferences (Mac OSX : Cmd + Comma)

  2. Under Editor -> File Types

  3. In the Recognized File Types Highlight JavaScript files (JavaScript)

  4. Under Registered Patterns press the + button

  5. Enter your regex pattern (for example: *.js.scala.html) and press OK



Cheers!


[#92560] Sunday, April 24, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
anthonyw

Total Points: 589
Total Questions: 117
Total Answers: 117

Location: Dominican Republic
Member since Sun, Sep 4, 2022
2 Years ago
;