Freigeben über


IntelliSense Hosting

Visual Studio enables IntelliSense hosting. IntellSense hosting lets you provide IntelliSense for code that is not hosted by the Visual Studio text editor.

IntelliSense Hosting Usage

In Visual Studio, any code that has access to a completion set and a text buffer can obtain IntelliSense windows from anywhere in the user interface (UI). Some example scenarios of this are completion in the Watch window or in the condition field of a breakpoint properties window.

Bb165058.collapse_all(de-de,VS.110).gifImplementation Interfaces

Bb165058.collapse_all(de-de,VS.110).gifIVsIntellisenseHost

Any UI component that hosts IntelliSense pop-up windows must support the IVsIntellisenseHost interface. The default core editor text view includes a stock IVsIntellisenseHost interface implementation to retain the current IntelliSense functionality. For the most part, the methods of the IVsIntellisenseHost interface represent a subset of what is implemented on the IVsTextView interface. The subset includes IntelliSense UI handling, caret and selection manipulation, and simple text replacement functionality. In addition, the IVsIntellisenseHost interface enables separate IntelliSense "subject" and "context" so that IntelliSense can be provided for subjects that do not directly exist in the text buffer that is being used for context.

Bb165058.collapse_all(de-de,VS.110).gifIVsIntellisenseHost.GetHostFlags

An IVsIntellisenseHost interface provider must implement the GetHostFlags method to enable a client to determine what type of IntelliSense features the host supports.

The host flags, defined in IntelliSenseHostFlags, are summarized below.

IntelliSense Host Flag

Description

IHF_READONLYCONTEXT

Setting this flag means that the context buffer is read-only and editing occurs only within the subject text.

IHF_NOSEPERATESUBJECT

Setting this flag means that there is no separate IntelliSense subject. The subject exists in the context buffer, such as in the traditional IVsTextView IntelliSense system.

IHF_SINGLELINESUBJECT

Setting this flag means that the subject is not multi-line capable, such as in a single line edit in the Watch window.

IHF_FORCECOMMITTOCONTEXT

If this flag is set and the context buffer must be updated, the host enables the read-only flag on the context buffer to be ignored and edits to proceed.

IHF_OVERTYPE

Editing (in subject or context) should be done in overtype mode.

Bb165058.collapse_all(de-de,VS.110).gifIVsIntellisenseHost.BeforeCompletorCommit and IVsIntellisenseHost.AfterCompletorCommit

These callback methods are called by the completion window before and after text is committed, to enable pre-processing and post-processing.

Bb165058.collapse_all(de-de,VS.110).gifIVsIntellisenseCompletor

The IVsIntellisenseCompletor interface is a co-creatable version of the standard completion window that is used by the integrated development environment (IDE). Any IVsIntellisenseHost interface can quickly implement IntelliSense by using this completor interface.

See Also

Reference

Microsoft.VisualStudio.TextManager.Interop