public void PresentItems( ITrackingSpan triggerSpan, IList <SignatureHelpItem> signatureHelpItems, SignatureHelpItem selectedItem, int?selectedParameter) { _signatureHelpItems = signatureHelpItems; _selectedItem = selectedItem; // Create all the editor signatures for the sig help items we have. this.CreateSignatures(triggerSpan, selectedParameter); // It's a new list of items. Either create the editor session if this is the // first time, or ask the editor session that we already have to recalculate. if (_editorSessionOpt == null) { // We're tracking the caret. Don't have the editor do it. _editorSessionOpt = _sigHelpBroker.CreateSignatureHelpSession( _textView, triggerSpan.GetStartTrackingPoint(PointTrackingMode.Negative), trackCaret: false); _editorSessionOpt.Dismissed += (s, e) => OnEditorSessionDismissed(); _editorSessionOpt.SelectedSignatureChanged += OnSelectedSignatureChanged; } // So here's the deal. We cannot create the editor session and give it the right // signatures (even though we know what they are). Instead, the session with // call back into the ISignatureHelpSourceProvider (which is us) to get those // values. It will pass itself along with the calls back into // ISignatureHelpSourceProvider. So, in order to make that connection work, we // add properties to the session so that we can call back into ourselves, get // the signatures and add it to the session. if (!_editorSessionOpt.Properties.ContainsProperty(s_augmentSessionKey)) { _editorSessionOpt.Properties.AddProperty(s_augmentSessionKey, this); } try { // Don't want to get any callbacks while we do this. _ignoreSelectionStatusChangedEvent = true; _editorSessionOpt.Recalculate(); // Now let the editor know what the currently selected item is. Contract.Requires(_signatureMap.ContainsKey(selectedItem)); Contract.ThrowIfNull(_signatureMap); var defaultValue = _signatureMap.GetValueOrDefault(_selectedItem); if (_editorSessionOpt != null) { _editorSessionOpt.SelectedSignature = defaultValue; } } finally { _ignoreSelectionStatusChangedEvent = false; } }