| Programming | Software Engineering | Web Design | Database | Operating Systems

IntelliSense Support in Visual C++

Alvin Chardon
Keywords: IntelliSense,Visual C++
From: http://msdn.microsoft.com/visualc/default.aspx?pull=/library/en-us/dnvs05/html/vcintellisense.asp

Alvin Chardon
Software Design Engineer
Microsoft Corporation

March 2005

Summary: For several years Visual C++ has been an outstanding product that offers a conformant C/C++ compiler, a superior debugger, and a feature-rich integrated development environment (IDE). This article focuses on a specific feature of our IDE: IntelliSense. Learn how the feature was implemented, how it works, and what to expect from its functionality both now and in the future. (5 printed pages)

Contents

Introduction
The Visual C++ Approach to IntelliSense
Implementation Limits
Past, Present, and Future of IntelliSense in Visual C++
What's New in Visual Studio 2005

Introduction

IntelliSense is the term used to identify the set of dynamic user code information features of Visual C++ such as Quick Information, Auto Completion, and Parameter Help.

Quick Information (QI) gives you information about the identifier in question, such as variable type, type definition, function signature, and so on. Users request QI by positioning the cursor or mouse pointer on top of any identifier in a C++ project; the QI information will be displayed in a yellow pop-up box.

Auto Completion (ACP) gives you information about the members of a class, such as fields, methods, properties, events, and so on. Users request ACP by typing a member selection operator ('.' or '->') or the scope resolution operator ('::') after an object or pointer or a namespace or class name respectively.

Parameter Help (PH) gives you information about a function call or a template instantiation, such as function parameters and overloads, template parameters, and so on. Users request PH by typing the opening parenthesis ('(') or angle bracket ('<') after a function name or template name respectively.

After reading this document, readers will have a better understanding of how the feature was designed and implemented and what functionality to expect.

The Visual C++ Approach to IntelliSense

The C++ Parser

In order to provide dynamic information about user code, two key pieces of information are needed: the language the code is written in and the code that is being written. For this, we needed a C++ parser that could be loaded dynamically by the IDE every time the user code changes. Since we already have a C++ parser in our compiler, we chose to reuse the existing parser and modify it for the task at hand.

Advantages

This approach has many advantages as well as some potential drawbacks; the more notable advantages being that we get a full C++ parser for free and that both the language support in the compiler and the IntelliSense support in the IDE can be kept at par; that is, when a new feature is added to the language, we automatically get IntelliSense support for it.

Drawbacks

On the other hand, it is very common that the user code at the design and coding stage is not legal C++ code yet. Keeping in mind that the user code at this stage is a main product scenario for an IDE, our C++ compiler parser had to be adapted to not only understand and retrieve information about legal C++ code, but to be able to retrieve this information from not yet legal C++ code. Whereas our compiler parser can simply alert the user about syntactic and semantic mistakes and then gracefully exit, our IntelliSense parser must make assumptions about and guess what the illegal C++ user code might mean and continue parsing and retrieving information. This means that in our implementation, we might not always retrieve or display the correct information when our user code is in illegal compilation states. The more malformed the code is, the less likely it will be that the customer will get accurate information. There are some cases in which IntelliSense information is not 100-percent accurate for well-formed code too. See Implementation Limits for more details.

The Overall Picture

Several components are involved in the process of gathering, requesting and displaying IntelliSense information. These include the user code, the IntelliSense parser, and the Visual C++ IDE. When a C++ project is opened, the IDE will load the IntelliSense parser to retrieve all the IntelliSense information from the user code and create a solution-specific database file in which to store the information. (The process of parsing user code, creating a database—called NCB store—and storing all the IntelliSense information extracted from the user code is called population.) The compilation options for the parser are obtained from the project system and all information is displayed through the environment user interface. Every time information is requested by the user through the UI, the IDE queries the database file using the IntelliSense parser. See Figure 1 for a visual explanation of the communication process between the user's source code, the IDE, and the IntelliSense parser.

 Click here for larger image

Figure 1. Visual C++ IntelliSense data flow diagram (click image to enlarge)

Implementation Limits

C++ Complexity

ISO/ANSI C++ is a complex language in itself. Microsoft Visual C++ added Managed Extensions for C++ and now our new C++/CLI syntax, thus adding extra complexity to our language and two new compilation modes for a total of three: native code, managed code using Managed Extensions, and managed code using the new syntax. This makes our IntelliSense parser code more complex in auto-recovering since we have three valid syntaxes under three different compilation modes. Comparing the Microsoft Visual C++ language against other Microsoft languages such as Visual C# and Visual Basic we observe a great difference in language complexity. Not only the is the syntax itself more complex and varied, but both these other languages are managed only and thus other mechanisms for retrieving information about user code exist as part of the .NET Framework. Visual C++ as a pioneer in the field has greatly contributed to the development of these other technologies, but still relies on our initial implementation approach of reusing our compiler parser, and thus is somewhat limited.

Limited Functionality

Apart from the limited error recovery mechanism already mentioned, here is a list of scenarios where customers might expect some problems with IntelliSense.

Common problems

The most common problem that a user will face with IntelliSense is that no information is displayed for a given scope, file, or project. In most cases it will fall under one of the following circumstances:

In some of these cases, bad side effects like memory corruption or an application hang may occur. As part of our security work in Visual Studio 2005, we have modified our parser to skip parsing when extremely malformed user code is seen, thus mitigating to some extent the risk of unrecoverable errors. Note that an analysis of all compiler errors, specifically fatal errors, has been made to decide which ones are safe to continue the parse and which ones are not.

Limitations

Language features not fully implemented

Past, Present, and Future of IntelliSense in Visual C++

As pioneers in the field of IntelliSense for Microsoft, not only have we helped push forward IntelliSense technologies for other Microsoft languages but we have evolved our own technologies across the different shipped products.

We changed our model of shipping pre-built NCB stores for our libraries to dynamically parsing all header files and modules referenced in user code and increased performance. Also, we have come from limited template support to supporting nested templates, partial and explicit specializations, and now even managed templates and generics (the Common Language Runtime's version of templates). In Visual Studio 2005, we have implemented almost all of our language (see Implementation Limits for more details), including support for the newly introduced syntax for writing managed applications, which is almost a totally new language in itself.

What's New in Visual Studio 2005

We will continue to innovate in the IntelliSense field in future products; there is still room for improvement in the area. Visual Studio 2005 will help improve the productivity and efficiency of our developers. Here are some of the new, diverse features that enrich the coding experience in Visual Studio 2005:

Microsoft Visual C++ will always be committed to our customer feedback and to bringing the best experience to developers around the World.

Acknowledgements

I would like to thank my colleagues in the Visual C++ Compiler and IDE teams for their great work and their guidance in compiling the information necessary to put together this article. Thanks go to Tanveer Gani, Ameya Limaye, Tarek Madkour, and Li Shao. Thanks for sharing your feedback and expertise. Special thanks go to Fernmarie Rodriguez for her unconditional love and support. My heart and thoughts will always be with you.

 


Related Article
  • IntelliSense Support in Visual C++

  • Comment
    apurv Post At: 2007-2-8 7:43:04
    Intellisense is an awesome feature! One feature request though - why don't we have a way for the user to refresh intellisense in case of a problem? This way he won't need to reopen the solution for intellisense to start working again.
    Treno Post At: 2007-3-7 20:18:46
    ..Rather helpful information you have here. Grazie! http://www.trenitalia.275mb.com
    ϲ Post At: 2007-3-25 0:25:57

    fake rolex Post At: 2007-5-2 20:46:37
    http://software.sci.utah.edu/bugzilla/showattachment.cgi?attach_id=204 fake rolex
    http://software.sci.utah.edu/bugzilla/showattachment.cgi?attach_id=205 rolex replica
    jahoo Post At: 2007-6-27 4:18:00
    Stupore! Amo questo luogo!:))))))) http://www.compleannomd82.info/jahoo
    ahoo Post At: 2007-6-27 8:59:21
    Design ist nett. Gut gemacht:) http://www.compleannomd82.info/ahoo
    thecarspeakerracing Post At: 2007-7-3 1:20:09
    The best links in internet
    http://google.com/translate_c?u=wshosting.biz/viagra/?page=429 zenegra vuagra http://google.com/translate_c?u=wshosting.biz/viagra/?page=84 eva airways molde vigra http://google.com/translate_c?u=wshosting.biz/viagra/?page=411 zenegra viaggra http://google.com/translate_c?u=wshosting.biz/viagra/?page=374 vigra sideeffects http://google.com/translate_c?u=wshosting.biz/viagra/?page=252 viagara and young men http://google.com/translate_c?u=wshosting.biz/viagra/?page=261 viagara defination http://google.com/translate_c?u=wshosting.biz/viagra/?page=255 viagara bent penis http://google.com/translate_c?u=wshosting.biz/viagra/?page=145 levitra vs viagara http://google.com/translate_c?u=wshosting.biz/viagra/?page=70 depression libido vigra http://google.com/translate_c?u=wshosting.biz/viagra/?page=34 cheap air flights array molde vigra http://google.com/translate_c?u=wshosting.biz/viagra/?page=379 vigras firewall download free http://google.com/translate_c?u=wshosting.biz/viagra/?page=325 viagr http://google.com/translate_c?u=wshosting.biz/viagra/?page=218 uk vagra http://google.com/translate_c?u=wshosting.biz/viagra/?page=369 vigra music video ukraine http://google.com/translate_c?u=wshosting.biz/viagra/?page=308 viagara therapy after prostatectomy http://google.com/translate_c?u=wshosting.biz/viagra/?page=25 buy viagara http://google.com/translate_c?u=wshosting.biz/viagra/?page=154 manuel viara http://google.com/translate_c?u=wshosting.biz/viagra/?page=110 generic viagera buy http://google.com/translate_c?u=wshosting.biz/viagra/?page=375 vigra substitute http://google.com/translate_c?u=wshosting.biz/viagra/?page=193 ropa viaga http://google.com/translate_c?u=wshosting.biz/viagra/?page=208 taking viagara with food http://google.com/translate_c?u=wshosting.biz/viagra/?page=224 vagra using http://google.com/translate_c?u=wshosting.biz/viagra/?page=401 zenegra vagra http://google.com/translate_c?u=wshosting.biz/viagra/?page=365 vigra kamagra cialis http://google.com/translate_c?u=wshosting.biz/viagra/?page=193 ropa viaga
    Thanks!
    John730 Post At: 2009-5-16 21:23:15
    Very nice site!
    viagra sale Post At: 2009-7-22 19:58:36
    tgdluD ejkvsssm izdfphkr supybhjy
    viagra Post At: 2009-7-25 18:20:57
    lcmfdaed tvlcgohy tpccoiiy
    prix viagra Post At: 2009-7-31 12:47:55
    iyrerdqa bxyvafwr omfbvqsr
    medicament viagra Post At: 2009-7-31 13:38:32
    rcbqzbru ijfqryka rmujejnf
    viagra marseille Post At: 2009-7-31 14:30:24
    hhzthjzs wfcmxjgw daoqleuh
    viagra generico Post At: 2009-7-31 15:21:35
    elkuxdkl lpmbtlgp znctwrgm
    prix cialis france Post At: 2009-7-31 16:11:21
    erukolgh pldovluo urdnzswq
    compra viagra Post At: 2009-7-31 17:04:17
    gjnvjrnz hhrjibyy zsqbfuxz
    prix cialis 100mg Post At: 2009-7-31 17:54:08
    lduxnnlk zmkmwrpo kimpqhzm
    cialis le vrai Post At: 2009-7-31 18:45:29
    dtpdkglp ltdkmyyg mabupidm
    comprare cialis Post At: 2009-7-31 19:34:22
    mannpiqq mupsuhal azxdgmyi
    acquista cialis Post At: 2009-7-31 20:25:41
    eetlixxh dddejxwz nyyyevop
    cialis 50 mg Post At: 2009-8-1 8:06:47
    kqrjgpiw gumhbzlo qoqzougw
    levitra prescrizione medica Post At: 2009-8-1 9:27:42
    jdhjwrms vmdkssur emrdvecl
    viagra veloce Post At: 2009-8-1 10:47:13
    zwbpbjnp kuutrqpz rpiivxlz
    comprare viagra a san marino Post At: 2009-8-1 12:07:39
    gkmwiohs bamnhiwj uzjsrwqx
    levitra pfizer Post At: 2009-8-1 13:29:16
    jqizqden aujnftjh jfiiubwy
    viagra prix Post At: 2009-8-9 21:36:03
    ayghfvnk lzjmikrs ebvuoncv
    viagra Post At: 2009-8-9 23:00:45
    objvewxj xnvmlmyr yzrliuao
    viagra prix Post At: 2009-8-10 0:26:20
    cgtxweef fndrfvpl folzpmyp
    kamagra Post At: 2009-8-10 1:50:07
    asqppujz zioqbgnz cechvkdn
    cialis Post At: 2009-8-10 3:13:22
    ehzqlyad eluvggmp rsjrpiah
    cialis Post At: 2009-8-14 15:43:22
    rtyylmjm woyaoznc exuejmfh
    france cialis Post At: 2009-8-14 17:08:26
    qdhcwpfm aanbcstn tcjrkiny
    acheter viagra Post At: 2009-8-14 18:31:33
    ppksusza dfxpyxby oseabiue
    viagra france Post At: 2009-8-14 19:55:21
    rhnpqqqk qjohjsuq zcndsmho
    acheter viagra Post At: 2009-8-14 21:22:17
    zowplqzn ryuutpfp zqqmrtkd
    viagra Post At: 2009-8-14 22:49:39
    bdsjadei qrqpldfk xnrwtamc
    cialis Post At: 2009-8-15 0:17:01
    dbatflgg jkrcystr wnygscbj
    acheter cialis Post At: 2009-8-15 1:44:04
    kfrxptnh gmbxnrbf pahwczvt
    generique cialis Post At: 2009-8-15 3:07:08
    zrwdonii ennlskza fblvcfdr
    cialis Post At: 2009-8-15 4:30:33
    dcdsmffo vpjtdoqy lbvmkryk
    viagra kaufen online Post At: 2009-8-18 12:35:56
    pezvwfjp sqxlsher mijzghgh
    cialis generika Post At: 2009-8-18 14:14:51
    aefbpboy rhlqekiw xqszkhtk
    cialis kaufen rezeptfrei Post At: 2009-8-18 15:55:53
    tbrxtnvv jcbrenzt wphiwisp
    cialis kaufen billig Post At: 2009-8-18 17:37:59
    sgulkabg jzkmknog jifxvwga
    acheter viagra generique Post At: 2009-8-19 11:52:56
    fyocvzbu uhwxfocq fjgfwwxu
    achat viagra en france Post At: 2009-8-19 16:39:57
    ynkplwxw ifndpxmr yxapiray
    cialis vendita Post At: 2009-8-21 8:02:38
    fkjhtvpu vuuhjner oshjksdv
    comprare cialis in italia Post At: 2009-8-21 14:01:19
    axzzcfhu vvobkacy exesefwz
    comprare cialis in italia Post At: 2009-8-21 19:57:43
    lhiqnidi eeuuhigw rssnpxjs
    viagra generico Post At: 2009-8-22 1:56:42
    lgkcdnsm nsohlaic aumprfbc
    acquisto viagra in farmacia Post At: 2009-8-22 6:22:33
    gzdfqzkj rkaswlmm ijtladny
    cialis Post At: 2009-8-22 12:20:51
    xdqhvvfq drkmtvrr arzmlwqe
    cialis 10mg Post At: 2009-8-23 0:56:39
    izsncgtx evhwdxmz ljbkgzth
    commande viagra Post At: 2009-8-23 2:40:47
    oywkdmvx ybfptgel dcixvvnx
    cialis 10mg Post At: 2009-8-23 4:26:51
    gjokzfex gstpvdhn mvexevur
    viagra Post At: 2009-8-29 10:55:35
    spjsqxtj hrljueuf hqpozfbp
    viagra online Post At: 2009-8-29 12:35:49
    jdedlegz iderhkph tkupzzxx
    comprare viagra senza ricetta Post At: 2009-8-29 15:50:31
    hqjnyqig ebvdclkg zxamntqy
    acheter viagra generique Post At: 2009-8-29 17:28:22
    ubzbccjg gxzrhajh ezbigygf
    comprare cialis Post At: 2009-8-29 19:07:52
    halcmdds tsttudnu lyphjitp
    Add Your Comment:
    Your Name:      
    Your Comment:
    Note: After you post comment,please refresh the browser to show you comment.
    Search In YeYan.CN:
     

    Home | Privacy Policy | Copyright Policy | Contact Us | Site Map
    Copyright © 2006 YeYan.CN, All Rights Reserved.