本文整理汇总了C#中IContentTypeRegistryService类的典型用法代码示例。如果您正苦于以下问题:C# IContentTypeRegistryService类的具体用法?C# IContentTypeRegistryService怎么用?C# IContentTypeRegistryService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IContentTypeRegistryService类属于命名空间,在下文中一共展示了IContentTypeRegistryService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TryCreate
public static CodeEditorOptions TryCreate(ITextViewOptionsGroup group, IContentTypeRegistryService contentTypeRegistryService, ICodeEditorOptionsDefinitionMetadata md) {
if (group == null)
throw new ArgumentNullException(nameof(group));
if (contentTypeRegistryService == null)
throw new ArgumentNullException(nameof(contentTypeRegistryService));
if (md == null)
throw new ArgumentNullException(nameof(md));
if (md.ContentType == null)
return null;
var contentType = contentTypeRegistryService.GetContentType(md.ContentType);
if (contentType == null)
return null;
if (md.Guid == null)
return null;
Guid guid;
if (!Guid.TryParse(md.Guid, out guid))
return null;
if (md.LanguageName == null)
return null;
return new CodeEditorOptions(group, contentType, guid, md.LanguageName);
}
示例2: EditorTextFactoryService
public EditorTextFactoryService(
ITextBufferFactoryService textBufferFactoryService,
IContentTypeRegistryService contentTypeRegistryService)
{
_textBufferFactory = textBufferFactoryService;
_unknownContentType = contentTypeRegistryService.UnknownContentType;
}
示例3: VsInteractiveWindowEditorFactoryService
public VsInteractiveWindowEditorFactoryService(IVsEditorAdaptersFactoryService adaptersFactory, IContentTypeRegistryService contentTypeRegistry, [ImportMany]IEnumerable<Lazy<IVsInteractiveWindowOleCommandTargetProvider, ContentTypeMetadata>> oleCommandTargetProviders)
{
_adapterFactory = adaptersFactory;
_provider = (IOleServiceProvider)InteractiveWindowPackage.GetGlobalService(typeof(IOleServiceProvider));
_contentTypeRegistry = contentTypeRegistry;
_oleCommandTargetProviders = oleCommandTargetProviders;
}
示例4: InteractiveWindowProvider
public InteractiveWindowProvider(
IContentTypeRegistryService contentTypeRegistry,
ITextBufferFactoryService bufferFactory,
IProjectionBufferFactoryService projectionBufferFactory,
IEditorOperationsFactoryService editorOperationsFactory,
ITextBufferUndoManagerProvider textBufferUndoManagerProvider,
ITextEditorFactoryService editorFactory,
IRtfBuilderService rtfBuilderService,
IIntellisenseSessionStackMapService intellisenseSessionStackMap,
ISmartIndentationService smartIndenterService,
IInteractiveWindowEditorFactoryService windowFactoryService,
IWaitIndicator waitIndicator)
{
_contentTypeRegistry = contentTypeRegistry;
_bufferFactory = bufferFactory;
_projectionBufferFactory = projectionBufferFactory;
_editorOperationsFactory = editorOperationsFactory;
_textBufferUndoManagerProvider = textBufferUndoManagerProvider;
_editorFactory = editorFactory;
_rtfBuilderService = rtfBuilderService;
_intellisenseSessionStackMap = intellisenseSessionStackMap;
_smartIndenterService = smartIndenterService;
_windowFactoryService = windowFactoryService;
_waitIndicator = waitIndicator;
}
示例5: TextViewOptionsGroupService
TextViewOptionsGroupService(ISettingsService settingsService, IContentTypeRegistryService contentTypeRegistryService, [ImportMany] IEnumerable<Lazy<ITextViewOptionsGroupNameProvider, ITextViewOptionsGroupNameProviderMetadata>> textViewOptionsGroupNameProviders, [ImportMany] IEnumerable<Lazy<IContentTypeOptionDefinitionProvider, IContentTypeOptionDefinitionProviderMetadata>> contentTypeOptionDefinitionProviders) {
nameToGroup = new Dictionary<string, TextViewOptionsGroup>(StringComparer.Ordinal);
this.contentTypeRegistryService = contentTypeRegistryService;
this.textViewOptionsGroupNameProviders = textViewOptionsGroupNameProviders.OrderBy(a => a.Metadata.Order).ToArray();
this.contentTypeOptionDefinitionProviders = contentTypeOptionDefinitionProviders.OrderBy(a => a.Metadata.Order).ToArray();
optionsStorage = new OptionsStorage(settingsService);
}
示例6: DocumentProvider
/// <summary>
/// Creates a document provider.
/// </summary>
/// <param name="projectContainer">Project container for the documents.</param>
/// <param name="serviceProvider">Service provider</param>
/// <param name="documentTrackingService">An optional <see cref="VisualStudioDocumentTrackingService"/> to track active and visible documents.</param>
public DocumentProvider(
IVisualStudioHostProjectContainer projectContainer,
IServiceProvider serviceProvider,
VisualStudioDocumentTrackingService documentTrackingService)
{
var componentModel = (IComponentModel)serviceProvider.GetService(typeof(SComponentModel));
_projectContainer = projectContainer;
this._documentTrackingServiceOpt = documentTrackingService;
this._runningDocumentTable = (IVsRunningDocumentTable4)serviceProvider.GetService(typeof(SVsRunningDocumentTable));
this._editorAdaptersFactoryService = componentModel.GetService<IVsEditorAdaptersFactoryService>();
this._contentTypeRegistryService = componentModel.GetService<IContentTypeRegistryService>();
_textUndoHistoryRegistry = componentModel.GetService<ITextUndoHistoryRegistry>();
_textManager = (IVsTextManager)serviceProvider.GetService(typeof(SVsTextManager));
_fileChangeService = (IVsFileChangeEx)serviceProvider.GetService(typeof(SVsFileChangeEx));
var shell = (IVsShell)serviceProvider.GetService(typeof(SVsShell));
if (shell == null)
{
// This can happen only in tests, bail out.
return;
}
var runningDocumentTableForEvents = (IVsRunningDocumentTable)_runningDocumentTable;
Marshal.ThrowExceptionForHR(runningDocumentTableForEvents.AdviseRunningDocTableEvents(new RunningDocTableEventsSink(this), out _runningDocumentTableEventCookie));
}
示例7: VsInteractiveWindowCommandFilter
public VsInteractiveWindowCommandFilter(IVsEditorAdaptersFactoryService adapterFactory, IInteractiveWindow window, IVsTextView textViewAdapter, IVsTextBuffer bufferAdapter, IEnumerable<Lazy<IVsInteractiveWindowOleCommandTargetProvider, ContentTypeMetadata>> oleCommandTargetProviders, IContentTypeRegistryService contentTypeRegistry)
{
_window = window;
_oleCommandTargetProviders = oleCommandTargetProviders;
_contentTypeRegistry = contentTypeRegistry;
this.textViewAdapter = textViewAdapter;
// make us a code window so we'll have the same colors as a normal code window.
IVsTextEditorPropertyContainer propContainer;
ErrorHandler.ThrowOnFailure(((IVsTextEditorPropertyCategoryContainer)textViewAdapter).GetPropertyCategory(Microsoft.VisualStudio.Editor.DefGuidList.guidEditPropCategoryViewMasterSettings, out propContainer));
propContainer.SetProperty(VSEDITPROPID.VSEDITPROPID_ViewComposite_AllCodeWindowDefaults, true);
propContainer.SetProperty(VSEDITPROPID.VSEDITPROPID_ViewGlobalOpt_AutoScrollCaretOnTextEntry, true);
// editor services are initialized in textViewAdapter.Initialize - hook underneath them:
_preEditorCommandFilter = new CommandFilter(this, CommandFilterLayer.PreEditor);
ErrorHandler.ThrowOnFailure(textViewAdapter.AddCommandFilter(_preEditorCommandFilter, out _editorCommandFilter));
textViewAdapter.Initialize(
(IVsTextLines)bufferAdapter,
IntPtr.Zero,
(uint)TextViewInitFlags.VIF_HSCROLL | (uint)TextViewInitFlags.VIF_VSCROLL | (uint)TextViewInitFlags3.VIF_NO_HWND_SUPPORT,
new[] { new INITVIEW { fSelectionMargin = 0, fWidgetMargin = 0, fVirtualSpace = 0, fDragDropMove = 1 } });
// disable change tracking because everything will be changed
var textViewHost = adapterFactory.GetWpfTextViewHost(textViewAdapter);
_preLanguageCommandFilter = new CommandFilter(this, CommandFilterLayer.PreLanguage);
ErrorHandler.ThrowOnFailure(textViewAdapter.AddCommandFilter(_preLanguageCommandFilter, out _editorServicesCommandFilter));
_textViewHost = textViewHost;
}
示例8: StreamingFindReferencesPresenter
public StreamingFindReferencesPresenter(
Shell.SVsServiceProvider serviceProvider,
ITextBufferFactoryService textBufferFactoryService,
IProjectionBufferFactoryService projectionBufferFactoryService,
IEditorOptionsFactoryService editorOptionsFactoryService,
ITextEditorFactoryService textEditorFactoryService,
IContentTypeRegistryService contentTypeRegistryService,
ClassificationTypeMap typeMap,
IEditorFormatMapService formatMapService,
[ImportMany] IEnumerable<Lazy<IAsynchronousOperationListener, FeatureMetadata>> asyncListeners)
{
_serviceProvider = serviceProvider;
_textBufferFactoryService = textBufferFactoryService;
_projectionBufferFactoryService = projectionBufferFactoryService;
_editorOptionsFactoryService = editorOptionsFactoryService;
_contentTypeRegistryService = contentTypeRegistryService;
_textEditorFactoryService = textEditorFactoryService;
_typeMap = typeMap;
_formatMapService = formatMapService;
_asyncListener = new AggregateAsynchronousOperationListener(
asyncListeners, FeatureAttribute.ReferenceHighlighting);
_vsFindAllReferencesService = (IFindAllReferencesService)_serviceProvider.GetService(typeof(SVsFindAllReferences));
}
示例9: AboutScreenMenuItem
AboutScreenMenuItem(IDocumentViewerContentFactoryProvider documentViewerContentFactoryProvider, IDocumentTabService documentTabService, IAppWindow appWindow, IExtensionService extensionService, IContentTypeRegistryService contentTypeRegistryService) {
this.documentViewerContentFactoryProvider = documentViewerContentFactoryProvider;
this.documentTabService = documentTabService;
this.appWindow = appWindow;
this.extensionService = extensionService;
aboutContentType = contentTypeRegistryService.GetContentType(ContentTypes.AboutDnSpy);
}
示例10: MarkdownCodeTest
public MarkdownCodeTest(MarkdownEditorMefCatalogFixture catalogFixture) {
_exportProvider = catalogFixture.CreateExportProvider();
_crs = _exportProvider.GetExportedValue<IClassificationTypeRegistryService>();
_ctrs = _exportProvider.GetExportedValue<IContentTypeRegistryService>();
_cnp = _exportProvider.GetExports<IClassificationNameProvider, IComponentContentTypes>();
_tbfs = _exportProvider.GetExportedValue<ITextBufferFactoryService>();
}
示例11: JadeClassifierProvider
public JadeClassifierProvider(IClassificationTypeRegistryService registryService,
ITextBufferFactoryService bufferFact,
IContentTypeRegistryService contentTypeService,
[ImportMany(typeof(ITaggerProvider))]Lazy<ITaggerProvider, TaggerProviderMetadata>[] taggerProviders,
[ImportMany(typeof(IClassifierProvider))]Lazy<IClassifierProvider, IClassifierProviderMetadata>[] classifierProviders) {
ClassificationRegistryService = registryService;
BufferFactoryService = bufferFact;
JsContentType = contentTypeService.GetContentType(NodejsConstants.JavaScript);
CssContentType = contentTypeService.GetContentType(NodejsConstants.CSS);
var jsTagger = taggerProviders.Where(
provider =>
provider.Metadata.ContentTypes.Contains(NodejsConstants.JavaScript) &&
provider.Metadata.TagTypes.Any(tagType => tagType.IsSubclassOf(typeof(ClassificationTag)))
).FirstOrDefault();
if (JsTaggerProvider != null) {
JsTaggerProvider = jsTagger.Value;
}
var cssTagger = classifierProviders.Where(
provider => provider.Metadata.ContentTypes.Any(x => x.Equals("css", StringComparison.OrdinalIgnoreCase))
).FirstOrDefault();
if (cssTagger != null) {
CssClassifierProvider = cssTagger.Value;
}
}
示例12: DocumentProvider
public DocumentProvider(
IVisualStudioHostProjectContainer projectContainer,
IServiceProvider serviceProvider,
bool signUpForFileChangeNotification)
{
var componentModel = (IComponentModel)serviceProvider.GetService(typeof(SComponentModel));
_projectContainer = projectContainer;
this.RunningDocumentTable = (IVsRunningDocumentTable4)serviceProvider.GetService(typeof(SVsRunningDocumentTable));
this.EditorAdaptersFactoryService = componentModel.GetService<IVsEditorAdaptersFactoryService>();
this.ContentTypeRegistryService = componentModel.GetService<IContentTypeRegistryService>();
_textUndoHistoryRegistry = componentModel.GetService<ITextUndoHistoryRegistry>();
_textManager = (IVsTextManager)serviceProvider.GetService(typeof(SVsTextManager));
// In the CodeSense scenario we will receive file change notifications from the native
// Language Services, so we don't want to sign up for them ourselves.
if (signUpForFileChangeNotification)
{
_fileChangeService = (IVsFileChangeEx)serviceProvider.GetService(typeof(SVsFileChangeEx));
}
var shell = (IVsShell)serviceProvider.GetService(typeof(SVsShell));
if (shell == null)
{
// This can happen only in tests, bail out.
return;
}
int installed;
Marshal.ThrowExceptionForHR(shell.IsPackageInstalled(Guids.RoslynPackageId, out installed));
IsRoslynPackageInstalled = installed != 0;
var runningDocumentTableForEvents = (IVsRunningDocumentTable)RunningDocumentTable;
Marshal.ThrowExceptionForHR(runningDocumentTableForEvents.AdviseRunningDocTableEvents(new RunningDocTableEventsSink(this), out _runningDocumentTableEventCookie));
}
示例13: TextStructureNavigatorProvider
internal TextStructureNavigatorProvider(
ITextStructureNavigatorSelectorService selectorService,
IContentTypeRegistryService contentTypeService,
IWaitIndicator waitIndicator)
: base(selectorService, contentTypeService, waitIndicator)
{
}
示例14: VsRInteractiveWindowComponentContainerFactory
public VsRInteractiveWindowComponentContainerFactory(
Lazy<IVsInteractiveWindowFactory> vsInteractiveWindowFactory,
IContentTypeRegistryService contentTypeRegistryService,
ICoreShell shell) {
_vsInteractiveWindowFactoryLazy = vsInteractiveWindowFactory;
_contentTypeRegistryService = contentTypeRegistryService;
_shell = shell;
}
示例15: Utils
private Utils()
{
_dte = (DTE)ServiceProvider.GlobalProvider.GetService(typeof(DTE));
IComponentModel componentModel = (IComponentModel)Package.GetGlobalService(
typeof(SComponentModel));
_contentTypeRegistryService = componentModel.GetService<IContentTypeRegistryService>();
}