当前位置: 首页>>代码示例>>C#>>正文


C# IContentTypeRegistryService.GetContentType方法代码示例

本文整理汇总了C#中IContentTypeRegistryService.GetContentType方法的典型用法代码示例。如果您正苦于以下问题:C# IContentTypeRegistryService.GetContentType方法的具体用法?C# IContentTypeRegistryService.GetContentType怎么用?C# IContentTypeRegistryService.GetContentType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IContentTypeRegistryService的用法示例。


在下文中一共展示了IContentTypeRegistryService.GetContentType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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;
            }
        }
开发者ID:lioaphy,项目名称:nodejstools,代码行数:26,代码来源:JadeClassifierProvider.cs

示例2: TextBufferFactoryService

		TextBufferFactoryService(IContentTypeRegistryService contentTypeRegistryService) {
			this.contentTypeRegistryService = contentTypeRegistryService;
			InertContentType = contentTypeRegistryService.GetContentType(ContentTypes.Inert);
			PlaintextContentType = contentTypeRegistryService.GetContentType(ContentTypes.PlainText);
			TextContentType = contentTypeRegistryService.GetContentType(ContentTypes.Text);
			Debug.Assert(InertContentType != null);
			Debug.Assert(PlaintextContentType != null);
			Debug.Assert(TextContentType != null);
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:9,代码来源:TextBufferFactoryService.cs

示例3: SendHistoryToSourceCommand

        public SendHistoryToSourceCommand(ITextView textView, IRHistoryProvider historyProvider, IRInteractiveWorkflow interactiveWorkflow, IContentTypeRegistryService contentTypeRegistry, IActiveWpfTextViewTracker textViewTracker)
            : base(textView, RGuidList.RCmdSetGuid, RPackageCommandId.icmdSendHistoryToSource, false) {

            _textViewTracker = textViewTracker;
            _interactiveWorkflow = interactiveWorkflow;
            _history = historyProvider.GetAssociatedRHistory(textView);

            _contentTypes.Add(contentTypeRegistry.GetContentType(RContentTypeDefinition.ContentType));
            _contentTypes.Add(contentTypeRegistry.GetContentType(MdProjectionContentTypeDefinition.ContentType));
        }
开发者ID:Microsoft,项目名称:RTVS,代码行数:10,代码来源:SendHistoryToSourceCommand.cs

示例4: 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);
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:25,代码来源:CodeEditorOptions.cs

示例5: ProjectionBufferManager

        public ProjectionBufferManager(ITextBuffer diskBuffer,
                                       IProjectionBufferFactoryService projectionBufferFactoryService,
                                       IContentTypeRegistryService contentTypeRegistryService,
                                       ICoreShell coreShell,
                                       string topLevelContentTypeName,
                                       string secondaryContentTypeName) {
            DiskBuffer = diskBuffer;

            _contentTypeRegistryService = contentTypeRegistryService;

            var contentType = _contentTypeRegistryService.GetContentType(topLevelContentTypeName);
            ViewBuffer = projectionBufferFactoryService.CreateProjectionBuffer(null, new List<object>(0), ProjectionBufferOptions.None, contentType);

            contentType = _contentTypeRegistryService.GetContentType(secondaryContentTypeName);
            ContainedLanguageBuffer = projectionBufferFactoryService.CreateProjectionBuffer(null, new List<object>(0), ProjectionBufferOptions.WritableLiteralSpans, contentType);

            ServiceManager.AddService<IProjectionBufferManager>(this, DiskBuffer, coreShell);
            ServiceManager.AddService<IProjectionBufferManager>(this, ViewBuffer, coreShell);
        }
开发者ID:Microsoft,项目名称:RTVS,代码行数:19,代码来源:ProjectionBufferManager.cs

示例6: PythonAnalysisClassifierProvider

 public PythonAnalysisClassifierProvider(IContentTypeRegistryService contentTypeRegistryService, [Import(typeof(SVsServiceProvider))]IServiceProvider serviceProvider) {
     _type = contentTypeRegistryService.GetContentType(PythonCoreConstants.ContentType);
     _serviceProvider = serviceProvider;
     var options = serviceProvider.GetPythonToolsService()?.AdvancedOptions;
     if (options != null) {
         options.Changed += AdvancedOptions_Changed;
         _colorNames = options.ColorNames;
         _colorNamesWithAnalysis = options.ColorNamesWithAnalysis;
     }
 }
开发者ID:jsschultz,项目名称:PTVS,代码行数:10,代码来源:PythonAnalysisClassifierProvider.cs

示例7: RHistoryProvider

 public RHistoryProvider(ITextBufferFactoryService textBufferFactory, IContentTypeRegistryService contentTypeRegistryService, IFileSystem fileSystem, IEditorOperationsFactoryService editorOperationsFactory, IRtfBuilderService rtfBuilderService, ITextSearchService2 textSearchService, IRSettings settings) {
     _textBufferFactory = textBufferFactory;
     _fileSystem = fileSystem;
     _editorOperationsFactory = editorOperationsFactory;
     _rtfBuilderService = rtfBuilderService;
     _textSearchService = textSearchService;
     _settings = settings;
     _rtfBuilderService = rtfBuilderService;
     _contentType = contentTypeRegistryService.GetContentType(RHistoryContentTypeDefinition.ContentType);
     _histories = new Dictionary<ITextBuffer, IRHistory>();
 }
开发者ID:AlexanderSher,项目名称:RTVS-Old,代码行数:11,代码来源:RHistoryProvider.cs

示例8: TemplateClassifierProviderBase

 protected TemplateClassifierProviderBase(string contentTypeName, IContentTypeRegistryService contentTypeRegistryService, IClassificationTypeRegistryService classificationRegistry) {
     _contentType = contentTypeRegistryService.GetContentType(contentTypeName);
     _classType = classificationRegistry.GetClassificationType(PredefinedClassificationTypeNames.Operator);
     _templateClassType = classificationRegistry.GetClassificationType(DjangoPredefinedClassificationTypeNames.TemplateTag);
     _commentClassType = classificationRegistry.GetClassificationType(PredefinedClassificationTypeNames.Comment);
     _identifierType = classificationRegistry.GetClassificationType(PredefinedClassificationTypeNames.Identifier);
     _literalType = classificationRegistry.GetClassificationType(PredefinedClassificationTypeNames.Literal);
     _numberType = classificationRegistry.GetClassificationType(PredefinedClassificationTypeNames.Number);
     _dot = classificationRegistry.GetClassificationType(PythonPredefinedClassificationTypeNames.Dot);
     _keywordType = classificationRegistry.GetClassificationType(PredefinedClassificationTypeNames.Keyword);
     _excludedCode = classificationRegistry.GetClassificationType(PredefinedClassificationTypeNames.ExcludedCode);
 }
开发者ID:wenh123,项目名称:PTVS,代码行数:12,代码来源:TemplateClassifierProviderBase.cs

示例9: CodeEditor

		public CodeEditor(CodeEditorOptions options, IDsTextEditorFactoryService dsTextEditorFactoryService, IContentTypeRegistryService contentTypeRegistryService, ITextBufferFactoryService textBufferFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService) {
			options = options?.Clone() ?? new CodeEditorOptions();
			options.CreateGuidObjects = CommonGuidObjectsProvider.Create(options.CreateGuidObjects, new GuidObjectsProvider(this));
			var contentType = contentTypeRegistryService.GetContentType(options.ContentType, options.ContentTypeString) ?? textBufferFactoryService.TextContentType;
			var textBuffer = options.TextBuffer;
			if (textBuffer == null)
				textBuffer = textBufferFactoryService.CreateTextBuffer(contentType);
			var roles = dsTextEditorFactoryService.CreateTextViewRoleSet(options.Roles);
			var textView = dsTextEditorFactoryService.CreateTextView(textBuffer, roles, editorOptionsFactoryService.GlobalOptions, options);
			TextViewHost = dsTextEditorFactoryService.CreateTextViewHost(textView, false);
			TextViewHost.TextView.Options.SetOptionValue(DefaultWpfViewOptions.AppearanceCategory, AppearanceCategoryConstants.TextEditor);
			TextViewHost.TextView.Options.SetOptionValue(DefaultDsTextViewOptions.RefreshScreenOnChangeId, true);
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:13,代码来源:CodeEditor.cs

示例10: Commands

        internal Commands(IInteractiveWindow window, string prefix, IEnumerable<IInteractiveWindowCommand> commands, IContentTypeRegistryService contentTypeRegistry = null, IStandardClassificationService classificationRegistry = null)
        {
            CommandPrefix = prefix;
            _window = window;

            Dictionary<string, IInteractiveWindowCommand> commandsDict = new Dictionary<string, IInteractiveWindowCommand>();
            foreach (var command in commands)
            {
                int length = 0;
                foreach (var name in command.Names)
                {
                    if (commandsDict.ContainsKey(name))
                    {
                        throw new InvalidOperationException(string.Format(InteractiveWindowResources.DuplicateCommand, string.Join(_commandSeparator, command.Names)));
                    }
                    if (length != 0)
                    {
                        length += _commandSeparator.Length;
                    }
                    // plus the length of `#` for display purpose
                    length += name.Length + 1;

                    commandsDict[name] = command;
                }
                if (length == 0)
                {
                    throw new InvalidOperationException(string.Format(InteractiveWindowResources.MissingCommandName, command.GetType().Name));
                }
                _maxCommandNameLength = Math.Max(_maxCommandNameLength, length);
            }

            _commands = commandsDict;

            _classificationRegistry = classificationRegistry;

            if (contentTypeRegistry != null)
            {
                _commandContentType = contentTypeRegistry.GetContentType(PredefinedInteractiveCommandsContentTypes.InteractiveCommandContentTypeName);
            }

            if (window != null)
            {
                window.SubmissionBufferAdded += Window_SubmissionBufferAdded;
                window.Properties[typeof(IInteractiveWindowCommands)] = this;
            }
        }
开发者ID:robertoenbarcelona,项目名称:roslyn,代码行数:46,代码来源:InteractiveWindowCommands.cs

示例11: CSharpInteractiveEvaluator

 public CSharpInteractiveEvaluator(
     HostServices hostServices,
     IViewClassifierAggregatorService classifierAggregator,
     IInteractiveWindowCommandsFactory commandsFactory,
     ImmutableArray<IInteractiveWindowCommand> commands,
     IContentTypeRegistryService contentTypeRegistry,
     string responseFileDirectory,
     string initialWorkingDirectory)
     : base(
         contentTypeRegistry.GetContentType(ContentTypeNames.CSharpContentType),
         hostServices,
         classifierAggregator,
         commandsFactory,
         commands,
         (responseFileDirectory != null) ? Path.Combine(responseFileDirectory, InteractiveResponseFile) : null,
         initialWorkingDirectory,
         typeof(InteractiveHostEntryPoint).Assembly.Location,
         typeof(CSharpReplServiceProvider))
 {
 }
开发者ID:benbon,项目名称:roslyn,代码行数:20,代码来源:CSharpInteractiveEvaluator.cs

示例12: Commands

        internal Commands(IInteractiveWindow window, string prefix, IEnumerable<IInteractiveWindowCommand> commands, IContentTypeRegistryService contentTypeRegistry = null, IStandardClassificationService classificationRegistry = null)
        {
            CommandPrefix = prefix;
            this.window = window;

            Dictionary<string, IInteractiveWindowCommand> commandsDict = new Dictionary<string, IInteractiveWindowCommand>();
            foreach (var command in commands)
            {
                if (command.Name == null)
                {
                    continue;
                }

                if (commandsDict.ContainsKey(command.Name))
                {
                    throw new InvalidOperationException(string.Format(InteractiveWindowResources.DuplicateCommand, command.Name));
                }

                commandsDict[command.Name] = command;
            }

            this.commands = commandsDict;

            this.maxCommandNameLength = (this.commands.Count > 0) ? this.commands.Values.Select(command => command.Name.Length).Max() : 0;

            this.classificationRegistry = classificationRegistry;
            if (contentTypeRegistry != null)
            {
                this.commandContentType = contentTypeRegistry.GetContentType(PredefinedInteractiveCommandsContentTypes.InteractiveCommandContentTypeName);
            }

            if (window != null)
            {
                window.SubmissionBufferAdded += Window_SubmissionBufferAdded;
                window.Properties[typeof(IInteractiveWindowCommands)] = this;
            }
        }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:37,代码来源:InteractiveWindowCommands.cs

示例13: AlpaAnalysisClassifierProvider

 public AlpaAnalysisClassifierProvider(IContentTypeRegistryService contentTypeRegistryService, [Import(typeof(SVsServiceProvider))]IServiceProvider serviceProvider)
 {
     _type = contentTypeRegistryService.GetContentType(AlpaConstants.ContentType);
     _serviceProvider = serviceProvider;
 }
开发者ID:wiinuk,项目名称:AlpaVsix,代码行数:5,代码来源:AlpaAnalysisClassifierProvider.cs

示例14: UIThreadOnly

            public UIThreadOnly(
                InteractiveWindow window,
                IInteractiveWindowEditorFactoryService factory,
                IContentTypeRegistryService contentTypeRegistry,
                ITextBufferFactoryService bufferFactory,
                IProjectionBufferFactoryService projectionBufferFactory,
                IEditorOperationsFactoryService editorOperationsFactory,
                ITextEditorFactoryService editorFactory,
                IRtfBuilderService rtfBuilderService,
                IIntellisenseSessionStackMapService intellisenseSessionStackMap,
                ISmartIndentationService smartIndenterService,
                IInteractiveEvaluator evaluator,
                IWaitIndicator waitIndicator)
            {
                _window = window;
                _factory = factory;
                _rtfBuilderService = (IRtfBuilderService2)rtfBuilderService;
                _intellisenseSessionStackMap = intellisenseSessionStackMap;
                _smartIndenterService = smartIndenterService;
                _waitIndicator = waitIndicator;
                Evaluator = evaluator;

                var replContentType = contentTypeRegistry.GetContentType(PredefinedInteractiveContentTypes.InteractiveContentTypeName);
                var replOutputContentType = contentTypeRegistry.GetContentType(PredefinedInteractiveContentTypes.InteractiveOutputContentTypeName);

                OutputBuffer = bufferFactory.CreateTextBuffer(replOutputContentType);
                StandardInputBuffer = bufferFactory.CreateTextBuffer();
                _inertType = bufferFactory.InertContentType;

                _projectionBuffer = projectionBufferFactory.CreateProjectionBuffer(
                    new EditResolver(window),
                    Array.Empty<object>(),
                    ProjectionBufferOptions.None,
                    replContentType);

                _projectionBuffer.Properties.AddProperty(typeof(InteractiveWindow), window);

                AppendNewOutputProjectionBuffer();
                _projectionBuffer.Changed += new EventHandler<TextContentChangedEventArgs>(ProjectionBufferChanged);

                var roleSet = editorFactory.CreateTextViewRoleSet(
                    PredefinedTextViewRoles.Analyzable,
                    PredefinedTextViewRoles.Editable,
                    PredefinedTextViewRoles.Interactive,
                    PredefinedTextViewRoles.Zoomable,
                    PredefinedInteractiveTextViewRoles.InteractiveTextViewRole);

                TextView = factory.CreateTextView(window, _projectionBuffer, roleSet);
                TextView.Caret.PositionChanged += CaretPositionChanged;

                var options = TextView.Options;
                options.SetOptionValue(DefaultTextViewHostOptions.HorizontalScrollBarId, true);
                options.SetOptionValue(DefaultTextViewHostOptions.LineNumberMarginId, false);
                options.SetOptionValue(DefaultTextViewHostOptions.OutliningMarginId, false);
                options.SetOptionValue(DefaultTextViewHostOptions.GlyphMarginId, false);
                options.SetOptionValue(DefaultTextViewOptions.WordWrapStyleId, WordWrapStyles.None);

                _lineBreakString = options.GetNewLineCharacter();
                EditorOperations = editorOperationsFactory.GetEditorOperations(TextView);

                _buffer = new OutputBuffer(window);
                OutputWriter = new InteractiveWindowWriter(window, spans: null);

                SortedSpans errorSpans = new SortedSpans();
                ErrorOutputWriter = new InteractiveWindowWriter(window, errorSpans);
                OutputClassifierProvider.AttachToBuffer(OutputBuffer, errorSpans);
            }
开发者ID:nileshjagtap,项目名称:roslyn,代码行数:67,代码来源:InteractiveWindow.UIThreadOnly.cs

示例15: TestInteractiveEngine

 public TestInteractiveEngine(IContentTypeRegistryService contentTypeRegistryService)
 {
     _contentType = contentTypeRegistryService.GetContentType(TestContentTypeDefinition.ContentTypeName);
 }
开发者ID:GloryChou,项目名称:roslyn,代码行数:4,代码来源:TestInteractiveEngine.cs


注:本文中的IContentTypeRegistryService.GetContentType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。