286 references to Options
Microsoft.CodeAnalysis (6)
Compilation\Compilation.cs (3)
102var treeFeatures = tree.Options.Features; 1076Debug.Assert(tree.Options.Kind != SourceCodeKind.Script); 2595return tree.Options.DocumentationMode != DocumentationMode.None;
Compilation\DeterministicKey.cs (1)
41=> _tree.Options;
SourceGeneration\GeneratorState.cs (1)
129internal bool RequiresPostInitReparse(ParseOptions parseOptions) => PostInitTrees.Any(static (t, parseOptions) => t.Tree.Options != parseOptions, parseOptions);
Syntax\SyntaxNodeExtensions.cs (1)
436return node != null ? oldTree.WithRootAndOptions(node, oldTree.Options).GetRoot() : null;
Microsoft.CodeAnalysis.CodeStyle (7)
src\Analyzers\Core\Analyzers\RemoveUnnecessaryImports\AbstractRemoveUnnecessaryImportsDiagnosticAnalyzer.cs (1)
128if (tree is null || tree.Options.DocumentationMode != DocumentationMode.None)
src\Analyzers\Core\Analyzers\UseCoalesceExpression\AbstractUseCoalesceExpressionForIfNullCheckDiagnosticAnalyzer.cs (1)
86if (!syntaxFacts.SupportsThrowExpression(ifStatement.SyntaxTree.Options))
src\Analyzers\Core\Analyzers\UseCollectionInitializer\AbstractUseCollectionInitializerAnalyzer.cs (1)
206if (!this.SyntaxFacts.SupportsIndexingInitializer(statement.SyntaxTree.Options))
src\Analyzers\Core\Analyzers\UseCollectionInitializer\UpdateExpressionState.cs (1)
433return @this.SyntaxFacts.SupportsCollectionExpressionNaturalType(ifStatement.SyntaxTree.Options)
src\Analyzers\Core\Analyzers\UseCompoundAssignment\AbstractUseCompoundAssignmentDiagnosticAnalyzer.cs (1)
106if (!IsSupported(binaryKind, syntaxTree.Options))
src\Analyzers\Core\Analyzers\UseConditionalExpression\UseConditionalExpressionHelpers.cs (1)
93if (!syntaxFacts.SupportsThrowExpression(anyThrow.Syntax.SyntaxTree.Options))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (1)
37=> syntaxTree.Options.Kind != SourceCodeKind.Regular;
Microsoft.CodeAnalysis.CodeStyle.Fixes (10)
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator.cs (1)
86compilation, tree.Options, unimplementedMembers, Options.PropertyGenerationBehavior);
src\Analyzers\Core\CodeFixes\UseIsNullCheck\AbstractUseIsNullForReferenceEqualsCodeFixProvider.cs (1)
41var title = GetTitle(negated, diagnostic.Location.SourceTree!.Options);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (1)
246var info = GetInfo(context.Context, codeGenOptions, destinationDeclaration.SyntaxTree.Options);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions.cs (1)
445var condition = generatorInternal.SupportsPatterns(semanticModel.SyntaxTree.Options)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (1)
74factory, generatorInternal, semanticModel.Compilation, semanticModel.SyntaxTree.Options, containingType, symbols);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (5)
65var options = semanticModel.SyntaxTree.Options; 186else if (operation is IIsTypeOperation { TypeOperand.SpecialType: SpecialType.System_Object } && generatorInternal.SupportsPatterns(semanticModel.SyntaxTree.Options)) 191else if (syntaxFacts.IsIsTypeExpression(expressionNode) && syntaxFacts.SupportsNotPattern(semanticModel.SyntaxTree.Options)) 270if (syntaxFacts.SupportsNotPattern(semanticModel.SyntaxTree.Options)) 559if (syntaxFacts.SupportsNotPattern(pattern.SyntaxTree.Options) &&
Microsoft.CodeAnalysis.CSharp (43)
Binder\Binder_Initializers.cs (1)
195Debug.Assert(syntaxTree.Options.Kind != SourceCodeKind.Regular);
Binder\Binder_Statements.cs (1)
1289bool extensibleFixedEnabled = ((CSharpParseOptions)initializerOpt.SyntaxTree.Options)?.IsFeatureEnabled(MessageID.IDS_FeatureExtensibleFixedStatement) != false;
Binder\Binder_Symbols.cs (1)
2759if (feature.GetFeatureAvailabilityDiagnosticInfo((CSharpParseOptions)tree.Options) is { } diagInfo)
Binder\BinderFactory.BinderFactoryVisitor.cs (1)
441if (node.Parent.Kind() == SyntaxKind.CompilationUnit && syntaxTree.Options.Kind != SourceCodeKind.Regular)
Binder\BinderFactory.cs (1)
94return _syntaxTree.Options.Kind == SourceCodeKind.Script;
Compilation\CSharpCompilation.cs (5)
539var version = ((CSharpParseOptions)tree.Options).LanguageVersion; 2955if (!syntaxTree.Options.Errors.IsDefaultOrEmpty && parseOptionsReported.Add(syntaxTree.Options)) 2958foreach (var error in syntaxTree.Options.Errors) 4676bool value = SyntaxTrees.FirstOrDefault()?.Options?.Features?.ContainsKey("nullablePublicOnly") == true;
Compilation\CSharpCompilationExtensions.cs (1)
19return ((CSharpParseOptions?)syntax?.SyntaxTree.Options)?.IsFeatureEnabled(feature) == true;
Compilation\SyntaxAndDeclarationManager.cs (3)
167var sourceCodeKind = tree.Options.Kind; 243tree.Options, // Use ParseOptions propagated from "external" tree. 681var sourceCodeKind = tree.Options.Kind;
Compilation\SyntaxTreeSemanticModel.cs (2)
1299return this.SyntaxTree.Options.Kind == SourceCodeKind.Regular; 2310if (this.SyntaxTree.Options.Kind != SourceCodeKind.Regular)
Compiler\DocumentationCommentCompiler.cs (1)
697DocumentationMode currDocumentationMode = reference.SyntaxTree.Options.DocumentationMode;
Compiler\DocumentationCommentCompiler.IncludeElementExpander.cs (1)
104Debug.Assert(sourceIncludeElementNodes.All(syntax => syntax.SyntaxTree.Options.DocumentationMode < DocumentationMode.Diagnose),
Declarations\DeclarationTreeBuilder.cs (5)
130(node.Kind() == SyntaxKind.CompilationUnit && _syntaxTree.Options.Kind == SourceCodeKind.Regular)); 140bool acceptSimpleProgram = node.Kind() == SyntaxKind.CompilationUnit && _syntaxTree.Options.Kind == SourceCodeKind.Regular; 266Debug.Assert(_syntaxTree.Options.Kind != SourceCodeKind.Regular); 326Debug.Assert(parent.Kind() == SyntaxKind.CompilationUnit && _syntaxTree.Options.Kind != SourceCodeKind.Regular); 392if (_syntaxTree.Options.Kind != SourceCodeKind.Regular)
DocumentationComments\SourceDocumentationCommentUtils.cs (1)
35if (syntaxNode.SyntaxTree.Options.DocumentationMode < DocumentationMode.Parse)
Errors\MessageID.cs (4)
356syntax.SyntaxTree.Options, 370syntax.SyntaxTree!.Options, 384syntax.SyntaxTree.Options, 398syntax.SyntaxTree!.Options,
Symbols\Source\LocalFunctionSymbol.cs (1)
397var diagnosticInfo = MessageID.IDS_FeatureLocalFunctionAttributes.GetFeatureAvailabilityDiagnosticInfo((CSharpParseOptions)syntaxReferenceOpt.SyntaxTree.Options);
Symbols\Source\ModifierUtils.cs (3)
122if (MessageID.IDS_FeatureRefFields.GetFeatureAvailabilityDiagnosticInfo((CSharpParseOptions)syntax.SyntaxTree.Options) is { } diagnosticInfo) 153LanguageVersion availableVersion = ((CSharpParseOptions)errorLocation.SourceTree.Options).LanguageVersion; 217LanguageVersion availableVersion = ((CSharpParseOptions)location.SourceTree.Options).LanguageVersion;
Symbols\Source\SourceMemberContainerSymbol.cs (1)
4460var languageVersion = ((CSharpParseOptions)this.GetFirstLocation().SourceTree!.Options).LanguageVersion;
Symbols\Source\SourceMethodSymbolWithAttributes.cs (1)
1173var interceptorsNamespaces = ((CSharpParseOptions)attributeSyntax.SyntaxTree.Options).InterceptorsNamespaces;
Symbols\Source\SourceModuleSymbol.cs (2)
346ImmutableArray<ImmutableArray<string>> interceptorsNamespaces = ((CSharpParseOptions)location.SourceTree.Options).InterceptorsNamespaces; 600var options = (CSharpParseOptions?)compilation.SyntaxTrees.FirstOrDefault()?.Options;
Symbols\Source\SourcePropertyAccessorSymbol.cs (1)
464var options = (CSharpParseOptions)SyntaxTree.Options;
Symbols\Source\SourcePropertySymbol.cs (1)
452LanguageVersion availableVersion = ((CSharpParseOptions)location.SourceTree.Options).LanguageVersion;
Symbols\Source\SourceUserDefinedOperatorSymbolBase.cs (1)
169LanguageVersion availableVersion = ((CSharpParseOptions)location.SourceTree.Options).LanguageVersion;
Symbols\Symbol_Attributes.cs (1)
696var parseOptions = (CSharpParseOptions)targetOpt.SyntaxTree.Options;
Syntax\SyntaxExtensions.cs (1)
179return tree.Options.DocumentationMode >= DocumentationMode.Diagnose;
Syntax\SyntaxFactory.cs (2)
2321if (tree.Options.Kind != SourceCodeKind.Script) 2379if (tree.Options.Kind == SourceCodeKind.Regular ||
Microsoft.CodeAnalysis.CSharp.CodeStyle (15)
src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertNamespaceAnalysis.cs (1)
41=> CanOfferUseFileScoped(option, root, declaration, forAnalyzer, root.SyntaxTree.Options.LanguageVersion());
src\Analyzers\CSharp\Analyzers\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionDiagnosticAnalyzer.Analyzer.cs (1)
36var analyzer = new Analyzer(supportsOrPatterns: semanticModel.SyntaxTree.Options.LanguageVersion() >= LanguageVersion.CSharp9);
src\Analyzers\CSharp\Analyzers\InlineDeclaration\CSharpInlineDeclarationDiagnosticAnalyzer.cs (1)
71var csOptions = (CSharpParseOptions)syntaxTree.Options;
src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (1)
53if (ifStatement.SyntaxTree.Options.LanguageVersion() < LanguageVersion.CSharp6)
src\Analyzers\CSharp\Analyzers\RemoveUnusedParametersAndValues\CSharpRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs (1)
30=> tree.Options.LanguageVersion() >= LanguageVersion.CSharp7;
src\Analyzers\CSharp\Analyzers\UseDefaultLiteral\CSharpUseDefaultLiteralDiagnosticAnalyzer.cs (1)
42var parseOptions = (CSharpParseOptions)syntaxTree.Options;
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyHelper`1.cs (1)
142var languageVersion = body.SyntaxTree.Options.LanguageVersion();
src\Analyzers\CSharp\Analyzers\UseExpressionBodyForLambda\UseExpressionBodyForLambdaHelpers.cs (1)
55var languageVersion = declaration.SyntaxTree.Options.LanguageVersion();
src\Analyzers\CSharp\Analyzers\UseImplicitObjectCreation\CSharpUseImplicitObjectCreationDiagnosticAnalyzer.cs (1)
44if (syntaxTree.Options.LanguageVersion() < LanguageVersion.CSharp9)
src\Analyzers\CSharp\Analyzers\UseInferredMemberName\CSharpUseInferredMemberNameDiagnosticAnalyzer.cs (1)
45var parseOptions = (CSharpParseOptions)syntaxTree.Options;
src\Analyzers\CSharp\Analyzers\UseLocalFunction\CSharpUseLocalFunctionDiagnosticAnalyzer.cs (1)
127var options = semanticModel.SyntaxTree.Options;
src\Analyzers\CSharp\Analyzers\UsePatternCombinators\CSharpUsePatternCombinatorsDiagnosticAnalyzer.cs (1)
65if (syntaxTree.Options.LanguageVersion() < LanguageVersion.CSharp9)
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.cs (1)
64if (syntaxTree.Options.LanguageVersion() < LanguageVersion.CSharp7)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (1)
24=> ((CSharpParseOptions)node.SyntaxTree.Options).LanguageVersion;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (1)
201var newTree = tree.WithRootAndOptions(newRoot, tree.Options);
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (7)
src\Analyzers\CSharp\CodeFixes\RemoveUnusedParametersAndValues\CSharpRemoveUnusedValuesCodeFixProvider.cs (1)
101parent.SyntaxTree.Options.LanguageVersion() >= LanguageVersion.CSharp9)
src\Analyzers\CSharp\CodeFixes\UseDefaultLiteral\CSharpUseDefaultLiteralCodeFixProvider.cs (1)
50var parseOptions = (CSharpParseOptions)originalRoot.SyntaxTree.Options;
src\Analyzers\CSharp\CodeFixes\UseIsNullCheck\CSharpUseIsNullCheckForCastAndEqualityOperatorCodeFixProvider.cs (2)
43var title = GetTitle(negated, diagnostic.Location.SourceTree!.Options); 78if (SupportsIsNotPattern(binary.SyntaxTree.Options))
src\Analyzers\CSharp\CodeFixes\UseIsNullCheck\CSharpUseIsNullCheckForReferenceEqualsCodeFixProvider.cs (1)
41if (SupportsIsNotPattern(argument.SyntaxTree.Options))
src\Analyzers\CSharp\CodeFixes\UseLocalFunction\CSharpUseLocalFunctionCodeFixProvider.cs (1)
86var languageVersion = semanticModel.SyntaxTree.Options.LanguageVersion();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (1)
84var tree = node.SyntaxTree.WithRootAndOptions(node, syntaxTree.Options);
Microsoft.CodeAnalysis.CSharp.EditorFeatures (6)
AutomaticCompletion\AutomaticLineEnderCommandHandler.cs (5)
179BaseFieldDeclarationSyntax => SyntaxFactory.ParseCompilationUnit(WrapInType(textToParse), options: (CSharpParseOptions)tree.Options), 180BaseMethodDeclarationSyntax => SyntaxFactory.ParseCompilationUnit(WrapInType(textToParse), options: (CSharpParseOptions)tree.Options), 181BasePropertyDeclarationSyntax => SyntaxFactory.ParseCompilationUnit(WrapInType(textToParse), options: (CSharpParseOptions)tree.Options), 182StatementSyntax => SyntaxFactory.ParseStatement(textToParse, options: (CSharpParseOptions)tree.Options), 183UsingDirectiveSyntax => SyntaxFactory.ParseCompilationUnit(textToParse, options: (CSharpParseOptions)tree.Options),
EventHookup\EventHookupCommandHandler_TabKeyCommand.cs (1)
330var codeGenOptions = codeGenerator.GetInfo(new CodeGenerationContext(afterThisLocation: eventHookupExpression.GetLocation()), options, root.SyntaxTree.Options);
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (1)
Emit\EditAndContinue\EditAndContinueTestBase.cs (1)
266var previousParseOptions = (CSharpParseOptions)compilation.SyntaxTrees.FirstOrDefault()?.Options;
Microsoft.CodeAnalysis.CSharp.Features (32)
CodeRefactorings\UseRecursivePatterns\UseRecursivePatternsCodeRefactoringProvider.cs (1)
384if (names.Length > 1 && names[0].SyntaxTree.Options.LanguageVersion() >= LanguageVersion.CSharp10)
ConvertToRawString\ConvertInterpolatedStringToRawStringCodeRefactoringProvider.cs (2)
247var parsed = (InterpolatedStringExpressionSyntax)ParseExpression(indentedText.ToString(), options: stringExpression.SyntaxTree.Options); 627var parsed = (InterpolatedStringExpressionSyntax)ParseExpression(builder.ToString(), options: stringExpression.SyntaxTree.Options);
Copilot\CSharpCopilotCodeFixProvider.cs (1)
108var memberDeclaration = SyntaxFactory.ParseMemberDeclaration(fix, options: method.SyntaxTree.Options);
Diagnostics\Analyzers\CSharpPreferFrameworkTypeDiagnosticAnalyzer.cs (1)
34semanticModel.SyntaxTree.Options.LanguageVersion() >= LanguageVersion.CSharp9 &&
EmbeddedLanguages\CSharpTestEmbeddedLanguageClassifier.cs (1)
118var testFileTree = SyntaxFactory.ParseSyntaxTree(testFileSourceText, semanticModel.SyntaxTree.Options, cancellationToken: cancellationToken);
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs (2)
171=> node.SyntaxTree.Options.LanguageVersion() < LanguageVersion.CSharp8; 216var languageVersion = SemanticDocument.SyntaxTree.Options.LanguageVersion();
ExtractMethod\CSharpSelectionValidator.cs (1)
45selectionInfo = ApplySpecialCases(selectionInfo, text, SemanticDocument.SyntaxTree.Options, _localFunction);
MetadataAsSource\CSharpMetadataAsSourceService.cs (1)
104var options = (CSharpParseOptions)tree.Options;
QuickInfo\CSharpSemanticQuickInfoProvider.cs (1)
89var parseOptions = (CSharpParseOptions)semanticModel.SyntaxTree!.Options;
src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertNamespaceAnalysis.cs (1)
41=> CanOfferUseFileScoped(option, root, declaration, forAnalyzer, root.SyntaxTree.Options.LanguageVersion());
src\Analyzers\CSharp\Analyzers\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionDiagnosticAnalyzer.Analyzer.cs (1)
36var analyzer = new Analyzer(supportsOrPatterns: semanticModel.SyntaxTree.Options.LanguageVersion() >= LanguageVersion.CSharp9);
src\Analyzers\CSharp\Analyzers\InlineDeclaration\CSharpInlineDeclarationDiagnosticAnalyzer.cs (1)
71var csOptions = (CSharpParseOptions)syntaxTree.Options;
src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (1)
53if (ifStatement.SyntaxTree.Options.LanguageVersion() < LanguageVersion.CSharp6)
src\Analyzers\CSharp\Analyzers\RemoveUnusedParametersAndValues\CSharpRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs (1)
30=> tree.Options.LanguageVersion() >= LanguageVersion.CSharp7;
src\Analyzers\CSharp\Analyzers\UseDefaultLiteral\CSharpUseDefaultLiteralDiagnosticAnalyzer.cs (1)
42var parseOptions = (CSharpParseOptions)syntaxTree.Options;
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyHelper`1.cs (1)
142var languageVersion = body.SyntaxTree.Options.LanguageVersion();
src\Analyzers\CSharp\Analyzers\UseExpressionBodyForLambda\UseExpressionBodyForLambdaHelpers.cs (1)
55var languageVersion = declaration.SyntaxTree.Options.LanguageVersion();
src\Analyzers\CSharp\Analyzers\UseImplicitObjectCreation\CSharpUseImplicitObjectCreationDiagnosticAnalyzer.cs (1)
44if (syntaxTree.Options.LanguageVersion() < LanguageVersion.CSharp9)
src\Analyzers\CSharp\Analyzers\UseInferredMemberName\CSharpUseInferredMemberNameDiagnosticAnalyzer.cs (1)
45var parseOptions = (CSharpParseOptions)syntaxTree.Options;
src\Analyzers\CSharp\Analyzers\UseLocalFunction\CSharpUseLocalFunctionDiagnosticAnalyzer.cs (1)
127var options = semanticModel.SyntaxTree.Options;
src\Analyzers\CSharp\Analyzers\UsePatternCombinators\CSharpUsePatternCombinatorsDiagnosticAnalyzer.cs (1)
65if (syntaxTree.Options.LanguageVersion() < LanguageVersion.CSharp9)
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.cs (1)
64if (syntaxTree.Options.LanguageVersion() < LanguageVersion.CSharp7)
src\Analyzers\CSharp\CodeFixes\RemoveUnusedParametersAndValues\CSharpRemoveUnusedValuesCodeFixProvider.cs (1)
101parent.SyntaxTree.Options.LanguageVersion() >= LanguageVersion.CSharp9)
src\Analyzers\CSharp\CodeFixes\UseDefaultLiteral\CSharpUseDefaultLiteralCodeFixProvider.cs (1)
50var parseOptions = (CSharpParseOptions)originalRoot.SyntaxTree.Options;
src\Analyzers\CSharp\CodeFixes\UseIsNullCheck\CSharpUseIsNullCheckForCastAndEqualityOperatorCodeFixProvider.cs (2)
43var title = GetTitle(negated, diagnostic.Location.SourceTree!.Options); 78if (SupportsIsNotPattern(binary.SyntaxTree.Options))
src\Analyzers\CSharp\CodeFixes\UseIsNullCheck\CSharpUseIsNullCheckForReferenceEqualsCodeFixProvider.cs (1)
41if (SupportsIsNotPattern(argument.SyntaxTree.Options))
src\Analyzers\CSharp\CodeFixes\UseLocalFunction\CSharpUseLocalFunctionCodeFixProvider.cs (1)
86var languageVersion = semanticModel.SyntaxTree.Options.LanguageVersion();
UsePatternMatching\CSharpIsAndCastCheckWithoutNameDiagnosticAnalyzer.cs (2)
73if (syntaxTree.Options.LanguageVersion() < LanguageVersion.CSharp7) 218changedRoot, semanticModel.SyntaxTree.Options);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (4)
SourceGeneration\GeneratorDriverTests.cs (4)
4500Assert.Same(newParseOptions, result.GeneratedTrees[0].Options); 4501Assert.Same(parseOptions, result.GeneratedTrees[1].Options); 4508Assert.Same(newParseOptions, result.GeneratedTrees[0].Options); 4509Assert.Same(newParseOptions, result.GeneratedTrees[1].Options);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (6)
Compilation\UsedAssembliesTests.cs (3)
164yield return (comp.ReplaceSyntaxTree(tree, CSharpTestBase.Parse(builder.ToString(), tree.FilePath, (CSharpParseOptions)tree.Options)), before, after); 190LanguageVersion treeLanguageVersion = ((CSharpParseOptions)tree.Options).LanguageVersion; 191var parseOptions = ((CSharpParseOptions)tree.Options).WithLanguageVersion(treeLanguageVersion > LanguageVersion.CSharp10 ? treeLanguageVersion : LanguageVersion.CSharp10);
DeclarationTests.cs (1)
952get { return (CSharpParseOptions)_underlyingTree.Options; }
Symbols\CovariantReturnTests.cs (2)
451return comp.AddSyntaxTrees(CSharpSyntaxTree.ParseText(assignments, (CSharpParseOptions)comp.SyntaxTrees[0].Options, path: "assignments.cs", encoding: Encoding.UTF8)); 510var parseOptions = (CSharpParseOptions)comp.SyntaxTrees[0].Options;
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (47)
IncrementalParsing\IncrementalParsingTests.cs (3)
2906var fullTree = SyntaxFactory.ParseSyntaxTree(newIText.ToString(), options: newTree.Options); 2920fullTree = SyntaxFactory.ParseSyntaxTree(newIText.ToString(), options: newTree.Options); 3060var oldTree = SyntaxFactory.SyntaxTree(oldRoot, options: tempTree.Options, path: tempTree.FilePath);
Parsing\LocalFunctionParsingTests.cs (2)
1293Assert.Equal(0, file.SyntaxTree.Options.Features.Count); 1345Assert.Equal(0, file.SyntaxTree.Options.Features.Count);
Syntax\SyntaxRewriterTests.cs (39)
368Assert.Equal(SourceCodeKind.Script, newTree.Options.Kind); 369Assert.Equal(tree.Options, newTree.Options); 377Assert.Equal(SourceCodeKind.Script, tree.Options.Kind); 387Assert.Equal(SourceCodeKind.Script, newTree.Options.Kind); 388Assert.Equal(tree.Options, newTree.Options); 396Assert.Equal(SourceCodeKind.Script, tree.Options.Kind); 407Assert.Equal(SourceCodeKind.Script, newTree.Options.Kind); 408Assert.Equal(tree.Options, newTree.Options); 414Assert.Equal(SourceCodeKind.Script, newTree2.Options.Kind); 415Assert.Equal(tree.Options, newTree2.Options); 423Assert.Equal(SourceCodeKind.Script, tree.Options.Kind); 434Assert.Equal(SourceCodeKind.Script, newTree.Options.Kind); 435Assert.Equal(tree.Options, newTree.Options); 451Assert.Equal(SourceCodeKind.Script, newTree.Options.Kind); 452Assert.Equal(tree.Options, newTree.Options); 457Assert.Equal(SourceCodeKind.Script, newTree2.Options.Kind); 458Assert.Equal(tree.Options, newTree2.Options); 478Assert.Equal(SourceCodeKind.Script, newTree.Options.Kind); 479Assert.Equal(tree.Options, newTree.Options); 484Assert.Equal(SourceCodeKind.Script, newTree2.Options.Kind); 485Assert.Equal(tree.Options, newTree2.Options); 506Assert.Equal(SourceCodeKind.Script, newTree.Options.Kind); 507Assert.Equal(tree.Options, newTree.Options); 519Assert.Equal(SourceCodeKind.Script, newTree.Options.Kind); 520Assert.Equal(tree.Options, newTree.Options); 532Assert.Equal(SourceCodeKind.Script, newTree.Options.Kind); 533Assert.Equal(tree.Options, newTree.Options);
Syntax\SyntaxTreeTests.cs (3)
250Assert.Same(newOptions, newTree.Options); 268Assert.Same(newOptions, newTree.Options); 281Assert.Same(newOptions, newTree.Options);
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
CSharpTestBase.cs (1)
1416var options = (CSharpParseOptions)trees[0].Options;
Microsoft.CodeAnalysis.CSharp.Workspaces (5)
FindSymbols\CSharpDeclaredSymbolInfoFactoryService.cs (1)
630if (((CSharpParseOptions)container.SyntaxTree.Options).Kind == SourceCodeKind.Script)
Simplification\Simplifiers\AbstractCSharpSimplifier.cs (1)
64semanticModel.SyntaxTree.Options.LanguageVersion() >= LanguageVersion.CSharp9 &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (1)
24=> ((CSharpParseOptions)node.SyntaxTree.Options).LanguageVersion;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (1)
201var newTree = tree.WithRootAndOptions(newRoot, tree.Options);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (1)
84var tree = node.SyntaxTree.WithRootAndOptions(node, syntaxTree.Options);
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (6)
CodeGeneration\CodeGenerationTests.cs (6)
93var info = testContext.Service.GetInfo(context ?? CodeGenerationContext.Default, options, root.SyntaxTree.Options); 314var info = testContext.Service.GetInfo(context ?? CodeGenerationContext.Default, options, oldSyntax.SyntaxTree.Options); 329var info = testContext.Service.GetInfo(context ?? CodeGenerationContext.Default, options, oldMemberSyntax.SyntaxTree.Options); 540var info = codeGenerator.GetInfo(CodeGenerationContext.Default, options, oldNode.SyntaxTree.Options); 559var info = codeGenerator.GetInfo(CodeGenerationContext.Default, options, testContext.SemanticModel.SyntaxTree.Options); 581var info = codeGenerator.GetInfo(new CodeGenerationContext(reuseSyntax: true), options, declarationNode.SyntaxTree.Options);
Microsoft.CodeAnalysis.Features (13)
CodeFixes\Configuration\ConfigureCodeStyle\ConfigureCodeStyleOptionCodeFixProvider.cs (1)
49var language = diagnostic.Location.SourceTree.Options.Language;
CodeRefactorings\ExtractMethod\AbstractExtractMethodCodeRefactoringProvider.cs (1)
102if (!syntaxFacts.SupportsLocalFunctionDeclaration(syntaxTree.Options))
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.cs (1)
94analyzer = CreateAnalyzer(syntaxFactsService, ifStatement.SyntaxTree.Options);
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (2)
560Debug.Assert(oldTree == null || oldTree.Options.Equals(newTree.Options));
ExtractMethod\Extensions.cs (1)
69return node.SyntaxTree.Options.Kind != SourceCodeKind.Regular;
src\Analyzers\Core\Analyzers\UseCoalesceExpression\AbstractUseCoalesceExpressionForIfNullCheckDiagnosticAnalyzer.cs (1)
86if (!syntaxFacts.SupportsThrowExpression(ifStatement.SyntaxTree.Options))
src\Analyzers\Core\Analyzers\UseCollectionInitializer\AbstractUseCollectionInitializerAnalyzer.cs (1)
206if (!this.SyntaxFacts.SupportsIndexingInitializer(statement.SyntaxTree.Options))
src\Analyzers\Core\Analyzers\UseCollectionInitializer\UpdateExpressionState.cs (1)
433return @this.SyntaxFacts.SupportsCollectionExpressionNaturalType(ifStatement.SyntaxTree.Options)
src\Analyzers\Core\Analyzers\UseCompoundAssignment\AbstractUseCompoundAssignmentDiagnosticAnalyzer.cs (1)
106if (!IsSupported(binaryKind, syntaxTree.Options))
src\Analyzers\Core\Analyzers\UseConditionalExpression\UseConditionalExpressionHelpers.cs (1)
93if (!syntaxFacts.SupportsThrowExpression(anyThrow.Syntax.SyntaxTree.Options))
src\Analyzers\Core\CodeFixes\UseIsNullCheck\AbstractUseIsNullForReferenceEqualsCodeFixProvider.cs (1)
41var title = GetTitle(negated, diagnostic.Location.SourceTree!.Options);
UseNamedArguments\AbstractUseNamedArgumentsCodeRefactoringProvider.cs (1)
108if (SupportsNonTrailingNamedArguments(root.SyntaxTree.Options) &&
Microsoft.CodeAnalysis.Test.Utilities (1)
Compilation\CompilationExtensions.cs (1)
367if (blockOperation.Syntax.SyntaxTree.Options.Kind != SourceCodeKind.Script)
Microsoft.CodeAnalysis.VisualBasic (13)
Binding\Binder_Invocation.vb (1)
2904DirectCast(argument.Syntax.SyntaxTree.Options, VisualBasicParseOptions).LanguageVersion,
Binding\Binder_Statements.vb (1)
1966DirectCast(node.SyntaxTree.Options, VisualBasicParseOptions).LanguageVersion,
Binding\BinderFactory.vb (2)
36Return _tree.Options.Kind = SourceCodeKind.Script 165If node.Kind <> SyntaxKind.CompilationUnit OrElse _tree.Options.Kind = SourceCodeKind.Regular Then
Compilation\VisualBasicCompilation.vb (4)
491Dim version = CType(tree.Options, VisualBasicParseOptions).LanguageVersion 2178If Not tree.Options.Errors.IsDefaultOrEmpty AndAlso parseOptionsReported.Add(tree.Options) Then 2180For Each err In tree.Options.Errors
Declarations\DeclarationTreeBuilder.vb (2)
132Debug.Assert(parent.Kind = SyntaxKind.CompilationUnit AndAlso _syntaxTree.Options.Kind <> SourceCodeKind.Regular) 175If _syntaxTree.Options.Kind <> SourceCodeKind.Regular Then
Symbols\ConstraintsHelper.vb (1)
469DirectCast(syntaxNode.SyntaxTree.Options, VisualBasicParseOptions).LanguageVersion,
Syntax\SyntaxExtensions.vb (1)
15Return tree.Options.DocumentationMode >= DocumentationMode.Diagnose
Syntax\SyntaxFactory.vb (1)
1067Dim options As VisualBasicParseOptions = DirectCast(tree.Options, VisualBasicParseOptions)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (3)
src\Analyzers\VisualBasic\Analyzers\UseInferredMemberName\VisualBasicUseInferredMemberNameDiagnosticAnalyzer.vb (1)
49Not CanSimplifyTupleName(argument, DirectCast(syntaxTree.Options, VisualBasicParseOptions)) Then
src\Analyzers\VisualBasic\Analyzers\UseIsNotExpression\VisualBasicUseIsNotDiagnosticAnalyzer.vb (1)
48If DirectCast(syntaxTree.Options, VisualBasicParseOptions).LanguageVersion < LanguageVersion.VisualBasic14 Then
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Helpers\RemoveUnnecessaryImports\VisualBasicUnnecessaryImportsProvider.vb (1)
76Dim updatedSyntaxTree = model.SyntaxTree.WithRootAndOptions(updatedRoot, model.SyntaxTree.Options)
Microsoft.CodeAnalysis.VisualBasic.Features (2)
src\Analyzers\VisualBasic\Analyzers\UseInferredMemberName\VisualBasicUseInferredMemberNameDiagnosticAnalyzer.vb (1)
49Not CanSimplifyTupleName(argument, DirectCast(syntaxTree.Options, VisualBasicParseOptions)) Then
src\Analyzers\VisualBasic\Analyzers\UseIsNotExpression\VisualBasicUseIsNotDiagnosticAnalyzer.vb (1)
48If DirectCast(syntaxTree.Options, VisualBasicParseOptions).LanguageVersion < LanguageVersion.VisualBasic14 Then
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (34)
IncrementalParser\IncrementalParser.vb (1)
1717Dim oldTree2 = VisualBasicSyntaxTree.Create(DirectCast(oldRoot2, VisualBasicSyntaxNode), DirectCast(tempTree2.Options, VisualBasicParseOptions), tempTree2.FilePath, Encoding.UTF8)
Syntax\SyntaxRewriterTests.vb (30)
529Assert.Equal(SourceCodeKind.Script, tree.Options.Kind) 537Assert.Equal(SourceCodeKind.Script, newTree.Options.Kind) 538Assert.Equal(tree.Options, newTree.Options) 546Assert.Equal(SourceCodeKind.Script, tree.Options.Kind) 556Assert.Equal(SourceCodeKind.Script, newTree.Options.Kind) 557Assert.Equal(tree.Options, newTree.Options) 565Assert.Equal(SourceCodeKind.Script, tree.Options.Kind) 577Assert.Equal(tree.Options, newTree.Options) 584Assert.Equal(tree.Options, newTree2.Options) 592Assert.Equal(SourceCodeKind.Script, tree.Options.Kind) 603Assert.Equal(SourceCodeKind.Script, newTree.Options.Kind) 604Assert.Equal(tree.Options, newTree.Options) 621Assert.Equal(SourceCodeKind.Script, newTree.Options.Kind) 622Assert.Equal(tree.Options, newTree.Options) 627Assert.Equal(SourceCodeKind.Script, newTree2.Options.Kind) 628Assert.Equal(tree.Options, newTree2.Options) 649Assert.Equal(tree.Options, newTree.Options) 655Assert.Equal(tree.Options, newTree2.Options) 677Assert.Equal(tree.Options, newTree.Options) 689Assert.Equal(SourceCodeKind.Script, newTree.Options.Kind) 690Assert.Equal(tree.Options, newTree.Options) 702Assert.Equal(SourceCodeKind.Script, newTree.Options.Kind) 703Assert.Equal(tree.Options, newTree.Options)
Syntax\SyntaxTreeTests.vb (3)
117Assert.Same(newOptions, newTree.Options) 134Assert.Same(newOptions, newTree.Options) 147Assert.Same(newOptions, newTree.Options)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Helpers\RemoveUnnecessaryImports\VisualBasicUnnecessaryImportsProvider.vb (1)
76Dim updatedSyntaxTree = model.SyntaxTree.WithRootAndOptions(updatedRoot, model.SyntaxTree.Options)
Microsoft.CodeAnalysis.Workspaces (11)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (1)
37=> syntaxTree.Options.Kind != SourceCodeKind.Regular;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (1)
246var info = GetInfo(context.Context, codeGenOptions, destinationDeclaration.SyntaxTree.Options);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions.cs (1)
445var condition = generatorInternal.SupportsPatterns(semanticModel.SyntaxTree.Options)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (1)
74factory, generatorInternal, semanticModel.Compilation, semanticModel.SyntaxTree.Options, containingType, symbols);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (5)
65var options = semanticModel.SyntaxTree.Options; 186else if (operation is IIsTypeOperation { TypeOperand.SpecialType: SpecialType.System_Object } && generatorInternal.SupportsPatterns(semanticModel.SyntaxTree.Options)) 191else if (syntaxFacts.IsIsTypeExpression(expressionNode) && syntaxFacts.SupportsNotPattern(semanticModel.SyntaxTree.Options)) 270if (syntaxFacts.SupportsNotPattern(semanticModel.SyntaxTree.Options)) 559if (syntaxFacts.SupportsNotPattern(pattern.SyntaxTree.Options) &&
Workspace\Solution\DocumentState_LinkedFileReuse.cs (1)
193var siblingParseOptions = siblingTree.Options;
Workspace\Solution\SolutionCompilationState.RegularCompilationTracker_Generators.cs (1)
338generatedSource.SyntaxTree.Options,
Microsoft.CodeAnalysis.Workspaces.UnitTests (10)
SolutionTests\SolutionTests.cs (9)
3250Assert.Same(tree, tree.WithRootAndOptions(root, tree.Options)); 3784Assert.Same(tree.Options, tree2.Options); 3807var tree3 = tree.WithRootAndOptions(newRoot, tree.Options); 3812Assert.Same(tree.Options, tree3.Options); 3817var newOptions = tree.Options.WithKind(SourceCodeKind.Script); 3823Assert.Same(newOptions, tree4.Options); 3829Assert.Same(tree, tree.WithRootAndOptions(tree.GetRoot(), tree.Options));
SolutionTests\SolutionWithSourceGeneratorTests.cs (1)
515Assert.Equal(DocumentationMode.Diagnose, generatedTreeAfterChange!.Options.DocumentationMode);
Microsoft.Interop.LibraryImportGenerator (1)
Analyzers\ConvertToLibraryImportFixer.cs (1)
631if (((CSharpParseOptions)syntaxTree.Options).LanguageVersion < LanguageVersion.CSharp12)
Microsoft.VisualStudio.LanguageServices (1)
Venus\ContainedLanguageCodeSupport.cs (1)
222var info = codeGenerationService.GetInfo(new CodeGenerationContext(autoInsertionLocation: false), options.GenerationOptions, destinationType.SyntaxTree.Options);