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

            if (textBuffer is 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: Resources.ProximityExpression_Dialog_Title,
                description: 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);
        }
コード例 #2
0
 public int Clone(out IVsEnumBSTR ppEnum)
 {
     ppEnum = new VsEnumBSTR(Values);
     return(VSConstants.S_OK);
 }