327 references to Options
Microsoft.CodeAnalysis (5)
Compilation\Compilation.cs (3)
96var treeFeatures = tree.Options.Features; 1049Debug.Assert(tree.Options.Kind != SourceCodeKind.Script); 2543return tree.Options.DocumentationMode != DocumentationMode.None;
Compilation\DeterministicKey.cs (1)
41=> _tree.Options;
Syntax\SyntaxNodeExtensions.cs (1)
436return node != null ? oldTree.WithRootAndOptions(node, oldTree.Options).GetRoot() : null;
Microsoft.CodeAnalysis.CodeStyle (6)
AbstractUseCoalesceExpressionForIfNullCheckDiagnosticAnalyzer.cs (1)
86if (!syntaxFacts.SupportsThrowExpression(ifStatement.SyntaxTree.Options))
AbstractUseCompoundAssignmentDiagnosticAnalyzer.cs (1)
102if (!IsSupported(binaryKind, syntaxTree.Options))
AnalyzerOptionsProvider.cs (1)
130=> new(analyzerOptions.AnalyzerConfigOptionsProvider.GetOptions(syntaxTree).GetOptionsReader(), syntaxTree.Options.Language, analyzerOptions);
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs\SyntaxTreeExtensions.cs (1)
37=> syntaxTree.Options.Kind != SourceCodeKind.Regular;
UseCollectionInitializerAnalyzer.cs (1)
145if (!_syntaxFacts.SupportsIndexingInitializer(statement.SyntaxTree.Options))
UseConditionalExpressionHelpers.cs (1)
93if (!syntaxFacts.SupportsThrowExpression(anyThrow.Syntax.SyntaxTree.Options))
Microsoft.CodeAnalysis.CodeStyle.Fixes (8)
AbstractCodeGenerationService.cs (1)
251var info = GetInfo(context.Context, codeGenOptions, destinationDeclaration.SyntaxTree.Options);
AbstractUseIsNullForReferenceEqualsCodeFixProvider.cs (1)
41var title = GetTitle(negated, diagnostic.Location.SourceTree!.Options);
FormattingCodeFixHelper.cs (1)
30return syntaxTree.WithRootAndOptions(formattedRoot, syntaxTree.Options);
SyntaxGeneratorExtensions_Negate.cs (5)
64var options = semanticModel.SyntaxTree.Options; 156generatorInternal.SupportsPatterns(semanticModel.SyntaxTree.Options)) 162if (syntaxFacts.SupportsNotPattern(semanticModel.SyntaxTree.Options)) 242if (syntaxFacts.SupportsNotPattern(semanticModel.SyntaxTree.Options)) 531if (syntaxFacts.SupportsNotPattern(pattern.SyntaxTree.Options) &&
Microsoft.CodeAnalysis.CSharp (43)
Binder\Binder_Initializers.cs (1)
195Debug.Assert(syntaxTree.Options.Kind != SourceCodeKind.Regular);
Binder\Binder_Operators.cs (2)
3184((CSharpParseOptions)node.SyntaxTree.Options).IsFeatureEnabled(MessageID.IDS_FeaturePatternMatching)) 3231if (wasUnderscore && ((CSharpParseOptions)node.SyntaxTree.Options).IsFeatureEnabled(MessageID.IDS_FeatureRecursivePatterns))
Binder\Binder_Patterns.cs (1)
897Debug.Assert(designation.SyntaxTree.Options.Kind != SourceCodeKind.Regular);
Binder\Binder_Statements.cs (1)
1298bool extensibleFixedEnabled = ((CSharpParseOptions)initializerOpt.SyntaxTree.Options)?.IsFeatureEnabled(MessageID.IDS_FeatureExtensibleFixedStatement) != false;
Binder\Binder_Symbols.cs (1)
2712if (feature.GetFeatureAvailabilityDiagnosticInfo((CSharpParseOptions)tree.Options) is { } diagInfo)
Binder\BinderFactory.BinderFactoryVisitor.cs (1)
424if (node.Parent.Kind() == SyntaxKind.CompilationUnit && syntaxTree.Options.Kind != SourceCodeKind.Regular)
Binder\BinderFactory.cs (1)
92return _syntaxTree.Options.Kind == SourceCodeKind.Script;
Binder\SwitchBinder.cs (1)
35((CSharpParseOptions)SwitchSyntax.SyntaxTree.Options)?.IsFeatureEnabled(MessageID.IDS_FeaturePatternMatching) != false;
Compilation\CSharpCompilation.cs (5)
522var version = ((CSharpParseOptions)tree.Options).LanguageVersion; 2706if (!syntaxTree.Options.Errors.IsDefaultOrEmpty && parseOptionsReported.Add(syntaxTree.Options)) 2709foreach (var error in syntaxTree.Options.Errors) 4382bool value = SyntaxTrees.FirstOrDefault()?.Options?.Features?.ContainsKey("nullablePublicOnly") == true;
Compilation\CSharpCompilationExtensions.cs (1)
19return ((CSharpParseOptions?)syntax?.SyntaxTree.Options)?.IsFeatureEnabled(feature) == true;
Compilation\SyntaxAndDeclarationManager.cs (3)
155var sourceCodeKind = tree.Options.Kind; 222tree.Options, // Use ParseOptions propagated from "external" tree. 588var sourceCodeKind = tree.Options.Kind;
Compilation\SyntaxTreeSemanticModel.cs (2)
1305return this.SyntaxTree.Options.Kind == SourceCodeKind.Regular; 2305if (this.SyntaxTree.Options.Kind != SourceCodeKind.Regular)
Compiler\DocumentationCommentCompiler.cs (1)
690DocumentationMode 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)
55(node.Kind() == SyntaxKind.CompilationUnit && _syntaxTree.Options.Kind == SourceCodeKind.Regular)); 65bool acceptSimpleProgram = node.Kind() == SyntaxKind.CompilationUnit && _syntaxTree.Options.Kind == SourceCodeKind.Regular; 182Debug.Assert(_syntaxTree.Options.Kind != SourceCodeKind.Regular); 242Debug.Assert(parent.Kind() == SyntaxKind.CompilationUnit && _syntaxTree.Options.Kind != SourceCodeKind.Regular); 308if (_syntaxTree.Options.Kind != SourceCodeKind.Regular)
DocumentationComments\SourceDocumentationCommentUtils.cs (1)
35if (syntaxNode.SyntaxTree.Options.DocumentationMode < DocumentationMode.Parse)
Errors\MessageID.cs (2)
323var diag = GetFeatureAvailabilityDiagnosticInfo(feature, (CSharpParseOptions)syntax.SyntaxTree.Options); 338var diag = GetFeatureAvailabilityDiagnosticInfo(feature, (CSharpParseOptions)syntax.SyntaxTree.Options);
Symbols\Source\LocalFunctionSymbol.cs (1)
363var diagnosticInfo = MessageID.IDS_FeatureLocalFunctionAttributes.GetFeatureAvailabilityDiagnosticInfo((CSharpParseOptions)syntaxReferenceOpt.SyntaxTree.Options);
Symbols\Source\ModifierUtils.cs (3)
123if (MessageID.IDS_FeatureRefFields.GetFeatureAvailabilityDiagnosticInfo((CSharpParseOptions)syntax.SyntaxTree.Options) is { } diagnosticInfo) 154LanguageVersion availableVersion = ((CSharpParseOptions)errorLocation.SourceTree.Options).LanguageVersion; 218LanguageVersion availableVersion = ((CSharpParseOptions)location.SourceTree.Options).LanguageVersion;
Symbols\Source\SourceMemberContainerSymbol.cs (1)
4194var languageVersion = ((CSharpParseOptions)this.Locations[0].SourceTree!.Options).LanguageVersion;
Symbols\Source\SourceModuleSymbol.cs (1)
551var options = (CSharpParseOptions?)compilation.SyntaxTrees.FirstOrDefault()?.Options;
Symbols\Source\SourcePropertyAccessorSymbol.cs (1)
465var options = (CSharpParseOptions)SyntaxTree.Options;
Symbols\Source\SourceUserDefinedOperatorSymbolBase.cs (1)
166LanguageVersion availableVersion = ((CSharpParseOptions)location.SourceTree.Options).LanguageVersion;
Symbols\Symbol_Attributes.cs (1)
675var parseOptions = (CSharpParseOptions)targetOpt.SyntaxTree.Options;
Syntax\SyntaxExtensions.cs (1)
179return tree.Options.DocumentationMode >= DocumentationMode.Diagnose;
Syntax\SyntaxFactory.cs (2)
2309if (tree.Options.Kind != SourceCodeKind.Script) 2367if (tree.Options.Kind == SourceCodeKind.Regular ||
Syntax\SyntaxFacts.cs (1)
525return IsTopLevelStatement(syntax) && syntax.SyntaxTree.Options.Kind == SourceCodeKind.Regular;
Microsoft.CodeAnalysis.CSharp.CodeStyle (14)
ConvertNamespaceAnalysis.cs (1)
42=> CanOfferUseFileScoped(option, root, declaration, forAnalyzer, root.SyntaxTree.Options.LanguageVersion());
ConvertSwitchStatementToExpressionDiagnosticAnalyzer.Analyzer.cs (1)
36var analyzer = new Analyzer(supportsOrPatterns: semanticModel.SyntaxTree.Options.LanguageVersion() >= LanguageVersion.CSharp9);
CSharpAsAndNullCheckDiagnosticAnalyzer.cs (1)
59if (syntaxTree.Options.LanguageVersion() < LanguageVersion.CSharp7)
CSharpInlineDeclarationDiagnosticAnalyzer.cs (1)
63var csOptions = (CSharpParseOptions)syntaxTree.Options;
CSharpRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs (1)
27=> tree.Options.LanguageVersion() >= LanguageVersion.CSharp7;
CSharpUseDefaultLiteralDiagnosticAnalyzer.cs (1)
40var parseOptions = (CSharpParseOptions)syntaxTree.Options;
CSharpUseImplicitObjectCreationDiagnosticAnalyzer.cs (1)
42if (syntaxTree.Options.LanguageVersion() < LanguageVersion.CSharp9)
CSharpUseImplicitTypeHelper.cs (1)
201var newTree = tree.WithRootAndOptions(newRoot, tree.Options);
CSharpUseInferredMemberNameDiagnosticAnalyzer.cs (1)
45var parseOptions = (CSharpParseOptions)syntaxTree.Options;
CSharpUsePatternCombinatorsDiagnosticAnalyzer.cs (1)
64if (syntaxTree.Options.LanguageVersion() < LanguageVersion.CSharp9)
InvokeDelegateWithConditionalAccessAnalyzer.cs (1)
53if (ifStatement.SyntaxTree.Options.LanguageVersion() < LanguageVersion.CSharp6)
SyntaxNodeExtensions.cs (1)
25=> ((CSharpParseOptions)node.SyntaxTree.Options).LanguageVersion;
UseExpressionBodyForLambdaHelpers.cs (1)
54var languageVersion = declaration.SyntaxTree.Options.LanguageVersion();
UseExpressionBodyHelper`1.cs (1)
138var languageVersion = body.SyntaxTree.Options.LanguageVersion();
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (12)
CSharpAsAndNullCheckCodeFixProvider.cs (1)
50var languageVersion = tree.Options.LanguageVersion();
CSharpCodeGenerationHelpers.cs (1)
81var tree = node.SyntaxTree.WithRootAndOptions(node, syntaxTree.Options);
CSharpRemoveUnusedValuesCodeFixProvider.cs (1)
99&& parent.SyntaxTree.Options.LanguageVersion() >= LanguageVersion.CSharp9)
CSharpSyntaxContext.cs (1)
405=> IsGlobalStatementContext && SyntaxTree.Options.Kind is SourceCodeKind.Regular;
CSharpUseDefaultLiteralCodeFixProvider.cs (1)
55var parseOptions = (CSharpParseOptions)originalRoot.SyntaxTree.Options;
CSharpUseIsNullCheckForCastAndEqualityOperatorCodeFixProvider.cs (2)
47var title = GetTitle(negated, diagnostic.Location.SourceTree!.Options); 82if (SupportsIsNotPattern(binary.SyntaxTree.Options))
CSharpUseIsNullCheckForReferenceEqualsCodeFixProvider.cs (1)
46if (SupportsIsNotPattern(argument.SyntaxTree.Options))
CSharpUseLocalFunctionCodeFixProvider.cs (2)
89var languageVersion = semanticModel.SyntaxTree.Options.LanguageVersion(); 96CodeGenerationContext.Default, CSharpCodeGenerationOptions.Default, new CSharpCodeGenerationService(document.Project.Services), root.SyntaxTree.Options.LanguageVersion());
MakeLocalFunctionStaticCodeFixHelper.cs (1)
172CodeGenerationContext.Default, CSharpCodeGenerationOptions.Default, new CSharpCodeGenerationService(document.Project.Services), root.SyntaxTree.Options.LanguageVersion());
PassInCapturedVariablesAsArgumentsCodeFixProvider.cs (1)
76if (!MakeLocalFunctionStaticHelper.IsStaticLocalFunctionSupported(root.SyntaxTree.Options.LanguageVersion()))
Microsoft.CodeAnalysis.CSharp.EditorFeatures (6)
AutomaticCompletion\AutomaticLineEnderCommandHandler.cs (5)
185BaseFieldDeclarationSyntax => SyntaxFactory.ParseCompilationUnit(WrapInType(textToParse), options: (CSharpParseOptions)tree.Options), 186BaseMethodDeclarationSyntax => SyntaxFactory.ParseCompilationUnit(WrapInType(textToParse), options: (CSharpParseOptions)tree.Options), 187BasePropertyDeclarationSyntax => SyntaxFactory.ParseCompilationUnit(WrapInType(textToParse), options: (CSharpParseOptions)tree.Options), 188StatementSyntax => SyntaxFactory.ParseStatement(textToParse, options: (CSharpParseOptions)tree.Options), 189UsingDirectiveSyntax => SyntaxFactory.ParseCompilationUnit(textToParse, options: (CSharpParseOptions)tree.Options),
EventHookup\EventHookupCommandHandler_TabKeyCommand.cs (1)
248var codeGenOptions = codeGenerator.GetInfo(new CodeGenerationContext(afterThisLocation: eventHookupExpression.GetLocation()), options, root.SyntaxTree.Options);
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (5)
Emit\EditAndContinue\EditAndContinueStateMachineTests.cs (2)
3307var asyncStreamsTree = Parse(AsyncStreamsTypes, options: (CSharpParseOptions)source0.Tree.Options); 5815var asyncStreamsTree = Parse(AsyncStreamsTypes, options: (CSharpParseOptions)source0.Tree.Options);
Emit\EditAndContinue\EditAndContinueTestBase.cs (1)
325var previousParseOptions = (CSharpParseOptions)compilation.SyntaxTrees.FirstOrDefault()?.Options;
Emit\EditAndContinue\LocalSlotMappingTests.cs (2)
751var asyncStreamsTree = Parse(AsyncStreamsTypes, options: (CSharpParseOptions)source0.Tree.Options); 844var asyncStreamsTree = Parse(AsyncStreamsTypes, options: (CSharpParseOptions)source0.Tree.Options);
Microsoft.CodeAnalysis.CSharp.Features (33)
CodeRefactorings\ConvertLocalFunctionToMethod\CSharpConvertLocalFunctionToMethodCodeRefactoringProvider.cs (1)
149var supportsNonTrailing = SupportsNonTrailingNamedArguments(root.SyntaxTree.Options);
CodeRefactorings\UseRecursivePatterns\UseRecursivePatternsCodeRefactoringProvider.cs (2)
57if (root.SyntaxTree.Options.LanguageVersion() < LanguageVersion.CSharp9) 366if (names.Length > 1 && names[0].SyntaxTree.Options.LanguageVersion() >= LanguageVersion.CSharp10)
ConvertNamespaceAnalysis.cs (1)
42=> CanOfferUseFileScoped(option, root, declaration, forAnalyzer, root.SyntaxTree.Options.LanguageVersion());
ConvertSwitchStatementToExpressionDiagnosticAnalyzer.Analyzer.cs (1)
36var analyzer = new Analyzer(supportsOrPatterns: semanticModel.SyntaxTree.Options.LanguageVersion() >= LanguageVersion.CSharp9);
CSharpAsAndNullCheckCodeFixProvider.cs (1)
50var languageVersion = tree.Options.LanguageVersion();
CSharpAsAndNullCheckDiagnosticAnalyzer.cs (1)
59if (syntaxTree.Options.LanguageVersion() < LanguageVersion.CSharp7)
CSharpInlineDeclarationDiagnosticAnalyzer.cs (1)
63var csOptions = (CSharpParseOptions)syntaxTree.Options;
CSharpRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs (1)
27=> tree.Options.LanguageVersion() >= LanguageVersion.CSharp7;
CSharpRemoveUnusedValuesCodeFixProvider.cs (1)
99&& parent.SyntaxTree.Options.LanguageVersion() >= LanguageVersion.CSharp9)
CSharpUseDefaultLiteralCodeFixProvider.cs (1)
55var parseOptions = (CSharpParseOptions)originalRoot.SyntaxTree.Options;
CSharpUseDefaultLiteralDiagnosticAnalyzer.cs (1)
40var parseOptions = (CSharpParseOptions)syntaxTree.Options;
CSharpUseImplicitObjectCreationDiagnosticAnalyzer.cs (1)
42if (syntaxTree.Options.LanguageVersion() < LanguageVersion.CSharp9)
CSharpUseInferredMemberNameDiagnosticAnalyzer.cs (1)
45var parseOptions = (CSharpParseOptions)syntaxTree.Options;
CSharpUseIsNullCheckForCastAndEqualityOperatorCodeFixProvider.cs (2)
47var title = GetTitle(negated, diagnostic.Location.SourceTree!.Options); 82if (SupportsIsNotPattern(binary.SyntaxTree.Options))
CSharpUseIsNullCheckForReferenceEqualsCodeFixProvider.cs (1)
46if (SupportsIsNotPattern(argument.SyntaxTree.Options))
CSharpUseLocalFunctionCodeFixProvider.cs (1)
89var languageVersion = semanticModel.SyntaxTree.Options.LanguageVersion();
CSharpUsePatternCombinatorsDiagnosticAnalyzer.cs (1)
64if (syntaxTree.Options.LanguageVersion() < LanguageVersion.CSharp9)
Diagnostics\Analyzers\CSharpPreferFrameworkTypeDiagnosticAnalyzer.cs (1)
34semanticModel.SyntaxTree.Options.LanguageVersion() >= LanguageVersion.CSharp9 &&
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs (2)
178=> node.SyntaxTree.Options.LanguageVersion() < LanguageVersion.CSharp8; 231var languageVersion = SemanticDocument.SyntaxTree.Options.LanguageVersion();
ExtractMethod\CSharpSelectionValidator.cs (1)
54selectionInfo = ApplySpecialCases(selectionInfo, text, SemanticDocument.SyntaxTree.Options, _localFunction);
InvokeDelegateWithConditionalAccessAnalyzer.cs (1)
53if (ifStatement.SyntaxTree.Options.LanguageVersion() < LanguageVersion.CSharp6)
MakeLocalFunctionStatic\MakeLocalFunctionStaticCodeRefactoringProvider.cs (1)
30if (!MakeLocalFunctionStaticHelper.IsStaticLocalFunctionSupported(syntaxTree.Options.LanguageVersion()))
MetadataAsSource\CSharpMetadataAsSourceService.cs (1)
103var options = (CSharpParseOptions)tree.Options;
PassInCapturedVariablesAsArgumentsCodeFixProvider.cs (1)
76if (!MakeLocalFunctionStaticHelper.IsStaticLocalFunctionSupported(root.SyntaxTree.Options.LanguageVersion()))
QuickInfo\CSharpSemanticQuickInfoProvider.cs (1)
81var parseOptions = (CSharpParseOptions)semanticModel.SyntaxTree!.Options;
ReplacePropertyWithMethods\CSharpReplacePropertyWithMethodsService.cs (1)
51var languageVersion = syntaxTree.Options.LanguageVersion();
UseExpressionBodyForLambdaHelpers.cs (1)
54var languageVersion = declaration.SyntaxTree.Options.LanguageVersion();
UseExpressionBodyHelper`1.cs (1)
138var languageVersion = body.SyntaxTree.Options.LanguageVersion();
UsePatternMatching\CSharpIsAndCastCheckWithoutNameDiagnosticAnalyzer.cs (2)
74if (syntaxTree.Options.LanguageVersion() < LanguageVersion.CSharp7) 218changedRoot, semanticModel.SyntaxTree.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)
429get { 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)
2531var fullTree = SyntaxFactory.ParseSyntaxTree(newIText.ToString(), options: newTree.Options); 2545fullTree = SyntaxFactory.ParseSyntaxTree(newIText.ToString(), options: newTree.Options); 2685var 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)
1334var options = (CSharpParseOptions)trees[0].Options;
Microsoft.CodeAnalysis.CSharp.Workspaces (7)
CSharpCodeGenerationHelpers.cs (1)
81var tree = node.SyntaxTree.WithRootAndOptions(node, syntaxTree.Options);
CSharpSyntaxContext.cs (1)
405=> IsGlobalStatementContext && SyntaxTree.Options.Kind is SourceCodeKind.Regular;
CSharpUseImplicitTypeHelper.cs (1)
201var newTree = tree.WithRootAndOptions(newRoot, tree.Options);
Extensions\SyntaxNodeExtensions.cs (1)
17=> ((CSharpParseOptions)node.SyntaxTree.Options).LanguageVersion;
FindSymbols\CSharpDeclaredSymbolInfoFactoryService.cs (1)
631if (((CSharpParseOptions)container.SyntaxTree.Options).Kind == SourceCodeKind.Script)
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs\SyntaxNodeExtensions.cs (1)
25=> ((CSharpParseOptions)node.SyntaxTree.Options).LanguageVersion;
Simplification\Simplifiers\AbstractCSharpSimplifier.cs (1)
66semanticModel.SyntaxTree.Options.LanguageVersion() >= LanguageVersion.CSharp9 &&
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (6)
CodeGeneration\CodeGenerationTests.cs (6)
97var info = testContext.Service.GetInfo(context ?? CodeGenerationContext.Default, options, root.SyntaxTree.Options); 323var info = testContext.Service.GetInfo(context ?? CodeGenerationContext.Default, options, oldSyntax.SyntaxTree.Options); 338var info = testContext.Service.GetInfo(context ?? CodeGenerationContext.Default, options, oldMemberSyntax.SyntaxTree.Options); 553var info = codeGenerator.GetInfo(CodeGenerationContext.Default, options, oldNode.SyntaxTree.Options); 572var info = codeGenerator.GetInfo(CodeGenerationContext.Default, options, testContext.SemanticModel.SyntaxTree.Options); 594var info = codeGenerator.GetInfo(new CodeGenerationContext(reuseSyntax: true), options, declarationNode.SyntaxTree.Options);
Microsoft.CodeAnalysis.Features (27)
AbstractUseCoalesceExpressionForIfNullCheckDiagnosticAnalyzer.cs (1)
86if (!syntaxFacts.SupportsThrowExpression(ifStatement.SyntaxTree.Options))
AbstractUseCompoundAssignmentDiagnosticAnalyzer.cs (1)
102if (!IsSupported(binaryKind, syntaxTree.Options))
AbstractUseIsNullForReferenceEqualsCodeFixProvider.cs (1)
41var title = GetTitle(negated, diagnostic.Location.SourceTree!.Options);
AnalyzerOptionsProvider.cs (1)
130=> new(analyzerOptions.AnalyzerConfigOptionsProvider.GetOptions(syntaxTree).GetOptionsReader(), syntaxTree.Options.Language, analyzerOptions);
CodeFixes\Configuration\ConfigureCodeStyle\ConfigureCodeStyleOptionCodeFixProvider.cs (1)
50var language = diagnostic.Location.SourceTree.Options.Language;
CodeRefactorings\ExtractMethod\AbstractExtractMethodCodeRefactoringProvider.cs (1)
112if (!syntaxFacts.SupportsLocalFunctionDeclaration(syntaxTree.Options))
Completion\Providers\AbstractPreprocessorCompletionProvider.cs (1)
38preprocessorNames.AddRange(currentSyntaxTree.Options.PreprocessorSymbolNames);
ConvertAnonymousType\AbstractConvertAnonymousTypeToClassCodeRefactoringProvider.cs (1)
63if (syntaxFacts.SupportsRecord(anonymousObject.SyntaxTree.Options))
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.cs (1)
95analyzer = CreateAnalyzer(syntaxFactsService, ifStatement.SyntaxTree.Options);
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.Rewriting.cs (1)
40var options = root.SyntaxTree.Options;
ConvertTupleToStruct\AbstractConvertTupleToStructCodeRefactoringProvider.cs (1)
92if (syntaxFacts.SupportsRecordStruct(syntaxTree.Options))
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (2)
548Debug.Assert(oldTree == null || oldTree.Options.Equals(newTree.Options));
ExtractMethod\Extensions.cs (1)
101return node.SyntaxTree.Options.Kind != SourceCodeKind.Regular;
FormattingCodeFixHelper.cs (1)
30return syntaxTree.WithRootAndOptions(formattedRoot, syntaxTree.Options);
GenerateEqualsAndGetHashCodeFromMembers\AbstractGenerateEqualsAndGetHashCodeService.cs (2)
49generatorInternal, compilation, tree.Options, namedType, members, localNameOpt, s_specializedFormattingAnnotation); 74if (generator.SyntaxGeneratorInternal.SupportsPatterns(tree.Options))
ImplementInterface\AbstractImplementInterfaceService.CodeAction.cs (1)
200compilation, tree.Options, unimplementedMembers, Options.ImplementTypeOptions.PropertyGenerationBehavior);
InitializeParameter\AbstractAddParameterCheckCodeRefactoringProvider.cs (1)
492if (!syntaxFacts.SupportsThrowExpression(syntaxTree.Options))
InitializeParameter\AbstractInitializeMemberFromParameterCodeRefactoringProviderMemberCreation.cs (2)
484codeGenerator.GetInfo(GetAddContext<IPropertySymbol>(parameter, blockStatement, typeDeclaration, cancellationToken), options, root.SyntaxTree.Options), 491codeGenerator.GetInfo(GetAddContext<IFieldSymbol>(parameter, blockStatement, typeDeclaration, cancellationToken), options, root.SyntaxTree.Options),
IntroduceUsingStatement\AbstractIntroduceUsingStatementCodeRefactoringProvider.cs (1)
155this.TryCreateUsingLocalDeclaration(root.SyntaxTree.Options, declarationStatement, out var usingDeclarationStatement))
IntroduceVariable\AbstractIntroduceLocalForExpressionCodeRefactoringProvider.cs (1)
52if (type.IsTupleType && syntaxFacts.SupportsTupleDeconstruction(expression.SyntaxTree.Options))
J\s\src\Analyzers\Core\Analyzers\UseConditionalExpression\UseConditionalExpressionHelpers.cs\UseConditionalExpressionHelpers.cs (1)
93if (!syntaxFacts.SupportsThrowExpression(anyThrow.Syntax.SyntaxTree.Options))
ReplaceMethodWithProperty\ReplaceMethodWithPropertyCodeRefactoringProvider.cs (1)
372var parseOptions = syntaxTree.Options;
UseCollectionInitializerAnalyzer.cs (1)
145if (!_syntaxFacts.SupportsIndexingInitializer(statement.SyntaxTree.Options))
UseNamedArguments\AbstractUseNamedArgumentsCodeRefactoringProvider.cs (1)
110if (SupportsNonTrailingNamedArguments(root.SyntaxTree.Options) &&
Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.UnitTests (2)
CompilerInvocationTests.vb (2)
30Assert.Equal("DEBUG", Assert.Single(syntaxTree.Options.PreprocessorSymbolNames)) 57Assert.Contains("DEBUG", syntaxTree.Options.PreprocessorSymbolNames)
Microsoft.CodeAnalysis.Test.Utilities (1)
Compilation\CompilationExtensions.cs (1)
362if (blockOperation.Syntax.SyntaxTree.Options.Kind != SourceCodeKind.Script)
Microsoft.CodeAnalysis.VisualBasic (15)
Binding\Binder_Attributes.vb (1)
492DirectCast(identifierName.SyntaxTree.Options, VisualBasicParseOptions).LanguageVersion,
Binding\Binder_Expressions.vb (1)
2100DirectCast(node.SyntaxTree.Options, VisualBasicParseOptions).LanguageVersion,
Binding\Binder_Invocation.vb (1)
2910DirectCast(argument.Syntax.SyntaxTree.Options, VisualBasicParseOptions).LanguageVersion,
Binding\Binder_Statements.vb (1)
1937DirectCast(node.SyntaxTree.Options, VisualBasicParseOptions).LanguageVersion,
Binding\BinderFactory.vb (2)
37Return _tree.Options.Kind = SourceCodeKind.Script 156If node.Kind <> SyntaxKind.CompilationUnit OrElse _tree.Options.Kind = SourceCodeKind.Regular Then
Compilation\DocumentationComments\DocumentationCommentCompiler.NamedType.vb (1)
58Dim documentationMode As DocumentationMode = trivia.SyntaxTree.Options.DocumentationMode
Compilation\VisualBasicCompilation.vb (4)
490Dim version = CType(tree.Options, VisualBasicParseOptions).LanguageVersion 2167If Not tree.Options.Errors.IsDefaultOrEmpty AndAlso parseOptionsReported.Add(tree.Options) Then 2169For 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
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)
VisualBasicUnnecessaryImportsProvider.vb (1)
76Dim updatedSyntaxTree = model.SyntaxTree.WithRootAndOptions(updatedRoot, model.SyntaxTree.Options)
VisualBasicUseInferredMemberNameDiagnosticAnalyzer.vb (1)
47If Not preference.Value OrElse Not CanSimplifyTupleName(argument, DirectCast(syntaxTree.Options, VisualBasicParseOptions)) Then
VisualBasicUseIsNotDiagnosticAnalyzer.vb (1)
48If DirectCast(syntaxTree.Options, VisualBasicParseOptions).LanguageVersion < LanguageVersion.VisualBasic14 Then
Microsoft.CodeAnalysis.VisualBasic.Features (2)
VisualBasicUseInferredMemberNameDiagnosticAnalyzer.vb (1)
47If Not preference.Value OrElse Not CanSimplifyTupleName(argument, DirectCast(syntaxTree.Options, VisualBasicParseOptions)) Then
VisualBasicUseIsNotDiagnosticAnalyzer.vb (1)
48If DirectCast(syntaxTree.Options, VisualBasicParseOptions).LanguageVersion < LanguageVersion.VisualBasic14 Then
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (44)
IncrementalParser\IncrementalParser.vb (1)
1717Dim oldTree2 = VisualBasicSyntaxTree.Create(DirectCast(oldRoot2, VisualBasicSyntaxNode), DirectCast(tempTree2.Options, VisualBasicParseOptions), tempTree2.FilePath, Encoding.UTF8)
Syntax\SyntaxRewriterTests.vb (40)
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) 576Assert.Equal(SourceCodeKind.Script, newTree.Options.Kind) 577Assert.Equal(tree.Options, newTree.Options) 583Assert.Equal(SourceCodeKind.Script, newTree2.Options.Kind) 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) 648Assert.Equal(SourceCodeKind.Script, newTree.Options.Kind) 649Assert.Equal(tree.Options, newTree.Options) 654Assert.Equal(SourceCodeKind.Script, newTree2.Options.Kind) 655Assert.Equal(tree.Options, newTree2.Options) 676Assert.Equal(SourceCodeKind.Script, newTree.Options.Kind) 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)
VisualBasicUnnecessaryImportsProvider.vb (1)
76Dim updatedSyntaxTree = model.SyntaxTree.WithRootAndOptions(updatedRoot, model.SyntaxTree.Options)
Microsoft.CodeAnalysis.Workspaces (11)
AbstractCodeGenerationService.cs (1)
251var info = GetInfo(context.Context, codeGenOptions, destinationDeclaration.SyntaxTree.Options);
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs\SyntaxTreeExtensions.cs (1)
37=> syntaxTree.Options.Kind != SourceCodeKind.Regular;
Shared\Extensions\SyntaxGeneratorExtensions.cs (1)
206var condition = factory.SyntaxGeneratorInternal.SupportsPatterns(semanticModel.SyntaxTree.Options)
Shared\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (1)
66factory, generatorInternal, semanticModel.Compilation, semanticModel.SyntaxTree.Options, containingType, symbols);
SyntaxGeneratorExtensions_Negate.cs (5)
64var options = semanticModel.SyntaxTree.Options; 156generatorInternal.SupportsPatterns(semanticModel.SyntaxTree.Options)) 162if (syntaxFacts.SupportsNotPattern(semanticModel.SyntaxTree.Options)) 242if (syntaxFacts.SupportsNotPattern(semanticModel.SyntaxTree.Options)) 531if (syntaxFacts.SupportsNotPattern(pattern.SyntaxTree.Options) &&
Workspace\Solution\DocumentState_LinkedFileReuse.cs (1)
135var siblingParseOptions = siblingTree.Options;
Workspace\Solution\SolutionState.CompilationTracker.cs (1)
918generatedSource.SyntaxTree.Options,
Microsoft.CodeAnalysis.Workspaces.UnitTests (20)
SolutionTests\SolutionTests.cs (19)
594Assert.Equal(parseOptions1, root1.SyntaxTree.Options); 595Assert.Equal(parseOptions2, root2.SyntaxTree.Options); 621Assert.Equal(parseOptions1, root1.SyntaxTree.Options); 622Assert.Equal(parseOptions2, root2.SyntaxTree.Options); 645Assert.Equal(parseOptions1, root1.SyntaxTree.Options); 646Assert.Equal(parseOptions2, root2.SyntaxTree.Options); 1288Assert.Equal(document.Project.ParseOptions, oldTree.Options); 1294Assert.Equal(document.Project.ParseOptions, newTree.Options); 1327Assert.Equal(document.Project.ParseOptions, oldTree.Options); 1337Assert.Equal(document.Project.ParseOptions, newTree.Options); 2602Assert.Same(tree, tree.WithRootAndOptions(root, tree.Options)); 3146Assert.Same(tree.Options, tree2.Options); 3169var tree3 = tree.WithRootAndOptions(newRoot, tree.Options); 3174Assert.Same(tree.Options, tree3.Options); 3179var newOptions = tree.Options.WithKind(SourceCodeKind.Script); 3185Assert.Same(newOptions, tree4.Options); 3191Assert.Same(tree, tree.WithRootAndOptions(tree.GetRoot(), tree.Options));
SolutionTests\SolutionWithSourceGeneratorTests.cs (1)
496Assert.Equal(DocumentationMode.Diagnose, generatedTreeAfterChange!.Options.DocumentationMode);
Microsoft.VisualStudio.LanguageServices (1)
Venus\ContainedLanguageCodeSupport.cs (1)
224var info = codeGenerationService.GetInfo(new CodeGenerationContext(autoInsertionLocation: false), options.GenerationOptions, destinationType.SyntaxTree.Options);
Microsoft.VisualStudio.LanguageServices.Implementation (1)
CodeModel\AbstractCodeModelObject_CodeGen.cs (1)
34containerNode.SyntaxTree.Options);