/// <include file='doc\ViewFilter.uex' path='docs/doc[@for="ViewFilter.GetWordExtent"]/*' /> /// <summary>Returns the result of Source.GetWordExtent.</summary> public virtual int GetWordExtent(int line, int index, uint flags, TextSpan[] span) { Debug.Assert(line >= 0 && index >= 0); if (span == null) { NativeHelpers.RaiseComError(NativeMethods.E_INVALIDARG); } else { span[0] = new TextSpan(); } span[0].iStartLine = span[0].iEndLine = line; span[0].iStartIndex = span[0].iEndIndex = index; int start, end; if (!this.source.GetWordExtent(line, index, (WORDEXTFLAGS)flags, out start, out end)) { return(NativeMethods.S_FALSE); } span[0].iStartIndex = start; span[0].iEndIndex = end; TextSpanHelper.MakePositive(ref span[0]); return(NativeMethods.S_OK); }
/// <include file='doc\ViewFilter.uex' path='docs/doc[@for="TextTipData.TextTipData"]/*' /> public TextTipData(IServiceProvider site) { if (site == null) { throw new System.ArgumentNullException("site"); } //this.textView = view; // Create our method tip window (through the local registry) Type t = typeof(IVsTextTipWindow); Guid riid = t.GUID; Guid clsid = typeof(VsTextTipWindowClass).GUID; Microsoft.VisualStudio.Shell.Package pkg = (Microsoft.VisualStudio.Shell.Package)site.GetService(typeof(Microsoft.VisualStudio.Shell.Package)); if (pkg == null) { throw new NullReferenceException(typeof(Microsoft.VisualStudio.Shell.Package).FullName); } this.textTipWindow = (IVsTextTipWindow)pkg.CreateInstance(ref clsid, ref riid, t); if (this.textTipWindow == null) { NativeHelpers.RaiseComError(NativeMethods.E_FAIL); } NativeMethods.ThrowOnFailure(textTipWindow.SetTextTipData(this)); }
//////////////////////////////////////////////////////////////////////////////// #region IVsTextTipData public virtual void GetTipText(string[] pbstrText, out int pfFontData) { if (pbstrText == null || pbstrText.Length == 0) { NativeHelpers.RaiseComError(HResult.E_INVALIDARG); } pfFontData = 0; // TODO: Do whatever formatting we might want... pbstrText[0] = this.text; }
public virtual void GetPairExtents(int line, int index, TextSpan[] span) { Trace.WriteLine("ViewFilter::GetWordExtent"); Debug.Assert(line >= 0 && index >= 0); if (span == null) { NativeHelpers.RaiseComError(HResult.E_INVALIDARG); } this.source.GetPairExtents(line, index, out span[0]); }
public TextTipData(IServiceProvider site) { Debug.Assert(site != null); //this.textView = view; // Create our method tip window (through the local registry) this.textTipWindow = (IVsTextTipWindow)VsShell.CreateInstance(site, ref VsConstants.CLSID_VsTextTipWindow, ref VsConstants.IID_IVsTextTipWindow, typeof(IVsTextTipWindow)); if (this.textTipWindow == null) { NativeHelpers.RaiseComError(HResult.E_FAIL); } textTipWindow.SetTextTipData(this); }
public void Update(string text, int pos, int len, IVsTextView textView) { if (textView == null) { return; } this.pos = pos; this.len = len; this.text = text; if (text == "" || text == null) { NativeHelpers.RaiseComError(HResult.E_FAIL); } textView.UpdateTipWindow(textTipWindow, (uint)TipWindowFlags.UTW_CONTEXTCHANGED | (uint)TipWindowFlags.UTW_CONTENTCHANGED); this.isWindowUp = true; }
public virtual void GetDataTipText(TextSpan[] aspan, out string text) { text = null; TextSpan span = aspan[0]; if (!service.Preferences.EnableQuickInfo) { NativeHelpers.RaiseComError(HResult.E_FAIL); } if (span.iEndLine == this.quickInfoLine && span.iEndIndex == this.quickInfoIdx) { if (this.quickInfoText == null) { // still parsing on the background thread, so return E_PENDING. Trace.WriteLine("ViewFilter::GetDataTipText - E_PENDING"); NativeHelpers.RaiseComError(HResult.E_PENDING); } this.quickInfoLine = -1; if (this.quickInfoText == "") { // then the parser found nothing to display. NativeHelpers.RaiseComError(HResult.E_FAIL); } text = this.GetFullDataTipText(this.quickInfoText, span); aspan[0] = this.quickInfoSpan; this.quickInfoText = null; Trace.WriteLine("ViewFilter::GetDataTipText - '" + text + "'"); } else { // kick off the background parse to get this information... Trace.WriteLine("ViewFilter::GetDataTipText - OnQuickInfo - E_PENDING"); this.quickInfoText = null; this.quickInfoLine = span.iEndLine; this.quickInfoIdx = span.iEndIndex; this.source.BeginParse(span.iEndLine, span.iEndIndex, new TokenInfo(), ParseReason.QuickInfo, this.textView, new ParseResultHandler(HandleQuickInfoResponse)); NativeHelpers.RaiseComError(HResult.E_PENDING); } // bugbug: cannot return COM errors AND return out arguments. //NativeHelpers.RaiseComError((HResult)TipSuccesses.TIP_S_ONLYIFNOMARKER); }
/// <include file='doc\ViewFilter.uex' path='docs/doc[@for="TextTipData.Update"]/*' /> public void Update(string textValue, int pos, int len, IVsTextView textView) { if (textView == null) { return; } this.pos = pos; this.len = len; this.text = textValue; if (textValue == null || textValue.Length == 0) { NativeHelpers.RaiseComError(NativeMethods.E_FAIL); } int hr = textView.UpdateTipWindow(textTipWindow, (uint)TipWindowFlags.UTW_CONTEXTCHANGED | (uint)TipWindowFlags.UTW_CONTENTCHANGED); Debug.Assert(NativeMethods.Succeeded(hr), "UpdateTipWindow"); this.isWindowUp = true; }
public virtual void GetWordExtent(int line, int index, uint flags, TextSpan[] span) { Debug.Assert(line >= 0 && index >= 0); if (span == null) { NativeHelpers.RaiseComError(HResult.E_INVALIDARG); } else { span[0] = new TextSpan(); } span[0].iStartLine = span[0].iEndLine = line; span[0].iStartIndex = index; int start, end; if (!this.source.GetWordExtent(line, index, (WORDEXTFLAGS)flags, out start, out end)) { NativeHelpers.RaiseComError(HResult.S_FALSE); } span[0].iStartIndex = start; span[0].iEndIndex = end; }
public void ReRegistrationKey(out string pbstrKey) { // We don't need to support "re-registration". pbstrKey = null; NativeHelpers.RaiseComError(HResult.E_FAIL); }
public virtual void GetTipFontInfo(int iChars, uint[] pdwFontInfo) { NativeHelpers.RaiseComError(HResult.E_NOTIMPL); }