Example #1
0
            public void Dispose()
            {
                if (_owner != null)
                {
                    var updateSource = (IDiagnosticUpdateSource)_owner._diagnosticService;
                    updateSource.DiagnosticsUpdated -= OnDiagnosticsUpdated;
                }

                if (_workspaceStatusService != null)
                {
                    _workspaceStatusService.StatusChanged -= OnWorkspaceStatusChanged;
                }

                if (_workspace != null)
                {
                    _workspace.DocumentActiveContextChanged -= OnActiveContextChanged;
                }

                if (_registration != null)
                {
                    _registration.WorkspaceChanged -= OnWorkspaceChanged;
                }

                if (_textView != null)
                {
                    _textView.Closed -= OnTextViewClosed;
                }

                _owner     = null !;
                _workspace = null;
                _workspaceStatusService = null;
                _registration           = null !;
                _textView      = null !;
                _subjectBuffer = null !;
            }
 public ApexAsynchronousOperationListenerProviderAccessor(
     AsynchronousOperationListenerProvider implementation,
     [Import(AllowDefault = true)] VisualStudioWorkspace?workspace)
 {
     _implementation = implementation;
     _workspace      = workspace;
 }
Example #3
0
        public override void Connect()
        {
            this.CurrentWorkspace = _workspaceRegistration.Workspace;
            _workspaceRegistration.WorkspaceChanged += OnWorkspaceRegistrationChanged;

            if (this.CurrentWorkspace != null)
            {
                ConnectToWorkspace(this.CurrentWorkspace);
            }
        }
 internal static async Task WaitAllDispatcherOperationAndTasksAsync(
     this IAsynchronousOperationListenerProvider provider,
     Workspace?workspace,
     params string[] featureNames
     )
 {
     await((AsynchronousOperationListenerProvider)provider)
     .WaitAllAsync(workspace, featureNames)
     .ConfigureAwait(false);
 }
Example #5
0
        public override void Disconnect()
        {
            if (this.CurrentWorkspace != null)
            {
                DisconnectFromWorkspace(this.CurrentWorkspace);
                this.CurrentWorkspace = null;
            }

            _workspaceRegistration.WorkspaceChanged -= OnWorkspaceRegistrationChanged;
        }
Example #6
0
        public async Task RunAsync(
            [Option("i", "Input path to MSBuild project file or the directory containing Unity source files.")] string input,
            [Option("o", "Output file path(.cs) or directory (multiple generate file).")] string output,
            [Option("c", "Conditional compiler symbols, split with ','. Ignored if a project file is specified for input.")] string?conditionalSymbol = null,
            [Option("r", "Set resolver name.")] string resolverName            = "GeneratedResolver",
            [Option("n", "Set namespace root name.")] string? @namespace       = null,
            [Option("m", "Force use map mode serialization.")] bool useMapMode = false,
            [Option("ms", "Generate #if-- files by symbols, split with ','.")] string?multipleIfDirectiveOutputSymbols = null,
            [Option("ei", "Ignore type names.")] string[]?externalIgnoreTypeNames = null)
        {
            Workspace?workspace = null;

            try
            {
                Compilation compilation;
                if (Directory.Exists(input))
                {
                    string[]? conditionalSymbols = conditionalSymbol?.Split(',');
                    compilation = await PseudoCompilation.CreateFromDirectoryAsync(input, conditionalSymbols, this.Context.CancellationToken);
                }
                else
                {
                    (workspace, compilation) = await this.OpenMSBuildProjectAsync(input, this.Context.CancellationToken);
                }

                //get namespace from project file
                if (@namespace == null)
                {
                    @namespace = Path.GetFileNameWithoutExtension(input);
                }

                await new MessagePackCompiler.CodeGenerator(x => Console.WriteLine(x), this.Context.CancellationToken)
                .GenerateFileAsync(
                    compilation,
                    output,
                    resolverName,
                    @namespace,
                    useMapMode,
                    multipleIfDirectiveOutputSymbols,
                    externalIgnoreTypeNames).ConfigureAwait(false);
            }
            catch (OperationCanceledException)
            {
                await Console.Error.WriteLineAsync("Canceled");

                throw;
            }
            finally
            {
                workspace?.Dispose();
            }
        }
        public static bool TryGetWorkspace(SourceTextContainer textContainer, [NotNullWhen(true)] out Workspace?workspace)
        {
            if (textContainer == null)
            {
                throw new ArgumentNullException(nameof(textContainer));
            }

            var registration = GetWorkspaceRegistration(textContainer);

            workspace = registration.Workspace;

            return(workspace != null);
        }
Example #8
0
        private void OnWorkspaceRegistrationChanged(object?sender, EventArgs e)
        {
            if (this.CurrentWorkspace != null)
            {
                DisconnectFromWorkspace(this.CurrentWorkspace);
            }

            this.CurrentWorkspace = _workspaceRegistration.Workspace;

            if (this.CurrentWorkspace != null)
            {
                ConnectToWorkspace(this.CurrentWorkspace);
            }
        }
Example #9
0
        private void ConnectToWorkspace(Workspace?workspace)
        {
            var newService = workspace?.Services.GetService <IActiveStatementTrackingService>();

            if (newService != null)
            {
                newService.TrackingSpansChanged += OnTrackingSpansChanged;
            }

            var previousService = Interlocked.Exchange(ref _trackingService, newService);

            if (previousService != null)
            {
                previousService.TrackingSpansChanged -= OnTrackingSpansChanged;
            }
        }
Example #10
0
            private void UpdateOptionChangedSource(Workspace?newWorkspace)
            {
                if (_optionService != null)
                {
                    _optionService.OptionChanged -= OnOptionChanged;
                    _optionService = null;
                }

                var optionService = newWorkspace?.Services.GetService <IOptionService>();

                if (optionService != null)
                {
                    _optionService = optionService;
                    _optionService.OptionChanged += OnOptionChanged;
                }
            }
Example #11
0
        public void WaitForAllAsyncOperations(Workspace?workspace, TimeSpan timeout, params string[] featureNames)
        {
            var task = _provider.WaitAllAsync(workspace, featureNames, timeout: timeout);

            if (timeout == TimeSpan.FromMilliseconds(-1))
            {
                WaitForTask(task, CancellationToken.None);
            }
            else
            {
                using (var cancellationTokenSource = new CancellationTokenSource(timeout))
                {
                    WaitForTask(task, cancellationTokenSource.Token);
                }
            }
        }
Example #12
0
 public TestProjectFileOrAssemblyInfoPropertiesProvider(
     UnconfiguredProject?project = null,
     Lazy <IInterceptingPropertyValueProvider, IInterceptingPropertyValueProviderMetadata>?interceptingProvider = null,
     Workspace?workspace = null,
     IProjectThreadingService?threadingService           = null,
     IProjectProperties?defaultProperties                = null,
     IProjectInstancePropertiesProvider?instanceProvider = null,
     Func <ProjectId>?getActiveProjectId = null)
     : this(workspace ?? WorkspaceFactory.Create(""),
            project : project ?? UnconfiguredProjectFactory.Create(),
            interceptingProvider : interceptingProvider,
            threadingService : threadingService,
            defaultProperties : defaultProperties,
            instanceProvider : instanceProvider,
            getActiveProjectId : getActiveProjectId)
 {
 }
Example #13
0
        public override async void OnToolWindowCreated()
        {
            base.OnToolWindowCreated();

            // Set the text that will appear in the title bar of the tool window. Note that because we need access to the package for localization,
            // we have to wait to do this here. If we used a constant string, we could do this in the constructor.
            this.Caption = VSIXResource.CodeMap_WindowTitle;

            if (CodeMapWPFControl == null)
            {
                return;
            }

            IAsyncServiceProvider serviceProvider = AcuminatorVSPackage.Instance ?? AsyncServiceProvider.GlobalProvider;

            if (serviceProvider == null)
            {
                return;
            }

            Workspace?workspace = await AcuminatorVSPackage.Instance.GetVSWorkspaceAsync();

            if (workspace == null)
            {
                return;
            }

            IWpfTextView?textView = await ThreadHelper.JoinableTaskFactory.RunAsync(serviceProvider.GetWpfTextViewAsync);

            Document?document = textView?.TextSnapshot?.GetOpenDocumentInCurrentContextWithChanges();

            if (CodeMapWPFControl.DataContext is CodeMapWindowViewModel codeMapViewModel)
            {
                await codeMapViewModel.RefreshCodeMapOnWindowOpeningAsync(textView, document);
            }
            else
            {
                CodeMapWPFControl.DataContext = CodeMapWindowViewModel.InitCodeMap(workspace, textView, document);
            }
        }
Example #14
0
        private static CSharpSyntaxContext CreateContextWorker(Workspace?workspace, SemanticModel semanticModel, int position, CancellationToken cancellationToken)
        {
            var syntaxTree = semanticModel.SyntaxTree;

            var isInNonUserCode = syntaxTree.IsInNonUserCode(position, cancellationToken);

            var preProcessorTokenOnLeftOfPosition = syntaxTree.FindTokenOnLeftOfPosition(position, cancellationToken, includeDirectives: true);
            var isPreProcessorDirectiveContext    = syntaxTree.IsPreProcessorDirectiveContext(position, preProcessorTokenOnLeftOfPosition, cancellationToken);

            var leftToken = isPreProcessorDirectiveContext
                ? preProcessorTokenOnLeftOfPosition
                : syntaxTree.FindTokenOnLeftOfPosition(position, cancellationToken);

            var targetToken = leftToken.GetPreviousTokenIfTouchingWord(position);

            var isPreProcessorKeywordContext = isPreProcessorDirectiveContext
                ? syntaxTree.IsPreProcessorKeywordContext(position, leftToken)
                : false;

            var isPreProcessorExpressionContext = isPreProcessorDirectiveContext
                ? targetToken.IsPreProcessorExpressionContext()
                : false;

            var isStatementContext = !isPreProcessorDirectiveContext
                ? targetToken.IsBeginningOfStatementContext()
                : false;

            var isGlobalStatementContext = !isPreProcessorDirectiveContext
                ? syntaxTree.IsGlobalStatementContext(position, cancellationToken)
                : false;

            var isAnyExpressionContext = !isPreProcessorDirectiveContext
                ? syntaxTree.IsExpressionContext(position, leftToken, attributes : true, cancellationToken : cancellationToken, semanticModelOpt : semanticModel)
                : false;

            var isNonAttributeExpressionContext = !isPreProcessorDirectiveContext
                ? syntaxTree.IsExpressionContext(position, leftToken, attributes : false, cancellationToken : cancellationToken, semanticModelOpt : semanticModel)
                : false;

            var isConstantExpressionContext = !isPreProcessorDirectiveContext
                ? syntaxTree.IsConstantExpressionContext(position, leftToken)
                : false;

            var containingTypeDeclaration       = syntaxTree.GetContainingTypeDeclaration(position, cancellationToken);
            var containingTypeOrEnumDeclaration = syntaxTree.GetContainingTypeOrEnumDeclaration(position, cancellationToken);

            var isDestructorTypeContext = targetToken.IsKind(SyntaxKind.TildeToken) &&
                                          targetToken.Parent.IsKind(SyntaxKind.DestructorDeclaration) &&
                                          targetToken.Parent.Parent.IsKind(SyntaxKind.ClassDeclaration, SyntaxKind.StructDeclaration, SyntaxKind.RecordDeclaration);

            // Typing a dot after a numeric expression (numericExpression.)
            // - maybe a start of MemberAccessExpression like numericExpression.Member.
            // - or it maybe a start of a range expression like numericExpression..anotherNumericExpression (starting C# 8.0)
            // Therefore, in the scenario, we want the completion to be __soft selected__ until user types the next character after the dot.
            // If the second dot was typed, we just insert two dots.
            var isRightSideOfNumericType = leftToken.IsNumericTypeContext(semanticModel, cancellationToken);

            var isArgumentListToken = targetToken.Parent.IsKind(SyntaxKind.ArgumentList, SyntaxKind.AttributeArgumentList, SyntaxKind.ArrayRankSpecifier);

            return(new CSharpSyntaxContext(
                       workspace: workspace,
                       semanticModel: semanticModel,
                       position: position,
                       leftToken: leftToken,
                       targetToken: targetToken,
                       containingTypeDeclaration: containingTypeDeclaration,
                       containingTypeOrEnumDeclaration: containingTypeOrEnumDeclaration,
                       isInNonUserCode: isInNonUserCode,
                       isPreProcessorDirectiveContext: isPreProcessorDirectiveContext,
                       isPreProcessorKeywordContext: isPreProcessorKeywordContext,
                       isPreProcessorExpressionContext: isPreProcessorExpressionContext,
                       isTypeContext: syntaxTree.IsTypeContext(position, cancellationToken, semanticModelOpt: semanticModel),
                       isNamespaceContext: syntaxTree.IsNamespaceContext(position, cancellationToken, semanticModelOpt: semanticModel),
                       isNamespaceDeclarationNameContext: syntaxTree.IsNamespaceDeclarationNameContext(position, cancellationToken),
                       isStatementContext: isStatementContext,
                       isGlobalStatementContext: isGlobalStatementContext,
                       isAnyExpressionContext: isAnyExpressionContext,
                       isNonAttributeExpressionContext: isNonAttributeExpressionContext,
                       isConstantExpressionContext: isConstantExpressionContext,
                       isAttributeNameContext: syntaxTree.IsAttributeNameContext(position, cancellationToken),
                       isEnumTypeMemberAccessContext: syntaxTree.IsEnumTypeMemberAccessContext(semanticModel, position, cancellationToken),
                       isNameOfContext: syntaxTree.IsNameOfContext(position, semanticModel, cancellationToken),
                       isInQuery: leftToken.GetAncestor <QueryExpressionSyntax>() != null,
                       isInImportsDirective: leftToken.GetAncestor <UsingDirectiveSyntax>() != null,
                       isLeftSideOfImportAliasDirective: IsLeftSideOfUsingAliasDirective(leftToken),
                       isLabelContext: syntaxTree.IsLabelContext(position, cancellationToken),
                       isTypeArgumentOfConstraintContext: syntaxTree.IsTypeArgumentOfConstraintClause(position, cancellationToken),
                       isRightOfDotOrArrowOrColonColon: syntaxTree.IsRightOfDotOrArrowOrColonColon(position, targetToken, cancellationToken),
                       isIsOrAsOrSwitchOrWithExpressionContext: syntaxTree.IsIsOrAsOrSwitchOrWithExpressionContext(semanticModel, position, leftToken, cancellationToken),
                       isObjectCreationTypeContext: syntaxTree.IsObjectCreationTypeContext(position, leftToken, cancellationToken),
                       isDefiniteCastTypeContext: syntaxTree.IsDefiniteCastTypeContext(position, leftToken),
                       isGenericTypeArgumentContext: syntaxTree.IsGenericTypeArgumentContext(position, leftToken, cancellationToken),
                       isEnumBaseListContext: syntaxTree.IsEnumBaseListContext(position, leftToken),
                       isIsOrAsTypeContext: syntaxTree.IsIsOrAsTypeContext(position, leftToken),
                       isLocalVariableDeclarationContext: syntaxTree.IsLocalVariableDeclarationContext(position, leftToken, cancellationToken),
                       isDeclarationExpressionContext: syntaxTree.IsDeclarationExpressionContext(position, leftToken),
                       isFixedVariableDeclarationContext: syntaxTree.IsFixedVariableDeclarationContext(position, leftToken),
                       isParameterTypeContext: syntaxTree.IsParameterTypeContext(position, leftToken),
                       isPossibleLambdaOrAnonymousMethodParameterTypeContext: syntaxTree.IsPossibleLambdaOrAnonymousMethodParameterTypeContext(position, leftToken, cancellationToken),
                       isImplicitOrExplicitOperatorTypeContext: syntaxTree.IsImplicitOrExplicitOperatorTypeContext(position, leftToken),
                       isPrimaryFunctionExpressionContext: syntaxTree.IsPrimaryFunctionExpressionContext(position, leftToken),
                       isDelegateReturnTypeContext: syntaxTree.IsDelegateReturnTypeContext(position, leftToken),
                       isTypeOfExpressionContext: syntaxTree.IsTypeOfExpressionContext(position, leftToken),
                       precedingModifiers: syntaxTree.GetPrecedingModifiers(position, leftToken),
                       isInstanceContext: syntaxTree.IsInstanceContext(targetToken, semanticModel, cancellationToken),
                       isCrefContext: syntaxTree.IsCrefContext(position, cancellationToken) && !leftToken.IsKind(SyntaxKind.DotToken),
                       isCatchFilterContext: syntaxTree.IsCatchFilterContext(position, leftToken),
                       isDestructorTypeContext: isDestructorTypeContext,
                       isPossibleTupleContext: syntaxTree.IsPossibleTupleContext(leftToken, position),
                       isStartPatternContext: syntaxTree.IsAtStartOfPattern(leftToken, position),
                       isAfterPatternContext: syntaxTree.IsAtEndOfPattern(leftToken, position),
                       isRightSideOfNumericType: isRightSideOfNumericType,
                       isInArgumentList: isArgumentListToken,
                       isFunctionPointerTypeArgumentContext: syntaxTree.IsFunctionPointerTypeArgumentContext(position, leftToken, cancellationToken),
                       cancellationToken: cancellationToken));
        }
Example #15
0
            public void Register(Workspace workspace)
            {
                Contract.ThrowIfTrue(_workspace != null);

                _workspace = workspace;
            }
 internal void SetWorkspaceAndRaiseEvents(Workspace?workspace)
 {
     SetWorkspace(workspace);
     RaiseEvents();
 }
Example #17
0
        /// <summary>
        /// Wait for all of the <see cref="IAsynchronousOperationWaiter"/> instances to finish their
        /// work.
        /// </summary>
        /// <remarks>
        /// This is a very handy method for debugging hangs in the unit test.  Set a break point in the
        /// loop, dig into the waiters and see all of the active <see cref="IAsyncToken"/> values
        /// representing the remaining work.
        /// </remarks>
        public async Task WaitAllAsync(
            Workspace?workspace,
            string[]?featureNames        = null,
            Action?eventProcessingAction = null,
            TimeSpan?timeout             = null
            )
        {
            var startTime    = Stopwatch.StartNew();
            var smallTimeout = TimeSpan.FromMilliseconds(10);

            RemoteHostClient?remoteHostClient = null;

            if (
                workspace?.Services.GetService <IRemoteHostClientProvider>() is
                { } remoteHostClientProvider
                )
            {
                remoteHostClient = await remoteHostClientProvider
                                   .TryGetRemoteHostClientAsync(CancellationToken.None)
                                   .ConfigureAwait(false);
            }

            List <Task>?tasks = null;

            while (true)
            {
                var waiters = GetCandidateWaiters(featureNames);
                tasks = waiters
                        .Select(x => x.ExpeditedWaitAsync())
                        .Where(t => !t.IsCompleted)
                        .ToList();

                if (remoteHostClient is not null)
                {
                    var isCompleted = await remoteHostClient
                                      .TryInvokeAsync <IRemoteAsynchronousOperationListenerService, bool>(
                        (service, cancellationToken) =>
                        service.IsCompletedAsync(
                            featureNames.ToImmutableArrayOrEmpty(),
                            cancellationToken
                            ),
                        CancellationToken.None
                        )
                                      .ConfigureAwait(false);

                    if (isCompleted.HasValue && !isCompleted.Value)
                    {
                        tasks.Add(
                            remoteHostClient
                            .TryInvokeAsync <IRemoteAsynchronousOperationListenerService>(
                                (service, cancellationToken) =>
                                service.ExpeditedWaitAsync(
                                    featureNames.ToImmutableArrayOrEmpty(),
                                    cancellationToken
                                    ),
                                CancellationToken.None
                                )
                            .AsTask()
                            );
                    }
                }

                if (tasks.Count == 0)
                {
                    // no new pending tasks
                    break;
                }

                do
                {
                    // wait for all current tasks to be done for the time given
                    if (Task.WaitAll(tasks.ToArray(), smallTimeout))
                    {
                        // current set of tasks are done.
                        // see whether there are new tasks added while we were waiting
                        break;
                    }

                    // certain test requires some event queues to be processed
                    // for waiter tasks to finish such as Dispatcher queue
                    eventProcessingAction?.Invoke();

                    // in unit test where it uses fake foreground task scheduler such as StaTaskScheduler
                    // we need to yield for the scheduler to run inlined tasks. If we are not processing events, we
                    // switch to the thread pool for the continuations since the yield will only let operations at the
                    // same or higher priority to execute prior to the continuation.
                    var continueOnCapturedContext = eventProcessingAction is object;
                    await Task.Delay(smallTimeout).ConfigureAwait(continueOnCapturedContext);

                    if (startTime.Elapsed > timeout && timeout != Timeout.InfiniteTimeSpan)
                    {
                        throw new TimeoutException();
                    }
                } while (true);
            }

            foreach (var task in tasks)
            {
                if (task.Exception != null)
                {
                    throw task.Exception;
                }
            }
        }
 internal void SetWorkspace(Workspace?workspace)
 => Workspace = workspace;
Example #19
0
 private static bool IsAvailable(ITextBuffer subjectBuffer, [NotNullWhen(true)] out Workspace?workspace)
 => subjectBuffer.TryGetWorkspace(out workspace) &&
 workspace.CanApplyChange(ApplyChangesKind.ChangeDocument) &&
 subjectBuffer.SupportsRefactorings();
Example #20
0
        public void ReportAnalyzerDiagnostic(DiagnosticAnalyzer analyzer, Diagnostic diagnostic, Workspace?workspace, ProjectId?projectId)
        {
            if (workspace != Workspace)
            {
                return;
            }

            // check whether we are reporting project specific diagnostic or workspace wide diagnostic
            var project = (projectId != null) ? workspace.CurrentSolution.GetProject(projectId) : null;

            // check whether project the diagnostic belong to still exist
            if (projectId != null && project == null)
            {
                // project the diagnostic belong to already removed from the solution.
                // ignore the diagnostic
                return;
            }

            var diagnosticData = DiagnosticData.Create(workspace, diagnostic, project?.Id);

            ReportAnalyzerDiagnostic(analyzer, diagnosticData, project);
        }
Example #21
0
 internal static bool TryGetWorkspace(this ITextBuffer buffer, [NotNullWhen(true)] out Workspace?workspace)
 => Workspace.TryGetWorkspace(buffer.AsTextContainer(), out workspace);
 public void CleanupGeneratedFiles(Workspace?workspace)
 {
 }
Example #23
0
 private CSharpSyntaxContext(
     Workspace?workspace,
     SemanticModel semanticModel,
     int position,
     SyntaxToken leftToken,
     SyntaxToken targetToken,
     TypeDeclarationSyntax containingTypeDeclaration,
     BaseTypeDeclarationSyntax containingTypeOrEnumDeclaration,
     bool isInNonUserCode,
     bool isPreProcessorDirectiveContext,
     bool isPreProcessorKeywordContext,
     bool isPreProcessorExpressionContext,
     bool isTypeContext,
     bool isNamespaceContext,
     bool isNamespaceDeclarationNameContext,
     bool isStatementContext,
     bool isGlobalStatementContext,
     bool isAnyExpressionContext,
     bool isNonAttributeExpressionContext,
     bool isConstantExpressionContext,
     bool isAttributeNameContext,
     bool isEnumTypeMemberAccessContext,
     bool isNameOfContext,
     bool isInQuery,
     bool isInImportsDirective,
     bool isLeftSideOfImportAliasDirective,
     bool isLabelContext,
     bool isTypeArgumentOfConstraintContext,
     bool isRightOfDotOrArrowOrColonColon,
     bool isIsOrAsOrSwitchOrWithExpressionContext,
     bool isObjectCreationTypeContext,
     bool isDefiniteCastTypeContext,
     bool isGenericTypeArgumentContext,
     bool isEnumBaseListContext,
     bool isIsOrAsTypeContext,
     bool isLocalVariableDeclarationContext,
     bool isDeclarationExpressionContext,
     bool isFixedVariableDeclarationContext,
     bool isParameterTypeContext,
     bool isPossibleLambdaOrAnonymousMethodParameterTypeContext,
     bool isImplicitOrExplicitOperatorTypeContext,
     bool isPrimaryFunctionExpressionContext,
     bool isDelegateReturnTypeContext,
     bool isTypeOfExpressionContext,
     ISet <SyntaxKind> precedingModifiers,
     bool isInstanceContext,
     bool isCrefContext,
     bool isCatchFilterContext,
     bool isDestructorTypeContext,
     bool isPossibleTupleContext,
     bool isStartPatternContext,
     bool isAfterPatternContext,
     bool isRightSideOfNumericType,
     bool isInArgumentList,
     bool isFunctionPointerTypeArgumentContext,
     CancellationToken cancellationToken)
     : base(workspace, semanticModel, position, leftToken, targetToken,
            isTypeContext, isNamespaceContext, isNamespaceDeclarationNameContext,
            isPreProcessorDirectiveContext, isPreProcessorExpressionContext,
            isRightOfDotOrArrowOrColonColon, isStatementContext, isAnyExpressionContext,
            isAttributeNameContext, isEnumTypeMemberAccessContext, isNameOfContext,
            isInQuery, isInImportsDirective, IsWithinAsyncMethod(), isPossibleTupleContext,
            isStartPatternContext, isAfterPatternContext, isRightSideOfNumericType, isInArgumentList,
            cancellationToken)
 {
     this.ContainingTypeDeclaration       = containingTypeDeclaration;
     this.ContainingTypeOrEnumDeclaration = containingTypeOrEnumDeclaration;
     this.IsInNonUserCode = isInNonUserCode;
     this.IsPreProcessorKeywordContext    = isPreProcessorKeywordContext;
     this.IsGlobalStatementContext        = isGlobalStatementContext;
     this.IsNonAttributeExpressionContext = isNonAttributeExpressionContext;
     this.IsConstantExpressionContext     = isConstantExpressionContext;
     this.IsLabelContext = isLabelContext;
     this.IsTypeArgumentOfConstraintContext       = isTypeArgumentOfConstraintContext;
     this.IsIsOrAsOrSwitchOrWithExpressionContext = isIsOrAsOrSwitchOrWithExpressionContext;
     this.IsObjectCreationTypeContext             = isObjectCreationTypeContext;
     this.IsDefiniteCastTypeContext         = isDefiniteCastTypeContext;
     this.IsGenericTypeArgumentContext      = isGenericTypeArgumentContext;
     this.IsEnumBaseListContext             = isEnumBaseListContext;
     this.IsIsOrAsTypeContext               = isIsOrAsTypeContext;
     this.IsLocalVariableDeclarationContext = isLocalVariableDeclarationContext;
     this.IsDeclarationExpressionContext    = isDeclarationExpressionContext;
     this.IsFixedVariableDeclarationContext = isFixedVariableDeclarationContext;
     this.IsParameterTypeContext            = isParameterTypeContext;
     this.IsPossibleLambdaOrAnonymousMethodParameterTypeContext = isPossibleLambdaOrAnonymousMethodParameterTypeContext;
     this.IsImplicitOrExplicitOperatorTypeContext = isImplicitOrExplicitOperatorTypeContext;
     this.IsPrimaryFunctionExpressionContext      = isPrimaryFunctionExpressionContext;
     this.IsDelegateReturnTypeContext             = isDelegateReturnTypeContext;
     this.IsTypeOfExpressionContext            = isTypeOfExpressionContext;
     this.PrecedingModifiers                   = precedingModifiers;
     this.IsInstanceContext                    = isInstanceContext;
     this.IsCrefContext                        = isCrefContext;
     this.IsCatchFilterContext                 = isCatchFilterContext;
     this.IsDestructorTypeContext              = isDestructorTypeContext;
     this.IsLeftSideOfImportAliasDirective     = isLeftSideOfImportAliasDirective;
     this.IsFunctionPointerTypeArgumentContext = isFunctionPointerTypeArgumentContext;
 }