public HtmlFindAllReferences(IVsTextView adapter, IWpfTextView textView) : base(adapter, textView, VSConstants.VSStd97CmdID.FindReferences) { HtmlEditorDocument document = HtmlEditorDocument.TryFromTextView(textView); _tree = document == null ? null : document.HtmlEditorTree; }
public HtmlGoToDefinition(IVsTextView adapter, IWpfTextView textView) : base(adapter, textView, VSConstants.VSStd97CmdID.GotoDefn) { HtmlEditorDocument document = HtmlEditorDocument.TryFromTextView(textView); _tree = document == null ? null : document.HtmlEditorTree; }
public EnterFormat(IVsTextView adapter, IWpfTextView textView, IEditorFormatterProvider formatterProvider, ICompletionBroker broker) : base(adapter, textView, VSConstants.VSStd2KCmdID.RETURN) { _tree = HtmlEditorDocument.FromTextView(textView).HtmlEditorTree; _formatter = formatterProvider.CreateRangeFormatter(); _broker = broker; }
public EnterFormat(IVsTextView adapter, IWpfTextView textView, IEditorFormatterProvider formatterProvider, ICompletionBroker broker) : base(adapter, textView, typeof(Microsoft.VisualStudio.VSConstants.VSStd2KCmdID).GUID, 3) { _tree = HtmlEditorDocument.FromTextView(textView).HtmlEditorTree; _formatter = formatterProvider.CreateRangeFormatter(); _broker = broker; }
public DirectiveGoToDefinition(IVsTextView adapter, IWpfTextView textView, DTE dte, INgHierarchyProvider ngHierarchyProvider) : base(adapter, textView, VSConstants.VSStd97CmdID.GotoDefn) { HtmlEditorDocument document = HtmlEditorDocument.TryFromTextView(textView); this.tree = document == null ? null : document.HtmlEditorTree; this.dte = dte; this.ngHierarchyProvider = ngHierarchyProvider; }
private void SelectCaretNode(HtmlEditorTree tree, ElementNode tag) { var current = NodeAtCaret(tree); var child = ChildNode(current, tag); if (tag.Children.Contains(child)) Select(child.Start, child.OuterRange.Length); else Select(tag.Children[0].Start, tag.Children[0].End - tag.Children[0].Start); }
private ElementNode NodeAtCaret(HtmlEditorTree tree) { int start = _view.Caret.Position.BufferPosition.Position; ElementNode tag = null; AttributeNode attr = null; tree.GetPositionElement(start, out tag, out attr); return tag; }
private ElementNode NodeAtCaret(HtmlEditorTree tree) { int start = _view.Caret.Position.BufferPosition.Position; ElementNode tag = null; AttributeNode attr = null; tree.GetPositionElement(start, out tag, out attr); return(tag); }
private void SelectCaretNode(HtmlEditorTree tree, ElementNode tag) { var current = NodeAtCaret(tree); var child = ChildNode(current, tag); if (tag.Children.Contains(child)) { Select(child.Start, child.OuterRange.Length); } else { Select(tag.Children[0].Start, tag.Children[0].End - tag.Children[0].Start); } }
public void AugmentQuickInfoSession(IQuickInfoSession session, IList <object> qiContent, out ITrackingSpan applicableToSpan) { applicableToSpan = null; SnapshotPoint?point = session.GetTriggerPoint(session.TextView.TextBuffer.CurrentSnapshot); if (!point.HasValue) { return; } HtmlEditorTree tree = HtmlEditorDocument.TryFromTextView(session.TextView).HtmlEditorTree; if (tree == null) { return; } ElementNode node = null; AttributeNode attr = null; tree.GetPositionElement(point.Value.Position, out node, out attr); if (node == null || (!node.Name.Equals("img", StringComparison.OrdinalIgnoreCase) && !node.Name.Equals("source", StringComparison.OrdinalIgnoreCase))) { return; } if (attr == null || !attr.Name.Equals("src", StringComparison.OrdinalIgnoreCase)) { return; } string url = ImageQuickInfo.GetFullUrl(attr.Value, session.TextView.TextBuffer); if (string.IsNullOrEmpty(url)) { return; } applicableToSpan = session.TextView.TextBuffer.CurrentSnapshot.CreateTrackingSpan(point.Value.Position, 1, SpanTrackingMode.EdgeNegative); ImageQuickInfo.AddImageContent(qiContent, url); }
/// <summary> /// Finds a single property value at a given position in the tree. /// </summary> /// <param name="buffer">Any HTML editor tree</param> /// <param name="position">The position in the buffer</param> /// <param name="attributeNames">One or more HTML attribute names, such as 'class', 'id', 'src' etc.</param> /// <returns>A single value matching the position in the tree</returns> public static string GetSinglePropertyValue(HtmlEditorTree tree, int position, params string[] attributeNames) { ElementNode element = null; AttributeNode attr = null; tree.GetPositionElement(position, out element, out attr); if (attr == null || !attributeNames.Contains(attr.Name, StringComparer.OrdinalIgnoreCase)) return null; int beginning = position - attr.ValueRangeUnquoted.Start; int start = attr.Value.LastIndexOf(' ', beginning) + 1; int length = attr.Value.IndexOf(' ', start) - start; if (length < 0) length = attr.ValueRangeUnquoted.Length - start; return attr.Value.Substring(start, length); }
/// <summary> /// Finds a single property value at a given position in the tree. /// </summary> /// <param name="buffer">Any HTML editor tree</param> /// <param name="position">The position in the buffer</param> /// <param name="attributeNames">One or more HTML attribute names, such as 'class', 'id', 'src' etc.</param> /// <returns>A single value matching the position in the tree</returns> public static string GetSinglePropertyValue(HtmlEditorTree tree, int position, params string[] attributeNames) { tree.GetPositionElement(position, out ElementNode element, out AttributeNode attr); if (attr == null || !attributeNames.Contains(attr.Name, StringComparer.OrdinalIgnoreCase)) { return(null); } int beginning = position - attr.ValueRangeUnquoted.Start; int start = attr.Value.LastIndexOf(' ', beginning) + 1; int length = attr.Value.IndexOf(' ', start) - start; if (length < 0) { length = attr.ValueRangeUnquoted.Length - start; } return(attr.Value.Substring(start, length)); }
public void AugmentQuickInfoSession(IQuickInfoSession session, IList <object> qiContent, out ITrackingSpan applicableToSpan) { applicableToSpan = null; SnapshotPoint?point = session.GetTriggerPoint(session.TextView.TextBuffer.CurrentSnapshot); if (!point.HasValue) { return; } HtmlEditorTree tree = HtmlEditorDocument.FromTextView(session.TextView).HtmlEditorTree; ElementNode node = null; AttributeNode attr = null; tree.GetPositionElement(point.Value.Position, out node, out attr); if (attr == null || (attr.Name != "href" && attr.Name != "src")) { return; } string url = GetFileName(attr.Value.Trim('\'', '"').TrimStart('~')); if (!string.IsNullOrEmpty(url)) { applicableToSpan = session.TextView.TextBuffer.CurrentSnapshot.CreateTrackingSpan(point.Value.Position, 1, SpanTrackingMode.EdgeNegative); var image = CreateImage(url); if (image != null && image.Source != null) { qiContent.Add(image); qiContent.Add(Math.Round(image.Source.Width) + "x" + Math.Round(image.Source.Height)); } } }
public TemplateBufferGenerator(HtmlEditorTree editorTree, LanguageBlockCollection languageBlocks) : base(editorTree, languageBlocks, ContentTypeManager.GetContentType(TemplateTagContentType.ContentTypeName)) { }
public TemplateBlockHandler(HtmlEditorTree editorTree) : base(editorTree, ContentTypeManager.GetContentType(TemplateHtmlContentType.ContentTypeName)) { }
public override void Init(HtmlEditorTree editorTree) { base.Init(editorTree); ContainedLanguageBlockHandler = new TemplateBlockHandler(editorTree); }
public HtmlGoToDefinition(IVsTextView adapter, IWpfTextView textView) : base(adapter, textView, VSConstants.VSStd97CmdID.GotoDefn) { _tree = HtmlEditorDocument.FromTextView(textView).HtmlEditorTree; }
public HtmlGoToDefinition(IVsTextView adapter, IWpfTextView textView) : base(adapter, textView, typeof(Microsoft.VisualStudio.VSConstants.VSStd97CmdID).GUID, (uint)Microsoft.VisualStudio.VSConstants.VSStd97CmdID.GotoDefn) { _tree = HtmlEditorDocument.FromTextView(textView).HtmlEditorTree; }
public HtmlFindAllReferences(IVsTextView adapter, IWpfTextView textView) : base(adapter, textView, VSConstants.VSStd97CmdID.FindReferences) { _tree = HtmlEditorDocument.FromTextView(textView).HtmlEditorTree; }
public CodeBlockBlockHandler(HtmlEditorTree tree, IContentTypeRegistryService contentTypeRegistry) : base(tree, contentTypeRegistry.GetContentType("code")) { this.contentTypeRegistry = contentTypeRegistry; }
public MarkdownBufferGenerator(HtmlEditorTree editorTree, LanguageBlockCollection languageBlocks, IContentTypeRegistryService contentTypeRegistry) : base(editorTree, languageBlocks) { this.contentTypeRegistry = contentTypeRegistry; }
public EnterFormat(IVsTextView adapter, IWpfTextView textView, IEditorFormatterProvider formatterProvider) : base(adapter, textView, typeof(Microsoft.VisualStudio.VSConstants.VSStd2KCmdID).GUID, 3) { _tree = HtmlEditorDocument.FromTextView(textView).HtmlEditorTree; _formatter = formatterProvider.CreateRangeFormatter(); }
public HtmlFindAllReferences(IVsTextView adapter, IWpfTextView textView) : base(adapter, textView, typeof(Microsoft.VisualStudio.VSConstants.VSStd97CmdID).GUID, (uint)Microsoft.VisualStudio.VSConstants.VSStd97CmdID.FindReferences) { _tree = HtmlEditorDocument.FromTextView(textView).HtmlEditorTree; }