本文整理汇总了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;
}
}
示例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);
}
示例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));
}
示例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);
}
示例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);
}
示例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;
}
}
示例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>();
}
示例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);
}
示例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);
}
示例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;
}
}
示例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))
{
}
示例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;
}
}
示例13: AlpaAnalysisClassifierProvider
public AlpaAnalysisClassifierProvider(IContentTypeRegistryService contentTypeRegistryService, [Import(typeof(SVsServiceProvider))]IServiceProvider serviceProvider)
{
_type = contentTypeRegistryService.GetContentType(AlpaConstants.ContentType);
_serviceProvider = serviceProvider;
}
示例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);
}
示例15: TestInteractiveEngine
public TestInteractiveEngine(IContentTypeRegistryService contentTypeRegistryService)
{
_contentType = contentTypeRegistryService.GetContentType(TestContentTypeDefinition.ContentTypeName);
}