Posts Tagged ‘javascript’

Live Templates in JavaScript/ActionScript/Flex

Thursday, January 28th, 2010

Writing JavaScript/ActionScript/Flex code becomes easier with upcoming IntelliJ IDEA 9.0.2. New set of live templates (see Settings dialog (Ctrl+Alt+S), Live Templates, JavaScript/ActionScript group), allows to avoid tedious typing when you need to loop over an Array, Vector or anything else. Luckily, some abbreviations are the same as with Java: iter, itar, ritar. Here’s the list of currently available live templates:

Abbreviation Description
iter Iterate (for each..in)
itin Iterate (for..in)
itar Iterate elements of array
ritar Iterate elements of array in reverse order

(more…)

Editing HTML Inside of JS Literals

Thursday, December 3rd, 2009

It often happens that we need to edit HTML code inside JavaScript literals. With Maia this is at last possible, and even with pleasure!

Completion, quick documentation, and navigation for HTML, CSS and even JavaScript inside JavaScript literals is at your service :)

Unwrap code constructs in JavaScript / ActionScript

Wednesday, November 18th, 2009

Sometimes when you are editing JavaScript/ActionScript code, you need to remove, say, an enclosing if statement without touching a current code block.

In Maia you can just invoke Unwrap/Remove action (Control+Shift+Delete in Windows keymap), which allows to precisely select which construct to unwrap:

Voila! The edited code block is unwrapped and in place!

BTW, this handy action works in XML/HTML/JSP files, where it removes enclosing tags.

Enjoy developing with pleasure!

Inline Variable Refactoring for JavaScript / ActionScript

Monday, September 21st, 2009

Next version of IntelliJ IDEA, code named Maia, brings you several new JavaScript and ActionScript refactorings. In this post we showcase one of them — Inline Variable, which works with local variables and ActionScript class fields.

Before Inline Variable

Pressing Control+Alt+N (default Windows keymap) replaces variable occurrences with an initializing expression.

After Inline Variable

During the inline process, IntelliJ IDEA checks if a variable can be safely replaced and warns if, for example, there are its usages inside a functional expression.

Problem detected when inlining variable

By the way, the Inline Variable refactoring also works in the left part of local variable assignment.

Enjoy developing with pleasure!

Code Inspections for Web Applications

Thursday, September 17th, 2009

If you ever coded a Web project, you know that all the errors in those HTML / JavaScript files are detected only during run time. Starting next build IntelliJ IDEA 9 (Maia) will help you to spot the problems much earlier. Just invoke Inspect code action from the Analyze menu on the necessary files.
(more…)

Debugging JavaScript in Mozilla Firefox

Monday, June 29th, 2009

IntelliJ IDEA 9M1 supports debugging of JavaScript code in Mozilla Firefox. Just create a JavaScript Debug configuration, select Firefox from the Browser list and click OK:

IntelliJ IDEA automatically installs plugin for Mozilla Firefox and executes the configuration.
Note that you need to clear Make option under Before launch group before starting debugger to work around a bug that will be fixed in next Maia EAP.

Better Regular Expression Editing in JavaScript and ActionScript

Wednesday, June 3rd, 2009

If you ever tried to understand or edit regular expression like this in JavaScript or ActionScript:
regular expression in JavaScript editor of IntelliJ IDEA 8
Then you are sure to find IntelliJ IDEA 9 a more helpful in this way. Now you can repeatedly press Ctrl+W to see non-capturing groups:
regular expression in JavaScript editor of IntelliJ IDEA 9
Plus, code completion after \ is also a bit smarter:
completion after \ in regular expression literal in JavaScript editor of IntelliJ IDEA 9

Helping You with JavaScript Expressions in CSS

Tuesday, June 2nd, 2009

As you may already know, Internet Explorer supports a technique of inserting JavaScript snippets into css expressions. In case you need to edit such code, IntelliJ IDEA 9 will be happy to assist you with completion and highlighting!