public void OnDismiss() { this.textView = null; this.methods = null; if (nativeStringsCacheForOverloads != null) { nativeStringsCacheForOverloads.Free(); nativeStringsCacheForOverloads = null; } this.currentMethod = 0; this.currentParameter = 0; this.displayed = false; }
public void Close() { this.Dismiss(); this.textView = null; this.methods = null; }
private static HashSet<string> FormalParamNames(MethodListForAMethodTip m, int index) { int numParams = m.GetParameterCount(index); HashSet<string> hs = new HashSet<string>(); for (int i = 0; i < numParams; ++i) { string name, display, description; m.GetParameterInfo(index, i, out name, out display, out description); hs.Add(name); } return hs; }
public void Refresh(IVsTextView textView, MethodListForAMethodTip methods, TextSpan context, MethodTipMiscellany methodTipMiscellany) { bool needToDismissNow = false; if (this.displayed && methodTipMiscellany == MethodTipMiscellany.JustPressedBackspace && MethodsSeemToDiffer(this.methods, methods)) { // We just hit backspace, and apparently the 'set of methods' changed. This most commonly happens in a case like // foo(42, bar( // in a tip for bar(), now press backspace // foo(42, bar // now we're in a location where we'd be in a tip for foo() // and we want to dismiss the tip. needToDismissNow = true; } this.methods = methods; if (nativeStringsCacheForOverloads != null) { nativeStringsCacheForOverloads.Free(); } nativeStringsCacheForOverloads = new NativeStringsCacheForOverloads(methods.GetCount(), this); this.context = context; this.textView = textView; if (needToDismissNow) { this.Dismiss(); } else { this.Refresh(methodTipMiscellany); } }
private static bool MethodsSeemToDiffer(MethodListForAMethodTip a, MethodListForAMethodTip b) { // this is an approximate test, that is good enough in practice return (a.GetName(0) != b.GetName(0)) || (a.GetCount() != b.GetCount()) || (!(a.GetNoteworthyParamInfoLocations()[0].Equals(b.GetNoteworthyParamInfoLocations()[0]))); }