The secrets of JavaScript Editing debugger in VS 2008

Source: Internet
Author: User
Tags comments documentation getmessage new features visual studio

JavaScript has developed into a standard language for Web client programming. It has a lot of language resources, but the support for development is not complete. Most developers who use JavaScript tend to use the original method for debugging, but now there are many tools to mitigate the burden of testing and debugging.

Visual Studio 2008 will be a very exciting version that contains a stack of powerful features. One of the new features is a more complete support for JavaScript debugging and IntelliSense features. Visual Studio 2008 is actually the best IDE for developing JavaScript programs, the most powerful code-inducing for JavaScript, and the ability to debug breakpoint-tracking debugging. In this article, we will show you the features of these two aspects, hoping to create a new way of development for JavaScript editing and debugging, hopefully readers will find a better JavaScript development tool.

First, JavaScript IntelliSense (IntelliSense) features

Java, C # and other high-level language development tools dazzling, competition and splendor. But the JavaScript language of the protagonist of Ajax, the supporting development tools always maintain a disproportionate silence. Without the support of good development tools, it is challenging to write JavaScript programs, especially JavaScript programs over 500 lines-no code-inducing function, no real-time error checking, no breakpoint tracking debugging ... Developing JavaScript code is sometimes like groping around in a dark tunnel. Inadvertently add a redundant "(" or "{") in the code, the entire code may be immediately like a sudden collapse of the wall, in IE reported errors are often specious, and even the real reason is often 108,000 of the difference between, let a person like a fog. A good person quotes Mr Liu, summarizing the feeling of writing a JavaScript program: trembling and treading on thin ice.

(1) The ubiquitous IntelliSense function

One of the great expectations that developers have for Visual Studio 2008 is the support of Visual Studio 2008 for client-side JavaScript IntelliSense, which is of course the feature in the free visual Web Developer The Express version can also work properly.

Visual Studio 2008 's JavaScript IntelliSense feature is similar to the auto-completion in other Ides, which is the ability to automate the completion, but unlike auto-completion in VI and Emacs, IntelliSense compares intelligent, and discusses alternative fills according to the syntax of the programming language.

If the reader had previously bothered to type JavaScript manually, that would certainly have been a surprise for this feature of Visual Studio 2008. Visual Studio 2008 provides the complete JavaScript IntelliSense AutoComplete feature for all. aspx files,. htm files, and external. js files. It not only provides IntelliSense for common JavaScript code, but also provides rich support for the new ASP.net AJAX client JavaScript framework and the JavaScript code it writes.

(2) The IntelliSense function of external JS file

The JavaScript IntelliSense support in Visual Studio 2008 is cool in that it is designed to be Just (work out of the box). This means that developers do not need to run other tools on JavaScript files to establish IntelliSense hints, or to modify JavaScript in some way. If you have a standard JavaScript function or prototype type built into an external JavaScript file, you should automatically get IntelliSense done when you use it in Visual Studio 2008.

Obviously, when the external JS file has IntelliSense capabilities, the developer can invoke it like an internal JavaScript statement block. In this way, you can automatically invoke JavaScript functions and variables defined in the external JS file.

For example, as shown in the following illustration, two. js files are referenced in some files

As a result, the method defined in the Util.js file can be invoked in the Mylibrary.js file. Of course, you can also let Visual Studio 2008 give Util.js an IntelliSense feature. Simply add <reference> comment to the top of the Mylibrary.js file.

(3) JavaScript document annotation

Visual Studio 2008 also allows developers to selectively add documentation comments to the Code/library to further help the IntelliSense engine, as well as allow developers to provide documentation comments, Visual Studio The IntelliSense engine collects these comments as summary comments and type description/validation checks.

For example, if a developer can add the following annotation to the GetMessage function:

When you encode in Default.aspx, Visual Studio 2008 automatically displays information about the GetMessage function. Visual Studio automatically displays the details of the summary and provides inline help when the parameter values are entered.

In addition to the basic JavaScript annotation features above, asp.net Ajax also uses document summary annotation formatting. Both of these can be:

Add a summary detail to a class, method, parameter, localize a document in JavaScript, and when an external JavaScript file references another external JavaScript file, use the previous external JavaScript file to let its JavaScript IntelliSense considers that the methods and types in the file are in the current range.

The ASP.net AJAX Control Toolkit also now has a built-in MSBuild task that you can add to a Web project that automatically removes these document comments as well as spaces and other unwanted content from JavaScript files when the project compiles in publish mode. This provides a very useful feature that allows you to maintain a debug/descriptive version of JavaScript at development time, and then allow a switch to be optimized for runtime efficient downloads.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.