public ItemCheckResult CheckItem(ParseItem item, ICssCheckerContext context) { if (!WESettings.Instance.Css.ValidateVendorSpecifics) { return(ItemCheckResult.Continue); } Declaration dec = (Declaration)item; if (!dec.IsValid || dec.IsVendorSpecific() || IgnoreProperty(dec) || context == null) { return(ItemCheckResult.Continue); } ICssSchemaInstance schema = CssEditorChecker.GetSchemaForItem(context, item); var missingEntries = dec.GetMissingVendorSpecifics(schema); if (missingEntries.ToArray().Length > 0) { var missingPrefixes = missingEntries.Select(e => e.Substring(0, e.IndexOf('-', 1) + 1)); string error = string.Format(CultureInfo.InvariantCulture, Resources.BestPracticeAddMissingVendorSpecific, dec.PropertyName.Text, string.Join(", ", missingPrefixes)); ICssError tag = new SimpleErrorTag(dec.PropertyName, error); context.AddError(tag); return(ItemCheckResult.CancelCurrentItem); } return(ItemCheckResult.Continue); }
public ItemCheckResult CheckItem(ParseItem item, ICssCheckerContext context) { if (!WESettings.Instance.Css.ValidateVendorSpecifics) { return(ItemCheckResult.Continue); } AtDirective directive = (AtDirective)item; if (!directive.IsValid || directive.IsVendorSpecific() || context == null) { return(ItemCheckResult.Continue); } ICssSchemaInstance schema = CssEditorChecker.GetSchemaForItem(context, item); var missingEntries = directive.GetMissingVendorSpecifics(schema); if (missingEntries.Any()) { string error = string.Format(CultureInfo.InvariantCulture, Resources.BestPracticeAddMissingVendorSpecificDirective, directive.Keyword.Text, string.Join(", ", missingEntries)); ICssError tag = new SimpleErrorTag(directive.Keyword, error); context.AddError(tag); return(ItemCheckResult.CancelCurrentItem); } return(ItemCheckResult.Continue); }
public static ICssCompletionListEntry GetMatchingStandardEntry(AtDirective directive, ICssCheckerContext context) { string standardName; if (directive.TryGetStandardPropertyName(out standardName, CssEditorChecker.GetSchemaForItem(context, directive))) { ICssSchemaInstance schema = CssEditorChecker.GetSchemaForItem(context, directive); return(schema.GetAtDirective("@" + standardName)); } return(null); }
public static ICssCompletionListEntry GetMatchingStandardEntry(Declaration declaration, ICssCheckerContext context) { string standardName; if (declaration.TryGetStandardPropertyName(out standardName, CssEditorChecker.GetSchemaForItem(context, declaration))) { ICssSchemaInstance schema = CssEditorChecker.GetSchemaForItem(context, declaration); return(schema.GetProperty(standardName)); } return(null); }
public ItemCheckResult CheckItem(ParseItem item, ICssCheckerContext context) { Declaration dec = (Declaration)item; if (context == null || !dec.IsValid) { return(ItemCheckResult.Continue); } RuleBlock rule = dec.FindType <RuleBlock>(); if (!rule.IsValid) { return(ItemCheckResult.Continue); } if (!dec.IsVendorSpecific()) { ICssSchemaInstance schema = CssEditorChecker.GetSchemaForItem(context, item); bool hasVendor = VendorHelpers.HasVendorLaterInRule(dec, schema); if (hasVendor) { context.AddError(new SimpleErrorTag(dec.PropertyName, Resources.BestPracticeStandardPropertyOrder)); return(ItemCheckResult.CancelCurrentItem); } } else { ICssCompletionListEntry entry = VendorHelpers.GetMatchingStandardEntry(dec, context); if (entry != null && !rule.Declarations.Any(d => d.PropertyName != null && d.PropertyName.Text == entry.DisplayText)) { if (entry.DisplayText != "filter" && entry.DisplayText != "zoom" && entry.DisplayText != "behavior") { string message = string.Format(CultureInfo.InvariantCulture, Resources.BestPracticeAddMissingStandardProperty, entry.DisplayText); context.AddError(new SimpleErrorTag(dec.PropertyName, message)); return(ItemCheckResult.CancelCurrentItem); } } } return(ItemCheckResult.Continue); }