/// <include file='doc\ExpansionProvider.uex' path='docs/doc[@for="ExpansionProvider.OnItemChosen"]/*' /> public virtual int OnItemChosen(string pszTitle, string pszPath) { TextSpan ts; view.GetCaretPos(out ts.iStartLine, out ts.iStartIndex); ts.iEndLine = ts.iStartLine; ts.iEndIndex = ts.iStartIndex; if (this.expansionSession != null) // previous session should have been ended by now! { EndTemplateEditing(true); } Guid languageSID = this.source.LanguageService.GetType().GUID; // insert the expansion using (CompoundActionBase cab = CompoundActionFactory.GetCompoundAction(this.view, this.source, SR.FormatSpan)) { return(this.vsExpansion.InsertNamedExpansion(pszTitle, pszPath, ts, (IVsExpansionClient)this, languageSID, 0, // fShowDisambiguationUI, (FALSE) out this.expansionSession)); } }
/// <include file='doc\EditArray.uex' path='docs/doc[@for="EditArray.EditArray1"]/*' /> /// <summary> /// This constructor takes a view and will use CompoundViewAction to make the updates /// and it will update the current selection accordingly. /// <param name="source">The buffer to operate on</param> /// <param name="view">The text view to use for CompoundViewAction and whose selection you want updated</param> /// <param name="merge">Whether to attempt to merge edits</param> /// <param name="description">Name used in compound action</param> /// </summary> public EditArray(Source source, IVsTextView view, bool merge, string description) { this.source = source; this.editList = new ArrayList(); this.merge = merge; this.description = description; if (view != null) { TextSpan[] pSpan = new TextSpan[1]; view.GetSelectionSpan(pSpan); this.selection = pSpan[0]; this.view = view; } this.ca = CompoundActionFactory.GetCompoundAction(this.view, this.source, description); this.ca.FlushEditActions(); // Sanity check - make sure others are not modifying the buffer while the // caller is preparing the big edit operation. this.changeCount = source.ChangeCount; }