开发者

JavaScript code completition done right?

I've tried some of the editors/IDEs regularly recommended for coding JavaScript (Aptana, WebStorm, ...) but none of them has a satisfying autocomplete functionality. I'm probably spoiled by Microsoft's IntelliSense for .NET. There is some JavaScript-IntelliSense in WebDeveloper, but that seems to be a stripped-down version. The best I've found so far is WebStorm, but its code completition is easily distracted by imported libraries (offering hundreds of suggestions) and identical function names.

Did I miss an editor/IDE that uses refactoring (or something else) to offer prop开发者_开发知识库er code completition, so that it really "knowns" what that variable-name stands for, I just put a dot behind? Or is something like this on its way?


I always recommend Komodo Edit from ActiveState (now up to version 6, with support for HTML 5 and CSS3 as well as recent versions of Javascript, PHP, etc.) Note that you may have to install addons for the languages you're working in, but you should find them through the Mozilla-like Addon manager.

Also supports jQuery and even lets you use jQuery (along with vanilla Javascript or Python) in its powerful macro IDE.

Code completion example:

<script type="application/x-javascript">
    var obj = {};
    obj.personnel = [{firstName:"John", lastName:"Brick", age:43},
                     {firstName:"Jane", lastName:"Motte", age:26}
                    ];
    // now type obj. and code completion immediately offers you "personnel"
    // note: file must be saved for the app to find all members of declared
    // variables, but I save about every 10 seconds so it's not a problem
</script>


The best I've found so far is WebStorm, but its code completition is easily distracted by imported libraries (offering hundreds of suggestions) and identical function names.

This comment confuses me. If you import the libraries, and your code is using them, why is it bad to include the function names in the code completion suggestions? Wouldn't you want to have jQuery's functions included if you're using it?

If you're using Microsoft's IntelliSense with jQuery, does it stick to its guns and only show JavaScript core functions? Sounds limited to me, unable to be smart when I add libraries.

Or is something like this on it's [sic] way?

It sounds to me like you want a clairvoyant interface. I don't think it is on the way anytime soon.

By the way, "it's" == "it is"; "its" is the possessive.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜