다음을 통해 공유


Editor Imports

You can import a number of editor services, factories, and brokers that provide your extension with different kinds of access to the core editor. For example, you can import the ITextStructureNavigatorSelectorService to provide you with a ITextStructureNavigator for a given content type. (This navigator allows you perform different kinds of searches on a text buffer.)

To use an editor import, you import it as a field or property of a class that exports a Managed Extensibility Framework component part.

Note

For more information about the Managed Extensibility Framework, see Managed Extensibility Framework Overview.

Import Syntax

The following example shows how to import the editor options factory service.

[Import]
internal IEditorOptionsFactoryService EditorOptions { get; set; }

If you want to import the service as a field and not a property, you should set it to null in the declaration in order to avoid the compiler warnings about not assigning to a variable:

[Import]
internal IEditorOptionsFactoryService m_editorOptions = null;

For more examples of using imports, see the following walkthroughs:

Walkthrough: Creating a Margin Glyph

Walkthrough: Customizing the Text View

Walkthrough: Highlighting Text

Walkthrough: Displaying QuickInfo Tooltips

Walkthrough: Displaying Signature Help

Walkthrough: Displaying Statement Completion

Walkthrough: Displaying SmartTags

Importing the Service Provider

You can also import a SVsServiceProvider (found in the assembly Microsoft.VisualStudio.Shell.Immutable.10.0) in the same way to get access to Visual Studio services:

[Import]
internal SVsServiceProvider ServiceProvider = null; 

See Walkthrough: Accessing the DTE Object from an Editor Extension for more information.

Services

Editor services are generally single entities that provide a service and are shared across multiple components.

Import

Provides

IFileExtensionRegistryService

The relationship between file extensions and IContentType objects.

IContentTypeRegistryService

The collection of IContentType objects.

IVsFontsAndColorsInformationService

IVsFontsAndColorsInformation objects

IVsEditorAdaptersFactoryService

Many editor adapter objects:

IVsCodeWindow

IVsTextBuffer

IVsTextBufferCoordinator

IVsTextView

IIncrementalSearchFactoryService

An IIncrementalSearch object for a given text view.

ITextBufferFactoryService

An ITextBuffer.

ITextDocumentFactoryService

An ITextDocument.

IDifferenceService

An IDifferenceCollection<T> of differences.

IHierarchicalStringDifferenceService

An IHierarchicalDifferenceCollection of differences.

IProjectionBufferFactoryService

An IProjectionBuffer or an IElisionBuffer.

IBufferGraphFactoryService

An IBufferGraph for a set of ITextBuffer objects.

IClassifierAggregatorService

An IClassifier for a ITextBuffer.

IViewClassifierAggregatorService

An IClassifier for a ITextView.

IClassificationFormatMapService

An IClassificationFormatMap for a ITextView.

IEditorFormatMapService

An IEditorFormatMap for a ITextView.

IClassificationTypeRegistryService

Maintains the collection of IClassificationType objects.

IBufferTagAggregatorFactoryService

An ITagAggregator<T> for a text buffer.

IViewTagAggregatorFactoryService

An ITagAggregator<T> for a text view.

IEditorOptionsFactoryService

The IEditorOptions for the specified scope.

IScrollMapFactoryService

An IScrollMap for a text view.

ISmartIndentationService

An ISmartIndent for a ITextView.

ISmartIndentationService

Gets the automatic indentation through the ISmartIndentProvider objects.

ITextEditorFactoryService

Manages the IWpfTextViewHost for a IWpfTextView.

IFormattedTextSourceFactoryService

An IFormattedLineSource.

IRtfBuilderService

Generates RTF-formatted text from a set of snapshot spans.

ITextAndAdornmentSequencerFactoryService

An ITextAndAdornmentSequencer for an ITextView.

ITextParagraphPropertiesFactoryService

A TextParagraphProperties for formatting text lines in a view.

IEditorOperationsFactoryService

A IEditorOperations object for an ITextView.

ITextSearchService

Searches a text snapshot.

ITextStructureNavigatorSelectorService

An ITextStructureNavigator for an ITextBuffer by IContentType.

IOutliningManagerService

An IOutliningManager for a text view.

IGlyphService

A standard set of glyphs.

IIntellisenseSessionStackMapService

An IIntellisenseSessionStack for a ITextView.

IWpfKeyboardTrackingService

Tracks keyboard handling.

IStandardClassificationService

Standard IClassificationType objects.

ITextUndoHistoryRegistry

Maintains the relationship between text buffers and ITextUndoHistory objects.

Other Imports

Provider factories and brokers are generally entities that can have multiple instances in multiple components.

Import

Provides

IErrorProviderFactory

A SimpleTagger<T> of type ErrorTag) for the given buffer.

ITextMarkerProviderFactory

A text marker tagger (a SimpleTagger<T> of type TextMarkerTag).

IToolTipProviderFactory

An IToolTipProvider for a given ITextView.

ICompletionBroker

An ICompletionSession.

IQuickInfoBroker

An IQuickInfoSession.

ISignatureHelpBroker

An ISignatureHelpSession.

See Also

Concepts

Editor Extension Points