public void Run(EnvDTE80.DTE2 DTE, Microsoft.VisualStudio.Shell.Package package) { serviceProvider = package as System.IServiceProvider; Microsoft.VisualStudio.Text.Editor.IWpfTextView textView = GetTextView(); Microsoft.VisualStudio.Text.SnapshotPoint caretPosition = textView.Caret.Position.BufferPosition; textView.TextBuffer.Insert(caretPosition.Position, "sample code"); }
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); }
public DragDropPointerEffects HandleDataDropped(DragDropInfo dragDropInfo) { Microsoft.VisualStudio.Text.SnapshotPoint position = dragDropInfo.VirtualBufferPosition.Position; var doc = SpriteDocument.FromJSON(_view.TextBuffer.CurrentSnapshot.GetText(), _documentFileName); string ident = SpriteHelpers.GetIdentifier(_draggedFileName); string file = SpriteHelpers.MakeRelative(_documentFileName, _draggedFileName); if (doc.Images.ContainsKey(ident)) { ident += "_" + Guid.NewGuid().ToString().Replace("-", string.Empty); } doc.Images.Add(new KeyValuePair <string, string>(ident, file)); using (Microsoft.VisualStudio.Text.ITextEdit edit = _view.TextBuffer.CreateEdit()) { edit.Replace(0, _view.TextBuffer.CurrentSnapshot.Length, doc.ToJsonString()); edit.Apply(); } return(DragDropPointerEffects.Copy); }
public Microsoft.VisualStudio.Text.Formatting.ITextViewLine GetTextViewLineContainingBufferPosition(Microsoft.VisualStudio.Text.SnapshotPoint bufferPosition) { throw new NotImplementedException(); }
public Microsoft.VisualStudio.Text.SnapshotSpan GetTextElementSpan(Microsoft.VisualStudio.Text.SnapshotPoint point) { throw new NotImplementedException(); }
public void DisplayTextLineContainingBufferPosition(Microsoft.VisualStudio.Text.SnapshotPoint bufferPosition, double verticalDistance, ViewRelativePosition relativeTo) { throw new NotImplementedException(); }
public void OnCommitted(ICssCompletionListEntry entry, Microsoft.VisualStudio.Text.ITrackingSpan contextSpan, Microsoft.VisualStudio.Text.SnapshotPoint caret, Microsoft.VisualStudio.Text.Editor.ITextView textView) { if (Path.GetExtension(entry.DisplayText).Length == 0) { Dispatcher.CurrentDispatcher.BeginInvoke( new Action(() => CssCompletionController.FromView(textView).OnShowMemberList(filterList: true, autoShown: true)), DispatcherPriority.Normal); } }
public void DisplayTextLineContainingBufferPosition(Microsoft.VisualStudio.Text.SnapshotPoint bufferPosition, double verticalDistance, ViewRelativePosition relativeTo, double?viewportWidthOverride, double?viewportHeightOverride) { throw new System.NotImplementedException(); }