protected virtual int GetDataTipTextImpl(TextSpan[] pSpan, out string pbstrText) { pbstrText = null; var debugInfo = _languageService.LanguageDebugInfo; if (debugInfo != null) { var subjectBuffer = WpfTextView.GetBufferContainingCaret(); if (subjectBuffer == null) { return(VSConstants.E_FAIL); } var vsBuffer = EditorAdaptersFactory.GetBufferAdapter(subjectBuffer); // TODO: broken in REPL if (vsBuffer == null) { return(VSConstants.E_FAIL); } return(debugInfo.GetDataTipText(vsBuffer, pSpan, pbstrText)); } return(VSConstants.E_FAIL); }
protected int GetDataTipTextImpl(ITextBuffer subjectBuffer, TextSpan[] pSpan, AbstractLanguageService <TPackage, TLanguageService> .VsLanguageDebugInfo debugInfo, out string pbstrText) { pbstrText = null; var vsBuffer = EditorAdaptersFactory.GetBufferAdapter(subjectBuffer); // TODO: broken in REPL if (vsBuffer == null) { return(VSConstants.E_FAIL); } return(debugInfo.GetDataTipText(vsBuffer, pSpan, out pbstrText)); }
protected int GetDataTipTextImpl(ITextBuffer subjectBuffer, TextSpan[] pSpan, out string pbstrText) { pbstrText = null; var vsBuffer = EditorAdaptersFactory.GetBufferAdapter(subjectBuffer); // TODO: broken in REPL if (vsBuffer == null) { return(VSConstants.E_FAIL); } using (Logger.LogBlock(FunctionId.Debugging_VsLanguageDebugInfo_GetDataTipText, CancellationToken.None)) { pbstrText = null; if (pSpan == null || pSpan.Length != 1) { return(VSConstants.E_INVALIDARG); } var result = VSConstants.E_FAIL; string pbstrTextInternal = null; var uiThreadOperationExecutor = ComponentModel.GetService <IUIThreadOperationExecutor>(); uiThreadOperationExecutor.Execute( title: ServicesVSResources.Debugger, defaultDescription: ServicesVSResources.Getting_DataTip_text, allowCancellation: true, showProgress: false, action: context => { IServiceProvider serviceProvider = ComponentModel.GetService <SVsServiceProvider>(); var debugger = (IVsDebugger)serviceProvider.GetService(typeof(SVsShellDebugger)); var debugMode = new DBGMODE[1]; var cancellationToken = context.UserCancellationToken; if (ErrorHandler.Succeeded(debugger.GetMode(debugMode)) && debugMode[0] != DBGMODE.DBGMODE_Design) { var textSpan = pSpan[0]; var textSnapshot = subjectBuffer.CurrentSnapshot; var document = textSnapshot.GetOpenDocumentInCurrentContextWithChanges(); if (document != null) { var languageDebugInfo = document.Project.LanguageServices.GetService <ILanguageDebugInfoService>(); if (languageDebugInfo != null) { var spanOpt = textSnapshot.TryGetSpan(textSpan); if (spanOpt.HasValue) { var dataTipInfo = languageDebugInfo.GetDataTipInfoAsync(document, spanOpt.Value.Start, cancellationToken).WaitAndGetResult(cancellationToken); if (!dataTipInfo.IsDefault) { var resultSpan = dataTipInfo.Span.ToSnapshotSpan(textSnapshot); var textOpt = dataTipInfo.Text; pSpan[0] = resultSpan.ToVsTextSpan(); result = debugger.GetDataTipValue((IVsTextLines)vsBuffer, pSpan, textOpt, out pbstrTextInternal); } } } } } }); pbstrText = pbstrTextInternal; return(result); } }