public bool HasSuggestedActions(ITextView textView, ITextBuffer textBuffer, int caretPosition, ElementNode element, AttributeNode attribute, HtmlPositionType positionType) { if (!element.StartTag.Contains(caretPosition)) return false; if (element.InnerRange.Length < 5) return false; return element.IsStyleBlock() || element.IsJavaScriptBlock(); }
private static string GetReference(ElementNode element, string fileName, string root) { string relative = FileHelpers.RelativePath(root, fileName); string reference = "<script src=\"/{0}\"></script>"; if (element.IsStyleBlock()) reference = "<link rel=\"stylesheet\" href=\"/{0}\" />"; return string.Format(CultureInfo.CurrentCulture, reference, HttpUtility.HtmlAttributeEncode(relative)); }
public HtmlMinifyLightBulbAction(ITextView textView, ITextBuffer textBuffer, ElementNode element) : base(textView, textBuffer, element, "Minify " + (element.IsStyleBlock() ? "CSS" : "JavaScript")) { }