Exemple #1
0
        public async Task <ImmutableArray <AbstractMoveToNamespaceCodeAction> > GetCodeActionsAsync(
            Document document,
            TextSpan span,
            CancellationToken cancellationToken)
        {
            var typeAnalysisResult = await AnalyzeTypeAtPositionAsync(document, span.Start, cancellationToken).ConfigureAwait(false);

            if (typeAnalysisResult.CanPerform)
            {
                return(ImmutableArray.Create(AbstractMoveToNamespaceCodeAction.Generate(this, typeAnalysisResult)));
            }

            return(ImmutableArray <AbstractMoveToNamespaceCodeAction> .Empty);
        }
        public async Task <ImmutableArray <AbstractMoveToNamespaceCodeAction> > GetCodeActionsAsync(
            Document document,
            TextSpan span,
            CancellationToken cancellationToken)
        {
            // Code actions cannot be completed without the options needed
            // to fill in missing information.
            if (OptionsService != null)
            {
                var typeAnalysisResult = await AnalyzeTypeAtPositionAsync(document, span.Start, cancellationToken).ConfigureAwait(false);

                if (typeAnalysisResult.CanPerform)
                {
                    return(ImmutableArray.Create(AbstractMoveToNamespaceCodeAction.Generate(this, typeAnalysisResult)));
                }
            }

            return(ImmutableArray <AbstractMoveToNamespaceCodeAction> .Empty);
        }