public IHighlightingDefinition LoadDefinitionFromName(string name, string theme) { var highlightingDefinition = HighlightingProviderParts .Where(p => p.Metadata.Name.Equals(name, StringComparison.OrdinalIgnoreCase)) .Select(p => p.Value) .FirstOrDefault(); return(highlightingDefinition?.LoadDefinition(theme)); }
public IHighlightingDefinition LoadDefinitionFromExtension(string fileExtension, string theme) { if (fileExtension.StartsWith(".")) { fileExtension = fileExtension.TrimStart('.'); } var highlightingDefinition = HighlightingProviderParts .Where( p => !string.IsNullOrEmpty(p.Metadata.FileExtension) && p.Metadata.FileExtension .Split(new [] { ",", ";", "|" }, StringSplitOptions.RemoveEmptyEntries) .Select(e => e.TrimStart('.')) .Contains(fileExtension, StringComparer.OrdinalIgnoreCase) ) .Select(p => p.Value) .FirstOrDefault(); return(highlightingDefinition?.LoadDefinition(theme)); }