开发者

Validate JavaScript syntax in IDE (Editor)?

Are there any JavaScript editors tha开发者_高级运维t can validate JavaScript syntax on the fly? Things like missing brackets, etc.


You can go grab Javascript Lint then do exactly what you want and use whatever editor you want:

Javascript Lint - http://www.javascriptlint.com/download.htm


Personally, I like to use emacs with flymake, which can use Spidermonkey, JsLint or Rhino to do the validation. This does the sort of on the fly syntax checking I think you are after. If you want a liberal validation, you might want to use Spidermonkey as it is the execution engine from firefox, so it will reject anything firefox rejects. If you want something a little stricter, Crockford's JsLint enforces good style.

Validate JavaScript syntax in IDE (Editor)?


(source: mnemonikk.org)

Emacs is not for everyone however. If you prefer something point-and-click, you might want to check out IntelliJ's IDEA. It can do on the fly syntax checking, along with a raft of other features. Sadly, javascript support is not available in the free version.

Validate JavaScript syntax in IDE (Editor)?


(source: jetbrains.com)

A free alternative to IntelliJ is Netbeans, which purports to offer the same javascript functionality baked into the core. I don't have experience with it, but it is free, open source, and reputedly improving in recent versions netbean's javascript syntax highlighting http://netbeans.org/images_www/articles/61/ide/javascript/background_parser.png

If you're a Windows or ASP.NET type developer you might be more interested in Microsoft Visual Web Developer Express 2010. It supports this features, and probably has better support for ASP.NET development than the other tools I've mentioned.


I use Komodo Edit from Activestate. It validates, has code completion, brace matching, etc., and not just for Javascript.

Edit: BTW I have a macro in Komodo Edit that calls JS_Beautify and does a spectacular job.


Eclipse (or it's web specialized form Aptana) and Netbeans offer syntax checking on the fly.


I recommend Visual Web Developer Express 2010.


Here is another idea of validating your .js with c# in VS http://madskristensen.net/post/Verify-JavaScript-syntax-using-C.aspx


If you use Eclipse, the JSDT project provides a JavaScript nature. Like most of Eclipse's language natures, it provides a context engine with realtime validation, syntax highlighting, completion, etc.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜