public SnapshotSpanNavigateToTarget(ITextView textView, SnapshotSpan snapshotSpan) { Contract.Requires<ArgumentNullException>(textView != null, "textView"); this._textView = textView; this._snapshotSpan = snapshotSpan; }
public void VsTextViewCreated(IVsTextView textViewAdapter) { IComponentModel componentModel = (IComponentModel)ServiceProvider.GlobalProvider.GetService(typeof(SComponentModel)); if (componentModel != null) { IOutliningManagerService outliningManagerService = componentModel.GetService <IOutliningManagerService>(); _editorAdaptersFactoryService = componentModel.GetService <IVsEditorAdaptersFactoryService>(); if (outliningManagerService != null) { if (textViewAdapter != null && _editorAdaptersFactoryService != null) { var textView = _editorAdaptersFactoryService.GetWpfTextView(textViewAdapter); var snapshot = textView.TextSnapshot; var snapshotSpan = new Microsoft.VisualStudio.Text.SnapshotSpan(snapshot, new Microsoft.VisualStudio.Text.Span(0, snapshot.Length)); _outliningManager = outliningManagerService.GetOutliningManager(textView); var regions = _outliningManager.GetAllRegions(snapshotSpan); foreach (var reg in regions) { _outliningManager.TryCollapse(reg); } } } } }
public SnapshotSpanNavigateToTarget([NotNull] ITextView textView, SnapshotSpan snapshotSpan) { Requires.NotNull(textView, nameof(textView)); this._textView = textView; this._snapshotSpan = snapshotSpan; }
public SnapshotSpanNavigateToTarget(ITextView textView, SnapshotSpan snapshotSpan) { Contract.Requires <ArgumentNullException>(textView != null, "textView"); this._textView = textView; this._snapshotSpan = snapshotSpan; }
public EditorNavigationTarget(string name, IEditorNavigationType editorNavigationType, SnapshotSpan span, SnapshotSpan seek, ImageSource glyph = null, NavigationTargetStyle style = NavigationTargetStyle.None) { Contract.Requires<ArgumentNullException>(name != null, "name"); Contract.Requires<ArgumentNullException>(editorNavigationType != null, "editorNavigationType"); this._name = name; this._editorNavigationType = editorNavigationType; this.Span = span; this.Seek = seek; this._style = style; this.Glyph = glyph; }
private static void Execute(object sender, EventArgs e) { IWpfTextView view = GetTextView(); if (view == null) { return; } Microsoft.VisualStudio.Text.SnapshotPoint position = view.Selection.Start.Position; Microsoft.VisualStudio.Text.Formatting.IWpfTextViewLine line = view.GetTextViewLineContainingBufferPosition(position); Microsoft.VisualStudio.Text.SnapshotSpan span = line.Extent; view.Selection.Select(span, false); }
void HighlightNodeRanges(SyntaxNode node, Microsoft.VisualStudio.Text.SnapshotSpan span) { _SyntaxNodeRangeAdornment.AddAdornment(span, null, new GeometryAdornment(ThemeHelper.MenuHoverBackgroundColor, _View.TextViewLines.GetMarkerGeometry(span), 3)); var p = _View.Caret.Position.BufferPosition; if (span.Contains(p) == false) { return; } var n = _SemanticContext.GetNode(p, false, false); while (n != null && node.Contains(n)) { if (n.Span.Start != span.Start && n.Span.Length != span.Length && n.IsKind(SyntaxKind.Block) == false) { span = n.Span.CreateSnapshotSpan(_View.TextSnapshot); _SyntaxNodeRangeAdornment.AddAdornment(span, null, new GeometryAdornment(ThemeHelper.MenuHoverBackgroundColor, _View.TextViewLines.GetMarkerGeometry(span), n.IsSyntaxBlock() || n.IsDeclaration() ? 1 : 0)); } n = n.Parent; } }
public EditorNavigationTarget(string name, IEditorNavigationType editorNavigationType, SnapshotSpan span, SnapshotSpan seek, ImageSource glyph = null, NavigationTargetStyle style = NavigationTargetStyle.None) { Contract.Requires <ArgumentNullException>(name != null, "name"); Contract.Requires <ArgumentNullException>(editorNavigationType != null, "editorNavigationType"); this._name = name; this._editorNavigationType = editorNavigationType; this.Span = span; this.Seek = seek; this._style = style; this.Glyph = glyph; }
public EditorNavigationTarget(string name, IEditorNavigationType editorNavigationType, SnapshotSpan span, ImageSource glyph = null, NavigationTargetStyle style = NavigationTargetStyle.None) : this(name, editorNavigationType, span, new SnapshotSpan(span.Start, span.End), glyph, style) { Contract.Requires(name != null); Contract.Requires(editorNavigationType != null); }
public IEnumerable <IMappingTagSpan <T> > GetTags(Microsoft.VisualStudio.Text.SnapshotSpan span) { throw new NotImplementedException(); }
public EditorNavigationTarget(string name, IEditorNavigationType editorNavigationType, SnapshotSpan span, ImageSource glyph = null, NavigationTargetStyle style = NavigationTargetStyle.None) : this(name, editorNavigationType, span, new SnapshotSpan(span.Start, span.End), glyph, style) { Contract.Requires(name != null); Contract.Requires(editorNavigationType != null); }
public EditorNavigationTarget([NotNull] string name, [NotNull] IEditorNavigationType editorNavigationType, SnapshotSpan span, SnapshotSpan seek, ImageSource glyph = null, NavigationTargetStyle style = NavigationTargetStyle.None) { Requires.NotNull(name, nameof(name)); Requires.NotNull(editorNavigationType, nameof(editorNavigationType)); this._name = name; this._editorNavigationType = editorNavigationType; this.Span = span; this.Seek = seek; this._style = style; this.Glyph = glyph; }
public EditorNavigationTarget([NotNull] string name, [NotNull] IEditorNavigationType editorNavigationType, SnapshotSpan span, ImageSource glyph = null, NavigationTargetStyle style = NavigationTargetStyle.None) : this(name, editorNavigationType, span, new SnapshotSpan(span.Start, span.End), glyph, style) { Debug.Assert(name != null); Debug.Assert(editorNavigationType != null); }