44 instantiations of Optional
Microsoft.CodeAnalysis (2)
Operations\Operation.cs (1)
103return new Optional<object?>(OperationConstantValue.Value);
Optional.cs (1)
60return new Optional<T>(value);
Microsoft.CodeAnalysis.CodeStyle (14)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\EditorConfigValueSerializer.cs (14)
27parseValue: str => int.TryParse(str, out var result) ? result : new Optional<int>(), 39=> bool.TryParse(str, out var result) ? result : new Optional<bool>(); 48return new Optional<bool?>(null); 52return optionalBool.HasValue ? new Optional<bool?>(optionalBool.Value) : new Optional<bool?>(); 91=> new(parseValue: str => CodeStyleHelpers.TryParseBoolEditorConfigCodeStyleOption(str, defaultValue, out var result) ? result : new Optional<CodeStyleOption2<bool>>(), 95=> new(parseValue: str => CodeStyleHelpers.TryParseStringEditorConfigCodeStyleOption(str, defaultValue, out var result) ? result : new Optional<CodeStyleOption2<string>>(), 103parseValue: str => TryParseEnum<T>(str, out var result) ? new Optional<T>(result) : new Optional<T>(), 117=> new(parseValue: str => map.TryGetValue(str, out var result) || alternative.TryGetValue(str, out result) ? new Optional<T>(result) : new Optional<T>(), 143return new Optional<T?>(null); 148return new Optional<T?>(parsedValue); 151return new Optional<T?>();
Microsoft.CodeAnalysis.CSharp (1)
Compilation\MemberSemanticModel.cs (1)
1266: new Optional<object>(constantValue.Value);
Microsoft.CodeAnalysis.Features (1)
Completion\CompletionList.cs (1)
168=> With(itemsList: new(itemsList));
Microsoft.CodeAnalysis.Test.Utilities (1)
Diagnostics\OperationTestAnalyzer.cs (1)
280advanceIncrementOpt = new Optional<object>(1);
Microsoft.CodeAnalysis.Workspaces (19)
CodeRefactorings\FixAllOccurences\FixAllState.cs (1)
103return spansByDocument.Select(kvp => KeyValuePairUtil.Create(kvp.Key, new Optional<ImmutableArray<TextSpan>>(kvp.Value)))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\EditorConfigValueSerializer.cs (14)
27parseValue: str => int.TryParse(str, out var result) ? result : new Optional<int>(), 39=> bool.TryParse(str, out var result) ? result : new Optional<bool>(); 48return new Optional<bool?>(null); 52return optionalBool.HasValue ? new Optional<bool?>(optionalBool.Value) : new Optional<bool?>(); 91=> new(parseValue: str => CodeStyleHelpers.TryParseBoolEditorConfigCodeStyleOption(str, defaultValue, out var result) ? result : new Optional<CodeStyleOption2<bool>>(), 95=> new(parseValue: str => CodeStyleHelpers.TryParseStringEditorConfigCodeStyleOption(str, defaultValue, out var result) ? result : new Optional<CodeStyleOption2<string>>(), 103parseValue: str => TryParseEnum<T>(str, out var result) ? new Optional<T>(result) : new Optional<T>(), 117=> new(parseValue: str => map.TryGetValue(str, out var result) || alternative.TryGetValue(str, out result) ? new Optional<T>(result) : new Optional<T>(), 143return new Optional<T?>(null); 148return new Optional<T?>(parsedValue); 151return new Optional<T?>();
Storage\SQLite\v2\Interop\SqlConnection.cs (3)
298static (self, blobHandle) => new Optional<Stream>(self.ReadBlob(blobHandle))); 311return new Optional<Checksum>(); 317return new Optional<Checksum>(result);
Workspace\Solution\DocumentInfo.cs (1)
139=> With(documentServiceProvider: new(provider));
Microsoft.Interop.SourceGeneration (5)
StubEnvironment.cs (5)
30_lcidConversionAttrType = new Optional<INamedTypeSymbol?>(Compilation.GetTypeByMetadataName(TypeNames.LCIDConversionAttribute)); 44_suppressGCTransitionAttrType = new Optional<INamedTypeSymbol?>(Compilation.GetTypeByMetadataName(TypeNames.SuppressGCTransitionAttribute)); 58_unmanagedCallConvAttrType = new Optional<INamedTypeSymbol?>(Compilation.GetTypeByMetadataName(TypeNames.UnmanagedCallConvAttribute)); 72_defaultDllImportSearchPathsAttrType = new Optional<INamedTypeSymbol?>(Compilation.GetTypeByMetadataName(TypeNames.DefaultDllImportSearchPathsAttribute)); 86_wasmImportLinkageAttrType = new Optional<INamedTypeSymbol?>(Compilation.GetTypeByMetadataName(TypeNames.WasmImportLinkageAttribute));
Microsoft.VisualStudio.LanguageServices (1)
Options\VisualStudioSettingsOptionPersister.cs (1)
150return new Optional<object?>(codeStyle.FromXElement(XElement.Parse(value)));
413 references to Optional
ILLink.RoslynAnalyzer (1)
DataFlow\FeatureChecksVisitor.cs (1)
88 static bool? GetConstantBool (Optional<object?> constantValue)
Microsoft.AspNetCore.App.Analyzers (4)
Infrastructure\EmbeddedSyntax\EmbeddedSyntaxToken.cs (4)
46Optional<TSyntaxKind> kind = default, 47Optional<VirtualCharSequence> virtualChars = default, 48Optional<ImmutableArray<EmbeddedDiagnostic>> diagnostics = default, 49Optional<object> value = default)
Microsoft.AspNetCore.Mvc.Api.Analyzers (1)
ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzer.cs (1)
169var constantValue = ((ILiteralOperation)operation).ConstantValue;
Microsoft.CodeAnalysis (27)
Compilation\SemanticModel.cs (2)
745public Optional<object?> GetConstantValue(SyntaxNode node, CancellationToken cancellationToken = default(CancellationToken)) 755protected abstract Optional<object?> GetConstantValueCore(SyntaxNode node, CancellationToken cancellationToken = default(CancellationToken));
DiagnosticAnalyzer\AnalyzerDriver.cs (1)
1597var optionalEvent = await CompilationEventQueue.TryDequeueAsync(cancellationToken).ConfigureAwait(false);
DiagnosticAnalyzer\AsyncQueue.cs (13)
29private Queue<TaskCompletionSource<Optional<TElement>>> _waiters; 84TaskCompletionSource<Optional<TElement>> waiter; 174Queue<TaskCompletionSource<Optional<TElement>>> existingWaiters; 237var result = optionalResult.Result; 245static async Task<TElement> dequeueSlowAsync(ValueTask<Optional<TElement>> optionalResult) 247var result = await optionalResult.ConfigureAwait(false); 259/// <see cref="Optional{T}.HasValue"/> will be <see langword="false"/>. 262public ValueTask<Optional<TElement>> TryDequeueAsync(CancellationToken cancellationToken) 270return ValueTaskFactory.FromResult<Optional<TElement>>(_data.Dequeue()); 275return ValueTaskFactory.FromResult(default(Optional<TElement>)); 278_waiters ??= new Queue<TaskCompletionSource<Optional<TElement>>>(); 281var waiter = new TaskCompletionSource<Optional<TElement>>(TaskCreationOptions.RunContinuationsAsynchronously); 284return new ValueTask<Optional<TElement>>(waiter.Task);
Operations\IOperation.cs (4)
43/// If the operation is an expression that evaluates to a constant value, <see cref="Optional{Object}.HasValue"/> is true and <see cref="Optional{Object}.Value"/> is the value of the expression. Otherwise, <see cref="Optional{Object}.HasValue"/> is false. 45Optional<object?> ConstantValue { get; }
Operations\Operation.cs (5)
92/// If the operation is an expression that evaluates to a constant value, <see cref="Optional{Object}.HasValue"/> is true and <see cref="Optional{Object}.Value"/> is the value of the expression. Otherwise, <see cref="Optional{Object}.HasValue"/> is false. 94public Optional<object?> ConstantValue 100return default(Optional<object?>);
Optional.cs (2)
20/// Constructs an <see cref="Optional{T}"/> with a meaningful value. 58public static implicit operator Optional<T>(T value)
Microsoft.CodeAnalysis.CodeStyle (24)
src\Analyzers\Core\Analyzers\PopulateSwitch\AbstractPopulateSwitchDiagnosticAnalyzer.cs (1)
127protected static bool ConstantValueEquals(Optional<object?> constantValue, object? value)
src\Analyzers\Core\Analyzers\SimplifyBooleanExpression\AbstractSimplifyConditionalDiagnosticAnalyzer.cs (1)
164var constantValue = semanticModel.GetConstantValue(node, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleHelpers.cs (1)
168private static Optional<CodeStyleOption2<UnusedValuePreference>> ParseUnusedExpressionAssignmentPreference(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CollectionExpressionPreference.cs (1)
40public static Optional<CodeStyleOption2<CollectionExpressionPreference>> Parse(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\OperatorPlacementWhenWrappingPreference.cs (1)
22public static Optional<OperatorPlacementWhenWrappingPreference> Parse(string optionString, OperatorPlacementWhenWrappingPreference defaultValue)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (6)
57Optional<TSyntaxKind> kind = default, 58Optional<ImmutableArray<EmbeddedSyntaxTrivia<TSyntaxKind>>> leadingTrivia = default, 59Optional<VirtualCharSequence> virtualChars = default, 60Optional<ImmutableArray<EmbeddedSyntaxTrivia<TSyntaxKind>>> trailingTrivia = default, 61Optional<ImmutableArray<EmbeddedDiagnostic>> diagnostics = default, 62Optional<object> value = default)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\EditorConfigValueSerializer.cs (5)
38private static Optional<bool> ParseBoolean(string str) 44private static Optional<bool?> ParseNullableBoolean(string str) 51var optionalBool = ParseBoolean(str); 76=> new(parseValue: str => str.Equals(emptyStringRepresentation, StringComparison.Ordinal) ? default(Optional<string>) : EscapeLineBreaks(str), 139static Optional<T?> ParseValueForNullableEnum(string str)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\EditorConfigValueSerializer`1.cs (2)
16Func<string, Optional<T>> parseValue, 23private readonly ConcurrentDictionary<string, Optional<T>> _cachedValues = [];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\OptionalExtensions.cs (1)
11internal static T GetValueOrDefault<T>(this Optional<T> optional) where T : struct
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.cs (5)
108Optional<bool> distinguishRefFromOut = default, 109Optional<bool> tupleNamesMustMatch = default, 110Optional<bool> ignoreNullableAnnotations = default, 111Optional<bool> objectAndDynamicCompareEqually = default, 112Optional<bool> arrayAndReadOnlySpanCompareEqually = default)
Microsoft.CodeAnalysis.CodeStyle.Fixes (18)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationContext.cs (14)
180Optional<Location> contextLocation = default, 181Optional<Location?> afterThisLocation = default, 182Optional<Location?> beforeThisLocation = default, 183Optional<bool> addImports = default, 184Optional<IEnumerable<INamespaceSymbol>> additionalImports = default, 185Optional<bool> generateMembers = default, 186Optional<bool> mergeNestedNamespaces = default, 187Optional<bool> mergeAttributes = default, 188Optional<bool> generateDefaultAccessibility = default, 189Optional<bool> generateMethodBodies = default, 190Optional<bool> generateDocumentationComments = default, 191Optional<bool> autoInsertionLocation = default, 192Optional<bool> sortMembers = default, 193Optional<bool> reuseSyntax = default)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (3)
295Optional<string> name = default, 298Optional<object> defaultValue = default) 525Optional<ImmutableArray<AttributeData>> returnTypeAttributes = default)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (1)
440var numericValue = numericLiteralExpression.ConstantValue;
Microsoft.CodeAnalysis.CSharp (28)
Compilation\CSharpSemanticModel.cs (5)
196internal abstract Optional<object> GetConstantValueWorker(CSharpSyntaxNode node, CancellationToken cancellationToken = default(CancellationToken)); 1148public Optional<object> GetConstantValue(ExpressionSyntax expression, CancellationToken cancellationToken = default(CancellationToken)) 1154: default(Optional<object>); 5388protected sealed override Optional<object> GetConstantValueCore(SyntaxNode node, CancellationToken cancellationToken) 5397: default(Optional<object>);
Compilation\MemberSemanticModel.cs (3)
1256internal override Optional<object> GetConstantValueWorker(CSharpSyntaxNode node, CancellationToken cancellationToken) 1261if (boundExpr == null) return default(Optional<object>); 1265? default(Optional<object>)
Compilation\SpeculativeSemanticModelWithMemberModel.cs (1)
470internal override Optional<object> GetConstantValueWorker(CSharpSyntaxNode node, CancellationToken cancellationToken)
Compilation\SyntaxTreeSemanticModel.cs (2)
415internal override Optional<object> GetConstantValueWorker(CSharpSyntaxNode node, CancellationToken cancellationToken) 421return model == null ? default(Optional<object>) : model.GetConstantValueWorker(node, cancellationToken);
CSharpExtensions.cs (2)
995public static Optional<object> GetConstantValue(this SemanticModel? semanticModel, ExpressionSyntax expression, CancellationToken cancellationToken = default(CancellationToken)) 1004return default(Optional<object>);
FlowAnalysis\AbstractFlowPass.cs (6)
436protected ImmutableArray<PendingBranch> Analyze(ref bool badRegion, Optional<TLocalState> initialState = default) 1898protected Optional<TLocalState> NonMonotonicState; 1912Optional<TLocalState> oldTryState = NonMonotonicState; 1941Optional<TLocalState> oldTryState = NonMonotonicState; 1986Optional<TLocalState> oldTryState = NonMonotonicState; 2569Optional<TLocalState> oldState = NonMonotonicState;
FlowAnalysis\AbstractFlowPass_LocalFunctions.cs (1)
85Optional<TLocalState> savedNonMonotonicState = NonMonotonicState;
FlowAnalysis\NullableWalker.cs (8)
104public readonly Optional<LocalState> StateForLambda; 120public VisitResult(TypeWithState rValueType, TypeWithAnnotations lValueType, Optional<LocalState> stateForLambda) 247/// The delegate is invoked by <see cref="VisitConversion(BoundConversion, BoundExpression, Conversion, TypeWithAnnotations, TypeWithState, bool, bool, bool, AssignmentKind, ParameterSymbol, bool, bool, bool, bool, Optional&lt;LocalState&gt;,bool, Location, ArrayBuilder&lt;VisitResult&gt;)"/>. 1756Analyze(walker, symbol, diagnostics, initialState is null ? (Optional<LocalState>)default : LocalState.Create(initialState.VariableNullableStates), snapshotBuilderOpt, requiresAnalysis); 1773Optional<LocalState> initialState, 7944var lambdaState = visitResult.StateForLambda; 8789Optional<LocalState> stateForLambda = default, 9863private void VisitLambda(BoundLambda node, NamedTypeSymbol? delegateTypeOpt, Optional<LocalState> initialState = default)
Microsoft.CodeAnalysis.CSharp.CodeStyle (7)
src\Analyzers\CSharp\Analyzers\UseCollectionInitializer\CSharpUseCollectionInitializerAnalyzer.cs (1)
146var constant = this.SemanticModel.GetConstantValue(piece, cancellationToken);
src\Analyzers\CSharp\Analyzers\UseNameofInNullableAttribute\CSharpUseNameofInNullableAttributeDiagnosticAnalyzer.cs (1)
87var constantValue = semanticModel.GetConstantValue(argument.Expression, cancellationToken);
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndMemberAccessDiagnosticAnalyzer.cs (3)
96var constantValue = semanticModel.GetConstantValue(binaryExpression.Right, cancellationToken); 139var constantValue = semanticModel.GetConstantValue(expression1, cancellationToken); 153var constantValue = semanticModel.GetConstantValue(expression2, cancellationToken);
src\Analyzers\CSharp\Analyzers\UseSimpleUsingStatement\UseSimpleUsingStatementDiagnosticAnalyzer.cs (1)
269var constantValue = semanticModel.GetConstantValue(returnStatement.Expression, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (1)
137var constantValue = semanticModel.GetConstantValue(child, cancellationToken);
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
CodeGeneration\SyntaxGeneratorTests.cs (1)
94var constantValue = speculativeModel.GetConstantValue(replacement.Expression);
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (1)
Emit\NumericIntPtrTests.cs (1)
2888var value = field.GetConstantValue(ConstantFieldsInProgress.Empty, earlyDecodingWellKnownAttributes: false);
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (1)
Semantics\CollectionExpressionTests.cs (1)
27090Optional<object> IOperation.ConstantValue => throw null;
Microsoft.CodeAnalysis.CSharp.Features (12)
QuickInfo\CSharpDiagnosticAnalyzerQuickInfoProvider.cs (1)
120var checkIdObject = semanticModel.GetConstantValue(suppressMessageCheckIdArgument.Expression, cancellationToken);
ReverseForStatement\CSharpReverseForStatementCodeRefactoringProvider.cs (5)
92var startValue = semanticModel.GetConstantValue(start, cancellationToken); 93var endValue = semanticModel.GetConstantValue(end, cancellationToken); 105private static bool IsUnsignedBoundary(Optional<object?> startValue, Optional<object?> endValue, ulong maxValue) 108private static bool ValueEquals(Optional<object?> valueOpt, ulong value)
src\Analyzers\CSharp\Analyzers\UseCollectionInitializer\CSharpUseCollectionInitializerAnalyzer.cs (1)
146var constant = this.SemanticModel.GetConstantValue(piece, cancellationToken);
src\Analyzers\CSharp\Analyzers\UseNameofInNullableAttribute\CSharpUseNameofInNullableAttributeDiagnosticAnalyzer.cs (1)
87var constantValue = semanticModel.GetConstantValue(argument.Expression, cancellationToken);
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndMemberAccessDiagnosticAnalyzer.cs (3)
96var constantValue = semanticModel.GetConstantValue(binaryExpression.Right, cancellationToken); 139var constantValue = semanticModel.GetConstantValue(expression1, cancellationToken); 153var constantValue = semanticModel.GetConstantValue(expression2, cancellationToken);
src\Analyzers\CSharp\Analyzers\UseSimpleUsingStatement\UseSimpleUsingStatementDiagnosticAnalyzer.cs (1)
269var constantValue = semanticModel.GetConstantValue(returnStatement.Expression, cancellationToken);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (3)
Semantics\ConstantTests.cs (1)
2925var constantValue = comp.GetSemanticModel(tree).GetConstantValue(expr);
Semantics\LambdaTests.cs (1)
8061var constantValue = model.GetConstantValue(equalsValue.Value);
Semantics\NativeIntegerTests.cs (1)
7052var value = field.GetConstantValue(ConstantFieldsInProgress.Empty, earlyDecodingWellKnownAttributes: false);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (12)
Compilation\SemanticModelAPITests.cs (9)
1437var constantInfo = speculativeModel.GetConstantValue(expr); 1475var constantInfo = speculativeModel.GetConstantValue(expr); 1523var constantInfo = speculativeModel.GetConstantValue(expr); 1611var constantInfo = speculativeModel.GetConstantValue(expr); 1696var constantInfo = speculativeModel.GetConstantValue(expr); 2785var constantVal = speculativeModel.GetConstantValue(switchLabel.Value); 3912var value0 = model.GetConstantValue(init0); 3921var value1 = model.GetConstantValue(init1); 3928var value2 = model.GetConstantValue(init2);
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (2)
4275var constantInfo = speculativeModel.GetConstantValue(attr2.ArgumentList.Arguments.First().Expression); 5664Optional<object> actualConstant = model.GetConstantValue(valueSyntax);
Symbols\EnumTests.cs (1)
354var value = model.GetConstantValue(expr);
Microsoft.CodeAnalysis.CSharp.Test.Utilities (2)
CompilationTestUtils.cs (2)
216public Optional<object> ConstantValue = default(Optional<object>);
Microsoft.CodeAnalysis.CSharp.Workspaces (2)
Simplification\Simplifiers\AbstractCSharpSimplifier.cs (1)
269var nameofValueOpt = semanticModel.GetConstantValue(node.Parent.Parent.Parent);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (1)
137var constantValue = semanticModel.GetConstantValue(child, cancellationToken);
Microsoft.CodeAnalysis.ExternalAccess.Razor (8)
Remote\RazorRemoteHostClient.cs (4)
46public async ValueTask<Optional<TResult>> TryInvokeAsync<TService, TResult>(Func<TService, CancellationToken, ValueTask<TResult>> invocation, CancellationToken cancellationToken) where TService : class 60public async ValueTask<Optional<TResult>> TryInvokeAsync<TService, TResult>(Func<TService, RazorRemoteServiceCallbackIdWrapper, CancellationToken, ValueTask<TResult>> invocation, object callbackTarget, CancellationToken cancellationToken) where TService : class 74public async ValueTask<Optional<TResult>> TryInvokeAsync<TService, TResult>(Solution solution, Func<TService, RazorPinnedSolutionInfoWrapper, CancellationToken, ValueTask<TResult>> invocation, CancellationToken cancellationToken) where TService : class 88public async ValueTask<Optional<TResult>> TryInvokeAsync<TService, TResult>(Solution solution, Func<TService, RazorPinnedSolutionInfoWrapper, RazorRemoteServiceCallbackIdWrapper, CancellationToken, ValueTask<TResult>> invocation, object callbackTarget, CancellationToken cancellationToken) where TService : class
Remote\RazorRemoteServiceConnectionWrapper.cs (4)
28public ValueTask<Optional<TResult>> TryInvokeAsync<TResult>(Func<TService, CancellationToken, ValueTask<TResult>> invocation, CancellationToken cancellationToken) 38public ValueTask<Optional<TResult>> TryInvokeAsync<TResult>(Func<TService, RazorRemoteServiceCallbackIdWrapper, CancellationToken, ValueTask<TResult>> invocation, CancellationToken cancellationToken) 51public ValueTask<Optional<TResult>> TryInvokeAsync<TResult>(Solution solution, Func<TService, RazorPinnedSolutionInfoWrapper, CancellationToken, ValueTask<TResult>> invocation, CancellationToken cancellationToken) 65public ValueTask<Optional<TResult>> TryInvokeAsync<TResult>(Solution solution, Func<TService, RazorPinnedSolutionInfoWrapper, RazorRemoteServiceCallbackIdWrapper, CancellationToken, ValueTask<TResult>> invocation, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.Features (42)
Completion\CompletionItem.cs (12)
345Optional<TextSpan> span = default, 346Optional<string> displayText = default, 347Optional<string> filterText = default, 348Optional<string> sortText = default, 349Optional<ImmutableArray<KeyValuePair<string, string>>> properties = default, 350Optional<ImmutableArray<string>> tags = default, 351Optional<CompletionItemRules> rules = default, 352Optional<string> displayTextPrefix = default, 353Optional<string> displayTextSuffix = default, 354Optional<string> inlineDescription = default, 355Optional<bool> isComplexTextEdit = default, 356Optional<ImmutableArray<string>> additionalFilterTexts = default)
Completion\CompletionItemRules.cs (6)
173Optional<ImmutableArray<CharacterSetModificationRule>> filterRules = default, 174Optional<ImmutableArray<CharacterSetModificationRule>> commitRules = default, 175Optional<EnterKeyRule> enterKeyRule = default, 176Optional<bool> formatOnCommit = default, 177Optional<int> matchPriority = default, 178Optional<CompletionItemSelectionBehavior> selectionBehavior = default)
Completion\CompletionList.cs (4)
123Optional<TextSpan> span = default, 124Optional<IReadOnlyList<CompletionItem>> itemsList = default, 125Optional<CompletionRules> rules = default, 126Optional<CompletionItem> suggestionModeItem = default)
Completion\CompletionRules.cs (5)
97Optional<bool> dismissIfEmpty = default, 98Optional<bool> dismissIfLastCharacterDeleted = default, 99Optional<ImmutableArray<char>> defaultCommitCharacters = default, 100Optional<EnterKeyRule> defaultEnterKeyRule = default, 101Optional<SnippetsRule> snippetsRule = default)
EditAndContinue\CommittedSolution.cs (4)
309private async ValueTask<(Optional<SourceText?> matchingSourceText, bool? hasDocument)> TryGetMatchingSourceTextAsync(Document document, SourceText sourceText, Document? currentDocument, CancellationToken cancellationToken) 315var maybeMatchingSourceText = (maybePdbHasDocument == true) ? 321private static async ValueTask<Optional<SourceText?>> TryGetMatchingSourceTextAsync( 439private static Optional<SourceText?> TryGetPdbMatchingSourceTextFromDisk(string sourceFilePath, Encoding? encoding, ImmutableArray<byte> requiredChecksum, SourceHashAlgorithm checksumAlgorithm)
EmbeddedLanguages\RegularExpressions\LanguageServices\RegexLanguageDetector.cs (1)
188var constVal = semanticModel.GetConstantValue(expr, cancellationToken);
src\Analyzers\Core\Analyzers\PopulateSwitch\AbstractPopulateSwitchDiagnosticAnalyzer.cs (1)
127protected static bool ConstantValueEquals(Optional<object?> constantValue, object? value)
src\Analyzers\Core\Analyzers\SimplifyBooleanExpression\AbstractSimplifyConditionalDiagnosticAnalyzer.cs (1)
164var constantValue = semanticModel.GetConstantValue(node, cancellationToken);
Structure\BlockSpan.cs (8)
96Optional<bool> isCollapsible = default, 97Optional<TextSpan> textSpan = default, 98Optional<TextSpan> hintSpan = default, 99Optional<ImmutableArray<(TextSpan textSpan, TextSpan hintSpan, string type)>> subHeadings = default, 100Optional<string> type = default, 101Optional<string> bannerText = default, 102Optional<bool> autoCollapse = default, 103Optional<bool> isDefaultCollapsed = default)
Microsoft.CodeAnalysis.Remote.Workspaces (22)
BrokeredServiceConnection.cs (6)
114public override async ValueTask<Optional<TResult>> TryInvokeAsync<TResult>(Func<TService, CancellationToken, ValueTask<TResult>> invocation, CancellationToken cancellationToken) 147public override async ValueTask<Optional<TResult>> TryInvokeAsync<TResult>(Func<TService, RemoteServiceCallbackId, CancellationToken, ValueTask<TResult>> invocation, CancellationToken cancellationToken) 181public override async ValueTask<Optional<TResult>> TryInvokeAsync<TResult>(SolutionCompilationState compilationState, Func<TService, Checksum, CancellationToken, ValueTask<TResult>> invocation, CancellationToken cancellationToken) 214public override async ValueTask<Optional<TResult>> TryInvokeAsync<TResult>(SolutionCompilationState compilationState, ProjectId projectId, Func<TService, Checksum, CancellationToken, ValueTask<TResult>> invocation, CancellationToken cancellationToken) 250public override async ValueTask<Optional<TResult>> TryInvokeAsync<TResult>(SolutionCompilationState compilationState, Func<TService, Checksum, RemoteServiceCallbackId, CancellationToken, ValueTask<TResult>> invocation, CancellationToken cancellationToken) 288public override async ValueTask<Optional<TResult>> TryInvokeAsync<TResult>(SolutionCompilationState compilationState, ProjectId projectId, Func<TService, Checksum, RemoteServiceCallbackId, CancellationToken, ValueTask<TResult>> invocation, CancellationToken cancellationToken)
ExternalAccess\Pythia\Api\PythiaRemoteHostClient.cs (4)
46public async ValueTask<Optional<TResult>> TryInvokeAsync<TService, TResult>(Func<TService, CancellationToken, ValueTask<TResult>> invocation, CancellationToken cancellationToken) where TService : class 60public async ValueTask<Optional<TResult>> TryInvokeAsync<TService, TResult>(Func<TService, PythiaRemoteServiceCallbackIdWrapper, CancellationToken, ValueTask<TResult>> invocation, object callbackTarget, CancellationToken cancellationToken) where TService : class 74public async ValueTask<Optional<TResult>> TryInvokeAsync<TService, TResult>(Solution solution, Func<TService, PythiaPinnedSolutionInfoWrapper, CancellationToken, ValueTask<TResult>> invocation, CancellationToken cancellationToken) where TService : class 88public async ValueTask<Optional<TResult>> TryInvokeAsync<TService, TResult>(Solution solution, Func<TService, PythiaPinnedSolutionInfoWrapper, PythiaRemoteServiceCallbackIdWrapper, CancellationToken, ValueTask<TResult>> invocation, object callbackTarget, CancellationToken cancellationToken) where TService : class
ExternalAccess\Pythia\Api\PythiaRemoteServiceConnectionWrapper.cs (4)
28public ValueTask<Optional<TResult>> TryInvokeAsync<TResult>(Func<TService, CancellationToken, ValueTask<TResult>> invocation, CancellationToken cancellationToken) 38public ValueTask<Optional<TResult>> TryInvokeAsync<TResult>(Func<TService, PythiaRemoteServiceCallbackIdWrapper, CancellationToken, ValueTask<TResult>> invocation, CancellationToken cancellationToken) 51public ValueTask<Optional<TResult>> TryInvokeAsync<TResult>(Solution solution, Func<TService, PythiaPinnedSolutionInfoWrapper, CancellationToken, ValueTask<TResult>> invocation, CancellationToken cancellationToken) 65public ValueTask<Optional<TResult>> TryInvokeAsync<TResult>(Solution solution, Func<TService, PythiaPinnedSolutionInfoWrapper, PythiaRemoteServiceCallbackIdWrapper, CancellationToken, ValueTask<TResult>> invocation, CancellationToken cancellationToken)
ExternalAccess\UnitTesting\Api\UnitTestingRemoteHostClient.cs (4)
46public async ValueTask<Optional<TResult>> TryInvokeAsync<TService, TResult>(Func<TService, CancellationToken, ValueTask<TResult>> invocation, CancellationToken cancellationToken) where TService : class 60public async ValueTask<Optional<TResult>> TryInvokeAsync<TService, TResult>(Func<TService, UnitTestingRemoteServiceCallbackIdWrapper, CancellationToken, ValueTask<TResult>> invocation, object callbackTarget, CancellationToken cancellationToken) where TService : class 74public async ValueTask<Optional<TResult>> TryInvokeAsync<TService, TResult>(Solution solution, Func<TService, UnitTestingPinnedSolutionInfoWrapper, CancellationToken, ValueTask<TResult>> invocation, CancellationToken cancellationToken) where TService : class 88public async ValueTask<Optional<TResult>> TryInvokeAsync<TService, TResult>(Solution solution, Func<TService, UnitTestingPinnedSolutionInfoWrapper, UnitTestingRemoteServiceCallbackIdWrapper, CancellationToken, ValueTask<TResult>> invocation, object callbackTarget, CancellationToken cancellationToken) where TService : class
ExternalAccess\UnitTesting\Api\UnitTestingRemoteServiceConnectionWrapper.cs (4)
28public ValueTask<Optional<TResult>> TryInvokeAsync<TResult>(Func<TService, CancellationToken, ValueTask<TResult>> invocation, CancellationToken cancellationToken) 38public ValueTask<Optional<TResult>> TryInvokeAsync<TResult>(Func<TService, UnitTestingRemoteServiceCallbackIdWrapper, CancellationToken, ValueTask<TResult>> invocation, CancellationToken cancellationToken) 51public ValueTask<Optional<TResult>> TryInvokeAsync<TResult>(Solution solution, Func<TService, UnitTestingPinnedSolutionInfoWrapper, CancellationToken, ValueTask<TResult>> invocation, CancellationToken cancellationToken) 65public ValueTask<Optional<TResult>> TryInvokeAsync<TResult>(Solution solution, Func<TService, UnitTestingPinnedSolutionInfoWrapper, UnitTestingRemoteServiceCallbackIdWrapper, CancellationToken, ValueTask<TResult>> invocation, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.Test.Utilities (9)
Compilation\OperationTreeVerifier.cs (1)
218private void LogConstant(Optional<object> constant, string header = "Constant")
Compilation\TestOperationVisitor.cs (1)
48var constantValue = operation.ConstantValue;
Diagnostics\EmptyArrayAnalyzer.cs (1)
78Optional<object> arrayLength = arrayCreation.DimensionSizes[0].ConstantValue;
Diagnostics\OperationTestAnalyzer.cs (6)
189Optional<object> advanceIncrementOpt; 229out BinaryOperatorKind? advanceOperationCode, out Optional<object> advanceIncrementOpt) 586Optional<object> argumentValue = argument.ConstantValue; 1108Optional<object> dimensionSize = arrayValue.DimensionSizes[0].ConstantValue; 1135Optional<object> dimensionSize = arrayValue.DimensionSizes[0].ConstantValue; 1622var rightValue = right.ConstantValue;
Microsoft.CodeAnalysis.VisualBasic (8)
Analysis\FlowAnalysis\DataFlowPass.vb (5)
28Imports OptionalState = Microsoft.CodeAnalysis.[Optional](Of Microsoft.CodeAnalysis.VisualBasic.DataFlowPass.LocalState) 1441Private _tryState As OptionalState 1447Dim oldTryState As OptionalState = Me._tryState 1472Dim oldTryState As OptionalState = Me._tryState 1506Dim oldTryState As OptionalState = Me._tryState
Compilation\SemanticModel.vb (3)
387Public Shadows Function GetConstantValue(expression As ExpressionSyntax, Optional cancellationToken As CancellationToken = Nothing) As [Optional](Of Object) 414Public Shadows Function GetSpeculativeConstantValue(position As Integer, expression As ExpressionSyntax) As [Optional](Of Object) 3422Protected NotOverridable Overrides Function GetConstantValueCore(node As SyntaxNode, Optional cancellationToken As CancellationToken = Nothing) As [Optional](Of Object)
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (1)
CompilationTestUtils.vb (1)
533Public ConstantValue As [Optional](Of Object) = Nothing
Microsoft.CodeAnalysis.Workspaces (142)
Classification\AbstractClassificationService.cs (2)
90var classifiedSpans = await client.TryInvokeAsync<IRemoteSemanticClassificationService, SerializableClassifiedSpans>( 123var cachedSpans = await client.TryInvokeAsync<IRemoteSemanticClassificationService, SerializableClassifiedSpans?>(
CodeFixes\FixAllOccurrences\FixAllContext.cs (8)
85Optional<(Document? document, Project project)> documentAndProject, 86Optional<FixAllScope> scope, 87Optional<string?> codeActionEquivalenceKey, 88Optional<CancellationToken> cancellationToken) 334Optional<(Document? document, Project project)> documentAndProject = default, 335Optional<FixAllScope> scope = default, 336Optional<string?> codeActionEquivalenceKey = default, 337Optional<CancellationToken> cancellationToken = default)
CodeFixesAndRefactorings\CommonFixAllState.cs (6)
47Optional<(Document? document, Project project)> documentAndProject = default, 48Optional<FixAllScope> scope = default, 49Optional<string?> codeActionEquivalenceKey = default) 72Optional<(Document? document, Project project)> documentAndProject, 73Optional<FixAllScope> scope, 74Optional<string?> codeActionEquivalenceKey)
CodeFixesAndRefactorings\IFixAllContext.cs (4)
29Optional<(Document? document, Project project)> documentAndProject = default, 30Optional<FixAllScope> scope = default, 31Optional<string?> codeActionEquivalenceKey = default, 32Optional<CancellationToken> cancellationToken = default);
CodeFixesAndRefactorings\IFixAllState.cs (3)
30Optional<(Document? document, Project project)> documentAndProject = default, 31Optional<FixAllScope> scope = default, 32Optional<string?> codeActionEquivalenceKey = default);
CodeRefactorings\FixAllOccurences\DocumentBasedFixAllProvider.cs (2)
25/// <see cref="FixAllAsync(FixAllContext, Document, Optional{ImmutableArray{TextSpan}})"/> is invoked for each document for implementors to process. 59protected abstract Task<Document?> FixAllAsync(FixAllContext fixAllContext, Document document, Optional<ImmutableArray<TextSpan>> fixAllSpans);
CodeRefactorings\FixAllOccurences\FixAllContext.cs (9)
75Optional<(Document? document, Project project)> documentAndProject, 76Optional<FixAllScope> scope, 77Optional<string?> codeActionEquivalenceKey, 78Optional<CancellationToken> cancellationToken) 96public Task<ImmutableDictionary<Document, Optional<ImmutableArray<TextSpan>>>> GetFixAllSpansAsync(CancellationToken cancellationToken) 100Optional<(Document? document, Project project)> documentAndProject = default, 101Optional<FixAllScope> scope = default, 102Optional<string?> codeActionEquivalenceKey = default, 103Optional<CancellationToken> cancellationToken = default)
CodeRefactorings\FixAllOccurences\FixAllProvider.cs (4)
58public static FixAllProvider Create(Func<FixAllContext, Document, Optional<ImmutableArray<TextSpan>>, Task<Document?>> fixAllAsync) 78Func<FixAllContext, Document, Optional<ImmutableArray<TextSpan>>, Task<Document?>> fixAllAsync, 94Func<FixAllContext, Document, Optional<ImmutableArray<TextSpan>>, Task<Document?>> fixAllAsync, 97protected override Task<Document?> FixAllAsync(FixAllContext context, Document document, Optional<ImmutableArray<TextSpan>> fixAllSpans)
CodeRefactorings\FixAllOccurences\FixAllState.cs (4)
90internal async Task<ImmutableDictionary<Document, Optional<ImmutableArray<TextSpan>>>> GetFixAllSpansAsync(CancellationToken cancellationToken) 99return ImmutableDictionary<Document, Optional<ImmutableArray<TextSpan>>>.Empty; 120return ImmutableDictionary<Document, Optional<ImmutableArray<TextSpan>>>.Empty; 123return documentsToFix.ToImmutableDictionary(d => d, _ => default(Optional<ImmutableArray<TextSpan>>));
CodeRefactorings\SyntaxEditorBasedCodeRefactoringProvider.cs (1)
50Optional<ImmutableArray<TextSpan>> fixAllSpans,
FindSymbols\Declarations\DeclarationFinder_AllDeclarations.cs (1)
42var result = await client.TryInvokeAsync<IRemoteSymbolFinderService, ImmutableArray<SerializableSymbolAndProjectId>>(
FindSymbols\Declarations\DeclarationFinder_SourceDeclarations.cs (4)
46var result = await client.TryInvokeAsync<IRemoteSymbolFinderService, ImmutableArray<SerializableSymbolAndProjectId>>( 84var result = await client.TryInvokeAsync<IRemoteSymbolFinderService, ImmutableArray<SerializableSymbolAndProjectId>>( 117var result = await client.TryInvokeAsync<IRemoteSymbolFinderService, ImmutableArray<SerializableSymbolAndProjectId>>( 150var result = await client.TryInvokeAsync<IRemoteSymbolFinderService, ImmutableArray<SerializableSymbolAndProjectId>>(
Remote\RemoteHostClient.cs (7)
69public async ValueTask<Optional<TResult>> TryInvokeAsync<TService, TResult>( 90public async ValueTask<Optional<TResult>> TryInvokeAsync<TService, TResult>( 121public async ValueTask<Optional<TResult>> TryInvokeAsync<TService, TResult>( 149public async ValueTask<Optional<TResult>> TryInvokeAsync<TService, TResult>( 166public async ValueTask<Optional<TResult>> TryInvokeAsync<TService, TResult>( 189public async ValueTask<Optional<TResult>> TryInvokeAsync<TService, TResult>( 225public async ValueTask<Optional<TResult>> TryInvokeAsync<TService, TResult>(
Remote\RemoteServiceConnection.cs (10)
26public abstract ValueTask<Optional<TResult>> TryInvokeAsync<TResult>( 36public abstract ValueTask<Optional<TResult>> TryInvokeAsync<TResult>( 47public abstract ValueTask<Optional<TResult>> TryInvokeAsync<TResult>( 58public ValueTask<Optional<TResult>> TryInvokeAsync<TResult>( 72public abstract ValueTask<Optional<TResult>> TryInvokeAsync<TResult>( 84public ValueTask<Optional<TResult>> TryInvokeAsync<TResult>( 97public abstract ValueTask<Optional<TResult>> TryInvokeAsync<TResult>( 108public ValueTask<Optional<TResult>> TryInvokeAsync<TResult>( 122public abstract ValueTask<Optional<TResult>> TryInvokeAsync<TResult>( 134public ValueTask<Optional<TResult>> TryInvokeAsync<TResult>(
Shared\TestHooks\AsynchronousOperationListenerProvider.cs (1)
134var isCompleted = await remoteHostClient.TryInvokeAsync<IRemoteAsynchronousOperationListenerService, bool>(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleHelpers.cs (1)
168private static Optional<CodeStyleOption2<UnusedValuePreference>> ParseUnusedExpressionAssignmentPreference(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CollectionExpressionPreference.cs (1)
40public static Optional<CodeStyleOption2<CollectionExpressionPreference>> Parse(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\OperatorPlacementWhenWrappingPreference.cs (1)
22public static Optional<OperatorPlacementWhenWrappingPreference> Parse(string optionString, OperatorPlacementWhenWrappingPreference defaultValue)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (6)
57Optional<TSyntaxKind> kind = default, 58Optional<ImmutableArray<EmbeddedSyntaxTrivia<TSyntaxKind>>> leadingTrivia = default, 59Optional<VirtualCharSequence> virtualChars = default, 60Optional<ImmutableArray<EmbeddedSyntaxTrivia<TSyntaxKind>>> trailingTrivia = default, 61Optional<ImmutableArray<EmbeddedDiagnostic>> diagnostics = default, 62Optional<object> value = default)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\EditorConfigValueSerializer.cs (5)
38private static Optional<bool> ParseBoolean(string str) 44private static Optional<bool?> ParseNullableBoolean(string str) 51var optionalBool = ParseBoolean(str); 76=> new(parseValue: str => str.Equals(emptyStringRepresentation, StringComparison.Ordinal) ? default(Optional<string>) : EscapeLineBreaks(str), 139static Optional<T?> ParseValueForNullableEnum(string str)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\EditorConfigValueSerializer`1.cs (2)
16Func<string, Optional<T>> parseValue, 23private readonly ConcurrentDictionary<string, Optional<T>> _cachedValues = [];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\OptionalExtensions.cs (1)
11internal static T GetValueOrDefault<T>(this Optional<T> optional) where T : struct
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.cs (5)
108Optional<bool> distinguishRefFromOut = default, 109Optional<bool> tupleNamesMustMatch = default, 110Optional<bool> ignoreNullableAnnotations = default, 111Optional<bool> objectAndDynamicCompareEqually = default, 112Optional<bool> arrayAndReadOnlySpanCompareEqually = default)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationContext.cs (14)
180Optional<Location> contextLocation = default, 181Optional<Location?> afterThisLocation = default, 182Optional<Location?> beforeThisLocation = default, 183Optional<bool> addImports = default, 184Optional<IEnumerable<INamespaceSymbol>> additionalImports = default, 185Optional<bool> generateMembers = default, 186Optional<bool> mergeNestedNamespaces = default, 187Optional<bool> mergeAttributes = default, 188Optional<bool> generateDefaultAccessibility = default, 189Optional<bool> generateMethodBodies = default, 190Optional<bool> generateDocumentationComments = default, 191Optional<bool> autoInsertionLocation = default, 192Optional<bool> sortMembers = default, 193Optional<bool> reuseSyntax = default)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (3)
295Optional<string> name = default, 298Optional<object> defaultValue = default) 525Optional<ImmutableArray<AttributeData>> returnTypeAttributes = default)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (1)
440var numericValue = numericLiteralExpression.ConstantValue;
Storage\SQLite\v2\Interop\SqlConnection.cs (4)
294public Optional<Stream> ReadDataBlob_MustRunInTransaction(Database database, Table table, long rowId) 302public Optional<Checksum> ReadChecksum_MustRunInTransaction(Database database, Table table, long rowId) 359public Optional<T> ReadBlob_MustRunInTransaction<T>( 361Func<SqlConnection, SafeSqliteBlobHandle, Optional<T>> readBlob)
Storage\SQLite\v2\SQLitePersistentStorage.Accessor.cs (9)
127var optional = ReadColumn( 145var optional = ReadColumn( 156private Optional<T> ReadColumn<T, TData>( 159Func<TData, SqlConnection, Database, long, Optional<T>> readColumn, 187var optional = ReadColumnHelper(connection, Database.WriteCache, databaseKey, dataNameId); 204Optional<T> ReadColumnHelper(SqlConnection connection, Database database, TDatabaseKey databaseKey, int dataNameID) 262private Optional<Stream> ReadDataBlob( 295private Optional<Checksum> ReadChecksum( 314var storedChecksum = connection.ReadChecksum_MustRunInTransaction(database, Table, rowId);
Workspace\Solution\DocumentInfo.cs (6)
100Optional<TextLoader?> loader = default, 101Optional<IDocumentServiceProvider?> documentServiceProvider = default) 199Optional<SourceCodeKind> sourceCodeKind = default, 200Optional<string?> filePath = default, 201Optional<bool> isGenerated = default, 202Optional<bool> designTimeOnly = default)
Workspace\Solution\ProjectInfo.cs (14)
286Optional<CompilationOptions?> compilationOptions = default, 287Optional<ParseOptions?> parseOptions = default, 294Optional<Type?> hostObjectType = default) 537Optional<string?> filePath = default, 538Optional<string?> outputPath = default, 539Optional<string?> outputRefPath = default, 540Optional<CompilationOutputInfo> compilationOutputInfo = default, 541Optional<string?> defaultNamespace = default, 542Optional<SourceHashAlgorithm> checksumAlgorithm = default, 543Optional<bool> isSubmission = default, 544Optional<bool> hasAllInformation = default, 545Optional<bool> runAnalyzers = default, 546Optional<Guid> telemetryId = default, 547Optional<bool> hasSdkCodeStyleAnalyzers = default)
Workspace\Solution\SolutionCompilationState.cs (1)
119Optional<TextDocumentStates<SourceGeneratedDocumentState>?> frozenSourceGeneratedDocumentStates = default,
Workspace\Solution\SolutionInfo.cs (2)
144Optional<string?> filePath = default, 145Optional<Guid> telemetryId = default)
Microsoft.Interop.SourceGeneration (5)
StubEnvironment.cs (5)
21private Optional<INamedTypeSymbol?> _lcidConversionAttrType; 35private Optional<INamedTypeSymbol?> _suppressGCTransitionAttrType; 49private Optional<INamedTypeSymbol?> _unmanagedCallConvAttrType; 63private Optional<INamedTypeSymbol?> _defaultDllImportSearchPathsAttrType; 77private Optional<INamedTypeSymbol?> _wasmImportLinkageAttrType;
Microsoft.VisualStudio.LanguageServices (12)
Options\IVisualStudioStorageReadFallback.cs (2)
10internal delegate Optional<object?> TryReadValueDelegate(string storageKey, Type storageType, object? defaultValue); 19Optional<object?> TryRead(string? language, TryReadValueDelegate readValue);
Options\NamingPreferencesReadFallback.cs (1)
24public Optional<object?> TryRead(string? language, TryReadValueDelegate readValue)
Options\VisualStudioSettingsOptionPersister.cs (9)
65var result = TryReadAndMonitorOptionValue(optionKey, storageKey, storageKey, optionKey.Option.Type, optionKey.Option.DefaultValue); 74var fallbackResult = lazyReadFallback.Value.TryRead( 89public Optional<object?> TryReadAndMonitorOptionValue(OptionKey2 primaryOptionKey, string primaryStorageKey, string storageKey, Type storageType, object? defaultValue) 96internal static Optional<object?> TryReadOptionValue(ISettingsManager manager, string storageKey, Type storageType, object? defaultValue) 108return manager.TryGetValue(storageKey, out int value) == GetValueResult.Success ? Enum.ToObject(storageType, value) : default(Optional<object?>); 187Optional<object?> Read<T>() 188=> manager.TryGetValue(storageKey, out T value) == GetValueResult.Success ? value : default(Optional<object?>); 190Optional<object?> ReadImmutableArray<T>() 191=> manager.TryGetValue(storageKey, out T[] value) == GetValueResult.Success ? (value is null ? default : value.ToImmutableArray()) : default(Optional<object?>);
Microsoft.VisualStudio.LanguageServices.CSharp (6)
CodeModel\MethodXml\MethodXmlBuilder.cs (2)
249var constantValue = SemanticModel.GetConstantValue(expression); 291var constantValue = SemanticModel.GetConstantValue(expression);
Options\CSharpVisualStudioOptionStorageReadFallbacks.cs (4)
31public Optional<object?> TryRead(string? language, TryReadValueDelegate readValue) 32=> TryReadFlags(s_storages, (int)CSharpFormattingOptions2.SpaceBetweenParentheses.DefaultValue, readValue, out var intValue) ? (SpacePlacementWithinParentheses)intValue : default(Optional<object?>); 55public Optional<object?> TryRead(string? language, TryReadValueDelegate readValue) 56=> TryReadFlags(s_storages, (int)CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue, readValue, out var intValue) ? (NewLineBeforeOpenBracePlacement)intValue : default(Optional<object?>);
Roslyn.VisualStudio.Next.UnitTests (14)
Options\VisualStudioSettingsOptionPersisterTests.cs (6)
186var result = VisualStudioSettingsOptionPersister.TryReadOptionValue(mockManager, "key", optionType, defaultValue); 225var result = VisualStudioSettingsOptionPersister.TryReadOptionValue(mockManager, "key", optionType, optionValue); 241Optional<object?> newValue = default; 250var result = VisualStudioSettingsOptionPersister.TryReadOptionValue(mockManager, "key", type, defaultValue: null); 279Optional<object?> newValue = default; 288var result = VisualStudioSettingsOptionPersister.TryReadOptionValue(mockManager, "key", type, defaultValue);
Options\VisualStudioStorageReadFallbackTests.cs (8)
25Assert.Equal(default(Optional<object?>), fallback.TryRead(language, (_, _, _) => default(Optional<object?>))); 32fallback.TryRead(language, (storageKey, _, _) => storageKey == "TextEditor.CSharp.Specific.SpaceWithinExpressionParentheses" ? false : default(Optional<object?>)).Value, 37fallback.TryRead(language, (storageKey, _, _) => storageKey == "TextEditor.CSharp.Specific.SpaceWithinExpressionParentheses" ? true : default(Optional<object?>)).Value, 49Assert.Equal(default(Optional<object?>), fallback.TryRead(language, (_, _, _) => default(Optional<object?>))); 56fallback.TryRead(language, (storageKey, _, _) => storageKey == "TextEditor.CSharp.Specific.NewLinesForBracesInObjectCollectionArrayInitializers" ? false : default(Optional<object?>)).Value, 61fallback.TryRead(language, (storageKey, _, _) => storageKey == "TextEditor.CSharp.Specific.NewLinesForBracesInObjectCollectionArrayInitializers" ? true : default(Optional<object?>)).Value,