public int GetProximityExpressions(IVsTextBuffer pBuffer, int iLine, int iCol, int cLines, out IVsEnumBSTR ppEnum)
        {
            var textBuffer = _editorAdaptersFactory.GetDataBuffer(pBuffer);

            if (textBuffer == null)
            {
                // Can't resolve the text buffer, let someone else deal with this breakpoint.
                ppEnum = null;
                return(VSConstants.E_NOTIMPL);
            }

            var snapshot = textBuffer.CurrentSnapshot;

            if (!ValidateLocation(snapshot, iLine, iCol))
            {
                // The point disappeared between sessions. Do not evaluate proximity expressions here.
                ppEnum = null;
                return(VSConstants.E_FAIL);
            }

            var dialogResult = _waitDialogFactory.TryCreateWaitDialog(
                title: "Determining proximity expressions...",
                message: "Razor Debugger",
                async(context) =>
            {
                var proximityExpressions = await _proximityExpressionResolver.TryResolveProximityExpressionsAsync(textBuffer, iLine, iCol, context.CancellationToken).ConfigureAwait(false);
                return(proximityExpressions);
            });

            if (dialogResult == null)
            {
                // Failed to create the dialog at all.
                ppEnum = null;
                return(VSConstants.E_FAIL);
            }

            if (dialogResult.Cancelled)
            {
                ppEnum = null;
                return(VSConstants.E_FAIL);
            }

            if (dialogResult.Result == null)
            {
                ppEnum = null;
                return(VSConstants.E_FAIL);
            }

            ppEnum = new VsEnumBSTR(dialogResult.Result);
            return(VSConstants.S_OK);
        }
        public int GetProximityExpressions(IVsTextBuffer pBuffer, int iLine, int iCol, int cLines, out IVsEnumBSTR ppEnum)
        {
            var textBuffer = _editorAdaptersFactory.GetDataBuffer(pBuffer);

            if (textBuffer == null)
            {
                // Can't resolve the text buffer, let someone else deal with this breakpoint.
                ppEnum = null;
                return(VSConstants.E_NOTIMPL);
            }

            var snapshot = textBuffer.CurrentSnapshot;

            if (!ValidateLocation(snapshot, iLine, iCol))
            {
                // The point disappeared between sessions. Do not evaluate proximity expressions here.
                ppEnum = null;
                return(VSConstants.E_FAIL);
            }

            var proximityExpressions = _uiThreadOperationExecutor.Execute(
                title: VS.LSClientRazor.Resources.ProximityExpression_Dialog_Title,
                description: VS.LSClientRazor.Resources.ProximityExpression_Dialog_Description,
                allowCancellation: true,
                showProgress: true,
                (cancellationToken) => _proximityExpressionResolver.TryResolveProximityExpressionsAsync(textBuffer, iLine, iCol, cancellationToken), _joinableTaskFactory);

            if (proximityExpressions is null)
            {
                ppEnum = null;
                return(VSConstants.E_FAIL);
            }

            ppEnum = new VsEnumBSTR(proximityExpressions);
            return(VSConstants.S_OK);
        }
Beispiel #3
0
 public int Clone(out IVsEnumBSTR ppEnum)
 {
     ppEnum = new VsEnumBSTR(_values);
     return(VSConstants.S_OK);
 }