JSP and JS question

Is there any way to have certain jsp files get js syntax highlighting or both. We create our javascript files and jsp's to be able to include java variables inside our code, but thise leaves us with no syntax highlighting for the javascript and the ability for any of the cool functionality associated with javascript.

6 comments
Comment actions Permalink

<%@ page contentType="text/javascript" %>

Dan wrote:

Is there any way to have certain jsp files get js syntax highlighting or both. We create our javascript files and jsp's to be able to include java variables inside our code, but thise leaves us with no syntax highlighting for the javascript and the ability for any of the cool functionality associated with javascript.


--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0
Comment actions Permalink

wow that is so cool, do you know that I have been writing javascript without that for the last year and never thought to look to see if it was possible. Thats like the best thing I have done for myself since I started :)

Now only if there was a way to add javascript library shortcuts like there are regular javascript shortcuts when you do ctrl space. If there is that would be awesome.

Thanks again man I really appreciate it.

0
Comment actions Permalink

Why not define some templates for that?

0
Comment actions Permalink

could you point me in the right direction on finding the documentation on how to do that? I haven't been using Idea for long or any IDE I was a front end guy that is now slowly moving towards Java programming so I am not as familiar with all the possibilities with the IDE's or Idea. I do appreciate the help and the quick responses its good to know there is a good community with Idea

0
Comment actions Permalink

Idea contains "Live Templates" and "File Templates". File templates are for things like classes and JSPs. In IDEA, when you select "new | class", it uses a file template to create the new class. Live Templates allow for shortcuts for common work. IDEA has lots of built in live templates, but you can also create your own. One (simple) example of a live template is "sout" After tying "sout" and then the tab key, IDEA places in "System.out.println(""); and places the cursor between the quotes. More sophisticated live templates can "exam" the nearby code and make decisions on what code to put in place.

Erik was suggesting that you write similar live templates to enter your library shortcuts. To create live templates, go to Settings (ctrlalts) | IDE Settings | Live Templates. You can read more about Live Templates in the Help topics: IntelliJ IDEA / Concepts / Templates and IntelliJ IDEA / Procedures / Creating Source Code / Advanced Editing Procedures / Creating Code By Template. You can read about creating your own templates in the help topics: IntelliJ IDEA / Procedures / Creating Source Code / Advanced Editing Procedures / Creating Code By Template / Creating and Editing Live Templates and IntelliJ IDEA / Reference / Settings Dialog / IDE Settings / Live Template

0
Comment actions Permalink

Thanks for all the great advice I will definitely research all of this and hopefully set my self up with some nice shortcuts.

0

Please sign in to leave a comment.