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]))); }