I was looking for a long time ago to be able to have a strong IntelliSense development tool to write script JS as in vs C #, but I haven't been able to really find an ideal tool yet. I heard a long time ago that VS2007 can bring me a little shock, but some people say that it is only to ASP.net Ajax have IntelliSense, and a little sense of loss. Today, I saw ScottGu blog found that VS2007 can provide almost as the same as the C # IntelliSense, so I am very excited, but also because of a long time did not write a blog by the way to share some of their experience with you.
Since I'm not a subscriber to MSDN Magazine, and I hate the VPC virtual machine (memory is a bit inadequate, hehe, so I haven't been able to use the visual Studio 2007 code name "Orcas" Beta1 Edition for the experience or the March CTP, Perhaps it will be different in later versions. When we are typing a character in the <script></script> tag, it will give us the same experience as C #, which will not only improve the development efficiency, but also greatly reduce our mistakes. There is also a shortcut key to the default IntelliSense to display, this shortcut is Ctr+j, have the opportunity to try. Take a look at the picture below:
What is seen above is the support for ordinary functions in VS2007, and he also supports the ID attribute values that we define in the HTML markup as if the value of the id attribute of the server-side control. In the ASP.net Ajax support is more powerful, it can be prompted by namespaces, classes, etc., that is, and in C # of IntelliSense in a spell, from the following two pictures can see his great, namespaces, classes, attributes, methods, enumerations, etc. without a pass.
I think it's just a hint that when we have a lot of methods or attributes, we still don't know how to think or say so many things when we design it. How do I know what he's doing? Don't worry, wait for me to slow down, Microsoft has long considered this point, JS also supports XML annotations, of course, when we release the compiler will be our annotation document to filter, otherwise the script is too big but will reduce our application performance. JS notes and C # almost, all with "///" to annotate, with "<summary></summary>" to express the summary, with "<param name=" "></param>" to represent parameters, Here is not much to say, but the difference is the position of the note. In C # We write the annotation in the method or class above, and JS is written in the method or class below, this may be different from C # and will not let the program appear error (just guess no basis, hehe). According to my observations, when we annotate, we activate TypeLibBuilder.exe to collect these annotations and keep them in memory (guess) like dictionaries, which we collect and display as we apply them.
In the VS2005 HTML or aspx page <script></script> tags in the code will be prompted some basic JS keyword and some object methods, in the VS2007 to get better support. Of course, we make a program will have a lot of JS files, referencing a number of JS files and each JS file will be called each other, how in the JS file in the other JS file in the method of IntelliSense? Let's enjoy it together.
In order to be able to implement IntelliSense on another JS file, of course, the introduction of a file of information, so that the method of another file can be prompted. We're just using some common methods for another file.
The following are the referenced contents: <reference path= "Jscript1.js" > |
When we use ASP.net ajax and so on, we will involve the "assembly" (this concept I am not very clear, and so will slowly uncover this vague concept, we do not care about him). When we want to change the path to name for a program and related operations, you can join the assembly assembly to represent a file that references the current assembly. If the assembly is omitted, the reference to System.Web.Extensions is indicated
The following are the referenced contents: <reference name= "MicrosoftAjax.debug.js" > |
OK, write here also almost, perhaps there are a lot of new experience waiting for us to enjoy, from the above some examples we can see how strong VS2007 to JS support. With this dongdong, I think in the near future JS will be more and more people, Ajax script development will be more simple and efficient, let us wait for VS2007, hug that beautiful tomorrow, hehe!