1 write to Solution
Microsoft.CodeAnalysis.Workspaces (1)
Workspace\Solution\Project.cs (1)
41Solution = solution;
1113 references to Solution
AnalyzerRunner (2)
CodeRefactoringRunner.cs (2)
95document.Project.Solution, CodeAnalysisProgress.None, cancellationToken).ConfigureAwait(false); 103var changes = applyChangesOperation.ChangedSolution.GetChanges(document.Project.Solution);
IdeBenchmarks (1)
RegexClassifierBenchmarks.cs (1)
84var extensionManager = document.Project.Solution.Services.GetService<IExtensionManager>();
IdeCoreBenchmarks (1)
ProjectOperationBenchmarks.cs (1)
107var solution = Project.Solution;
Microsoft.Analyzers.Extra (3)
CallAnalysis\Fixers\LegacyLoggingFixer.cs (3)
281return (proj.Solution, cl, proj.GetDocument(cl.SyntaxTree)!); 470var solEditor = new SolutionEditor(doc.Project.Solution); 580var solEditor = new SolutionEditor(targetDoc.Project.Solution);
Microsoft.Analyzers.Extra.Tests (2)
Resources\RoslynTestUtils.cs (2)
66Assert.True(proj.Solution.Workspace.TryApplyChanges(proj.Solution));
Microsoft.Analyzers.Local.Tests (2)
Resources\RoslynTestUtils.cs (2)
66Assert.True(proj.Solution.Workspace.TryApplyChanges(proj.Solution));
Microsoft.AspNetCore.App.Analyzers.Test (3)
TestDiagnosticAnalyzer.cs (3)
32var doc = project.Solution.GetDocument(project.Documents.First().Id); 49var doc = project.Solution.GetDocument(project.Documents.First().Id); 71var document = project.Solution.GetDocument(project.Documents.First().Id);
Microsoft.AspNetCore.Components.Analyzers.Tests (2)
Helpers\CodeFixVerifier.Helper.cs (1)
82root = Formatter.Format(root, Formatter.Annotation, simplifiedDoc.Project.Solution.Workspace);
Verifiers\CodeFixVerifier.cs (1)
109document = document.WithSyntaxRoot(Formatter.Format(document.GetSyntaxRootAsync().Result, Formatter.Annotation, document.Project.Solution.Workspace));
Microsoft.AspNetCore.Components.SdkAnalyzers.Tests (2)
Helpers\CodeFixVerifier.Helper.cs (1)
82root = Formatter.Format(root, Formatter.Annotation, simplifiedDoc.Project.Solution.Workspace);
Verifiers\CodeFixVerifier.cs (1)
109document = document.WithSyntaxRoot(Formatter.Format(document.GetSyntaxRootAsync().Result, Formatter.Annotation, document.Project.Solution.Workspace));
Microsoft.CodeAnalysis.Analyzers (7)
MetaAnalyzers\Fixers\AnalyzerReleaseTrackingFix.cs (5)
108return Task.FromResult(project.Solution); 173return project.Solution; 177return project.Solution.WithAdditionalDocumentText(unshippedDataDocument.Id, newText); 191return project.Solution; 195return project.Solution.WithAdditionalDocumentText(unshippedDataDocument.Id, newText);
MetaAnalyzers\Fixers\DefineDiagnosticDescriptorArgumentsCorrectlyFix.cs (2)
165return document.WithSyntaxRoot(newRoot).Project.Solution; 175return document.Project.Solution.WithAdditionalDocumentText(fixInfo.AdditionalDocumentToFix.Id, newText);
Microsoft.CodeAnalysis.Analyzers.UnitTests (2)
MetaAnalyzers\DiagnosticDescriptorCreationAnalyzerTests.cs (2)
1655(solution, projectId) => solution.GetProject(projectId)!.WithAssemblyName(assemblyName).Solution, 1686(solution, projectId) => solution.GetProject(projectId)!.WithAssemblyName(assemblyName).Solution,
Microsoft.CodeAnalysis.CodeStyle.Fixes (54)
src\Analyzers\Core\CodeFixes\AddParameter\AddParameterService.cs (2)
89var solution = invocationDocument.Project.Solution; 218method, invocationDocument.Project.Solution, cancellationToken).ConfigureAwait(false);
src\Analyzers\Core\CodeFixes\ConvertToAsync\AbstractConvertToAsyncCodeFixProvider.cs (1)
61var otherDocument = document.Project.Solution.GetRequiredDocument(syntaxTree);
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.State.cs (2)
451document.Project.Solution, 497document.Project.Solution,
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\GenerateDefaultConstructorsCodeAction.cs (1)
41_document.Project.Solution,
src\Analyzers\Core\CodeFixes\GenerateEnumMember\AbstractGenerateEnumMemberService.CodeAction.cs (2)
24var languageServices = _document.Project.Solution.Workspace.Services.GetExtendedLanguageServices(_state.TypeToGenerateIn.Language); 34_document.Project.Solution,
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.CodeAction.cs (3)
64var syntaxFactory = _document.Project.Solution.Services.GetLanguageServices(_state.TypeToGenerateIn.Language).GetService<SyntaxGenerator>(); 72_document.Project.Solution, 88_document.Project.Solution,
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.cs (1)
51var semanticFacts = document.Project.Solution.Workspace.Services
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\TypeParameterSubstitution.cs (2)
88var solution = _project.Solution; 126var solution = _project.Solution;
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.cs (1)
47var canGenerateMember = CodeGenerator.CanAdd(document.Project.Solution, state.TypeToGenerateIn, cancellationToken);
src\Analyzers\Core\CodeFixes\ImplementAbstractClass\ImplementAbstractClassData.cs (1)
60if (!CodeGenerator.CanAdd(document.Project.Solution, classType, cancellationToken))
src\Analyzers\Core\CodeFixes\ImplementInterface\AbstractImplementInterfaceService.State.cs (1)
55if (!CodeGenerator.CanAdd(document.Project.Solution, classOrStructType, cancellationToken))
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator.cs (1)
96this.Document.Project.Solution,
src\Analyzers\Core\CodeFixes\MakeMethodAsynchronous\AbstractMakeMethodAsynchronousCodeFixProvider.cs (2)
163var solution = document.Project.Solution; 197return newDocument.Project.Solution;
src\Analyzers\Core\CodeFixes\MakeMethodSynchronous\AbstractMakeMethodSynchronousCodeFixProvider.cs (5)
77var solution = document.Project.Solution; 110var newSolution = newDocument.Project.Solution; 133methodSymbol, document.Project.Solution, cancellationToken).ConfigureAwait(false); 146document.Project.Solution, [.. referencedSymbol.Locations], cancellationToken).ConfigureAwait(false); 151return document.Project.Solution;
src\Analyzers\Core\CodeFixes\MatchFolderAndNamespace\AbstractChangeNamespaceToMatchFolderCodeFixProvider.cs (3)
27var service = context.Document.Project.Solution.Services.GetRequiredService<ISupportedChangesService>(); 63var newSolution = await renameActionSet.UpdateSolutionAsync(documentWithInvalidFolders.Project.Solution, cancellationToken).ConfigureAwait(false); 64Debug.Assert(newSolution != document.Project.Solution);
src\Analyzers\Core\CodeFixes\MatchFolderAndNamespace\AbstractChangeNamespaceToMatchFolderCodeFixProvider.CustomFixAllProvider.cs (1)
45fixAllContext.Project.Solution,
src\Analyzers\Core\CodeFixes\NamingStyle\NamingStyleCodeFixProvider.cs (1)
107document.Project.Solution, symbol, new SymbolRenameOptions(), fixedName,
src\Analyzers\Core\CodeFixes\RemoveAsyncModifier\AbstractRemoveAsyncModifierCodeFixProvider.cs (1)
67var solutionServices = document.Project.Solution.Services;
src\Analyzers\Core\CodeFixes\RemoveUnusedParametersAndValues\AbstractRemoveUnusedValuesCodeFixProvider.cs (2)
303var editor = new SyntaxEditor(root, document.Project.Solution.Services); 924var referencedSymbols = await SymbolFinder.FindReferencesAsync(local, document.Project.Solution, cancellationToken).ConfigureAwait(false);
src\Analyzers\Core\CodeFixes\UnsealClass\AbstractUnsealClassCodeFixProvider.cs (3)
43type, document.Project.Solution, cancellationToken).ConfigureAwait(false); 50c => UnsealDeclarationsAsync(document.Project.Solution, definition.DeclaringSyntaxReferences, c), 66var editor = new SyntaxEditor(root, document.Project.Solution.Services);
src\Analyzers\Core\CodeFixes\UpgradeProject\AbstractUpgradeProjectCodeFixProvider.cs (1)
44var solution = project.Solution;
src\Analyzers\Core\CodeFixes\UseConditionalExpression\AbstractUseConditionalExpressionCodeFixProvider.cs (1)
56var nestedEditor = new SyntaxEditor(root, document.Project.Solution.Services);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\ForkingSyntaxEditorBasedCodeFixProvider.cs (1)
71var solutionServices = document.Project.Solution.Services;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\SyntaxEditorBasedCodeFixProvider.cs (1)
75var editor = new SyntaxEditor(root, document.Project.Solution.Services);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (3)
93var workspace = document.Project.Solution.Workspace; 158var semanticModelService = document.Project.Solution.Services.GetRequiredService<ISemanticModelReuseWorkspaceService>(); 214var solution = document.Project.Solution;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ProjectExtensions.cs (2)
37=> project.Solution.Workspace.Services.GetExtendedLanguageServices(project.Language); 90var solutionOrProjectFilePath = project.Solution?.FilePath ?? project.FilePath;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\TextDocumentExtensions.cs (2)
51return textDocument.Project.Solution.WithAdditionalDocumentText(textDocument.Id, text, PreservationMode.PreserveIdentity).GetTextDocument(textDocument.Id)!; 60return textDocument.Project.Solution.WithAnalyzerConfigDocumentText(textDocument.Id, text, PreservationMode.PreserveIdentity).GetTextDocument(textDocument.Id)!;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\InitializeParameter\AbstractInitializerParameterService.cs (4)
108return document.Project.Solution; 124var editor = new SyntaxEditor(root, document.Project.Solution.Services); 128return newDocument.Project.Solution; 131return document.Project.Solution;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.cs (1)
84var editor = new SyntaxEditor(root, document.Project.Solution.Services);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (1)
91var findReferencesResult = await SymbolFinder.FindReferencesAsync(LocalSymbol, document.Project.Solution, cancellationToken).ConfigureAwait(false);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Workspace\Host\SupportedChangesServiceExtensions.cs (1)
13=> project.Solution.Services.GetRequiredService<ISupportedChangesService>().CanApplyParseOptionChange(oldOptions, newOptions, project);
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (20)
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (1)
91var solutionEditor = new SolutionEditor(document.Project.Solution);
src\Analyzers\CSharp\CodeFixes\InlineDeclaration\CSharpInlineDeclarationCodeFixProvider.cs (1)
106var editor = new SyntaxEditor(currentRoot, document.Project.Solution.Services);
src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\MakeLocalFunctionStaticCodeFixHelper.cs (3)
33var syntaxEditor = new SyntaxEditor(root, document.Project.Solution.Services); 52localFunctionSymbol, document.Project.Solution, documentImmutableSet, cancellationToken).ConfigureAwait(false); 124capture, document.Project.Solution, documentImmutableSet, cancellationToken).ConfigureAwait(false);
src\Analyzers\CSharp\CodeFixes\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementCodeFixProvider.cs (1)
49var editor = new SyntaxEditor(root, document.Project.Solution.Services);
src\Analyzers\CSharp\CodeFixes\RemoveConfusingSuppression\CSharpRemoveConfusingSuppressionCodeFixProvider.cs (1)
63var editor = new SyntaxEditor(root, document.Project.Solution.Services);
src\Analyzers\CSharp\CodeFixes\UpdateProjectToAllowUnsafe\CSharpUpdateProjectToAllowUnsafeCodeFixProvider.cs (1)
42return project.Solution.WithProjectCompilationOptions(project.Id, compilationOptions.WithAllowUnsafe(true));
src\Analyzers\CSharp\CodeFixes\UpgradeProject\CSharpUpgradeProjectCodeFixProvider.cs (2)
94return project.Solution.WithProjectParseOptions(project.Id, parseOptions.WithLanguageVersion(parsedNewVersion)); 99return project.Solution;
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpUseCollectionExpressionForArrayCodeFixProvider.cs (1)
41var services = document.Project.Solution.Services;
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpUseCollectionExpressionForBuilderCodeFixProvider.cs (1)
74var subEditor = new SyntaxEditor(root, document.Project.Solution.Services);
src\Analyzers\CSharp\CodeFixes\UseDeconstruction\CSharpUseDeconstructionCodeFixProvider.cs (1)
63var editor = new SyntaxEditor(root, document.Project.Solution.Services);
src\Analyzers\CSharp\CodeFixes\UseLocalFunction\CSharpUseLocalFunctionCodeFixProvider.cs (1)
109document.Project.Solution.Services, currentRoot,
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (2)
102var solutionEditor = new SolutionEditor(document.Project.Solution); 118var solution = document.Project.Solution;
src\Analyzers\CSharp\CodeFixes\UseSystemThreadingLock\CSharpUseSystemThreadingLockCodeFixProvider.cs (2)
67var solutionEditor = new SolutionEditor(document.Project.Solution); 82var solution = document.Project.Solution;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpReplaceDiscardDeclarationsWithAssignmentsService.cs (1)
42var editor = new SyntaxEditor(memberDeclaration, document.Project.Solution.Services);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (1)
40var solution = project.Solution;
Microsoft.CodeAnalysis.CSharp.EditorFeatures (7)
EventHookup\EventHookupCommandHandler_TabKeyCommand.cs (3)
147var factory = document.Project.Solution.Workspace.Services.GetRequiredService<IBackgroundWorkIndicatorFactory>(); 172var workspace = document.Project.Solution.Workspace; 222var newSolution = document.Project.Solution.WithDocumentText(formattedDocument.Id, newText);
EventHookup\EventHookupCommandHandler_TypeCharCommand.cs (1)
50if (document != null && document.Project.Solution.Workspace.CanApplyChange(ApplyChangesKind.ChangeDocument))
Formatting\CSharpFormattingInteractionService.cs (1)
88return Task.FromResult(Formatter.GetFormattedTextChanges(parsedDocument.Root, [formattingSpan], document.Project.Solution.Services, options, cancellationToken).ToImmutableArray());
StringCopyPaste\StringCopyPasteCommandHandler.cs (1)
215var copyPasteService = documentBeforePaste.Project.Solution.Services.GetRequiredService<IStringCopyPasteService>();
StringCopyPaste\StringCopyPasteCommandHandler_CutCopy.cs (1)
57var copyPasteService = document.Project.Solution.Services.GetService<IStringCopyPasteService>();
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (16)
CodeActions\ApplyChangesOperationTests.cs (1)
36var codeAction = new TestCodeAction(_changeSolution(context.Document.Project.Solution));
CodeActions\MoveType\MoveTypeTests.MoveScope.cs (2)
927Assert.NotEqual(documentToModify.Project.Solution, modifiedSolution); 931Assert.Equal(documentToModify.Project.Solution, modifiedSolution);
CodeActions\PreviewExceptionTests.cs (1)
114extensionManager = document.Project.Solution.Services.GetService<IExtensionManager>() as EditorLayerExtensionManager.ExtensionManager;
CodeActions\PreviewTests.cs (1)
70var solution = _oldDocument.Project.Solution;
Completion\CompletionProviders\OverrideCompletionProviderTests.cs (2)
3986await workspace.ChangeSolutionAsync(updatedP1.Solution); 4044await workspace.ChangeSolutionAsync(updatedProject.Solution);
Completion\CompletionServiceTests.cs (1)
210Assert.True(workspace.SetCurrentSolution(_ => project.Solution, WorkspaceChangeKind.SolutionChanged));
Formatting\CodeCleanupTests.cs (2)
802project = project.Solution.WithProjectFilePath(project.Id, @$"z:\\{project.FilePath}").GetProject(project.Id); 804workspace.TryApplyChanges(project.Solution);
PdbSourceDocument\AbstractPdbSourceDocumentTests.cs (2)
126using var workspace = (EditorTestWorkspace)project.Solution.Workspace; 265var compilationFactory = project.Solution.Services.GetRequiredLanguageService<ICompilationFactoryService>(LanguageNames.CSharp);
Workspaces\WorkspaceTests_EditorFeatures.cs (4)
1321workspace.TryApplyChanges(doc.Project.Solution); 1328workspace.TryApplyChanges(project.RemoveAdditionalDocument(doc.Id).Solution); 1349workspace.TryApplyChanges(doc.Project.Solution); 1356workspace.TryApplyChanges(project.RemoveAnalyzerConfigDocument(doc.Id).Solution);
Microsoft.CodeAnalysis.CSharp.Features (40)
ChangeSignature\CSharpChangeSignatureService.cs (1)
893convertedType = await SymbolFinder.FindSourceDefinitionAsync(convertedType, document.Project.Solution, cancellationToken).ConfigureAwait(false)
CodeRefactorings\EnableNullable\EnableNullableCodeRefactoringProvider.cs (1)
71var solution = project.Solution;
CodeRefactorings\InlineTemporary\InlineTemporaryCodeRefactoringProvider.cs (1)
218var editor = new SyntaxEditor(scope, document.Project.Solution.Services);
CodeRefactorings\SyncNamespace\CSharpChangeNamespaceService.cs (2)
44if (document.Project.Solution.WorkspaceKind == WorkspaceKind.MiscellaneousFiles 70document.Project.Solution, allDocumentIds, containerSpan, cancellationToken).ConfigureAwait(false);
CodeRefactorings\UseExplicitOrImplicitType\AbstractUseTypeCodeRefactoringProvider.cs (1)
121var editor = new SyntaxEditor(root, document.Project.Solution.Services);
Completion\CompletionProviders\SnippetCompletionProvider.cs (3)
84var solution = document.Project.Solution; 144completionContext, document.Project.Solution.Services, semanticModel, isPreProcessorContext: true); 160completionContext, document.Project.Solution.Services, semanticModel, isPreProcessorContext: false);
ConvertPrimaryToRegularConstructor\ConvertPrimaryToRegularConstructorCodeRefactoringProvider.cs (1)
97var solution = document.Project.Solution;
ConvertToExtension\ConvertToExtensionFixAllProvider.cs (1)
40var editor = new SyntaxEditor(root, document.Project.Solution.Services);
Copilot\CSharpImplementNotImplementedExceptionFixProvider.cs (1)
99var references = await SymbolFinder.FindReferencesAsync(memberSymbol, document.Project.Solution, searchOptions, cancellationToken).ConfigureAwait(false);
EncapsulateField\CSharpEncapsulateFieldService.cs (1)
107document.Project.Solution,
Formatting\CSharpAccessibilityModifiersNewDocumentFormattingProvider.cs (1)
42var editor = new SyntaxEditor(root, document.Project.Solution.Services);
ImplementInterface\AbstractChangeImplementationCodeRefactoringProvider.cs (1)
212var solution = project.Solution;
ImplementInterface\CSharpImplementExplicitlyCodeRefactoringProvider.cs (1)
43var solution = project.Solution;
InitializeParameter\CSharpInitializeMemberFromPrimaryConstructorParameterCodeRefactoringProvider_Update.cs (2)
40var currentSolution = document.WithSyntaxRoot(trackedRoot).Project.Solution; 80var solution = project.Solution;
NavigationBar\CSharpNavigationBarItemService.cs (1)
57return GetMembersInTypes(document.Project.Solution, semanticModel.SyntaxTree, typesInFile, cancellationToken);
QuickInfo\CSharpDiagnosticAnalyzerQuickInfoProvider.cs (1)
134var hostAnalyzers = document.Project.Solution.SolutionState.Analyzers;
QuickInfo\CSharpSemanticQuickInfoProvider.cs (1)
196var solution = document.Project.Solution;
ReverseForStatement\CSharpReverseForStatementCodeRefactoringProvider.cs (1)
271var editor = new SyntaxEditor(root, document.Project.Solution.Services);
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (1)
91var solutionEditor = new SolutionEditor(document.Project.Solution);
src\Analyzers\CSharp\CodeFixes\InlineDeclaration\CSharpInlineDeclarationCodeFixProvider.cs (1)
106var editor = new SyntaxEditor(currentRoot, document.Project.Solution.Services);
src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\MakeLocalFunctionStaticCodeFixHelper.cs (3)
33var syntaxEditor = new SyntaxEditor(root, document.Project.Solution.Services); 52localFunctionSymbol, document.Project.Solution, documentImmutableSet, cancellationToken).ConfigureAwait(false); 124capture, document.Project.Solution, documentImmutableSet, cancellationToken).ConfigureAwait(false);
src\Analyzers\CSharp\CodeFixes\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementCodeFixProvider.cs (1)
49var editor = new SyntaxEditor(root, document.Project.Solution.Services);
src\Analyzers\CSharp\CodeFixes\RemoveConfusingSuppression\CSharpRemoveConfusingSuppressionCodeFixProvider.cs (1)
63var editor = new SyntaxEditor(root, document.Project.Solution.Services);
src\Analyzers\CSharp\CodeFixes\UpdateProjectToAllowUnsafe\CSharpUpdateProjectToAllowUnsafeCodeFixProvider.cs (1)
42return project.Solution.WithProjectCompilationOptions(project.Id, compilationOptions.WithAllowUnsafe(true));
src\Analyzers\CSharp\CodeFixes\UpgradeProject\CSharpUpgradeProjectCodeFixProvider.cs (2)
94return project.Solution.WithProjectParseOptions(project.Id, parseOptions.WithLanguageVersion(parsedNewVersion)); 99return project.Solution;
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpUseCollectionExpressionForArrayCodeFixProvider.cs (1)
41var services = document.Project.Solution.Services;
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpUseCollectionExpressionForBuilderCodeFixProvider.cs (1)
74var subEditor = new SyntaxEditor(root, document.Project.Solution.Services);
src\Analyzers\CSharp\CodeFixes\UseDeconstruction\CSharpUseDeconstructionCodeFixProvider.cs (1)
63var editor = new SyntaxEditor(root, document.Project.Solution.Services);
src\Analyzers\CSharp\CodeFixes\UseLocalFunction\CSharpUseLocalFunctionCodeFixProvider.cs (1)
109document.Project.Solution.Services, currentRoot,
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (2)
102var solutionEditor = new SolutionEditor(document.Project.Solution); 118var solution = document.Project.Solution;
src\Analyzers\CSharp\CodeFixes\UseSystemThreadingLock\CSharpUseSystemThreadingLockCodeFixProvider.cs (2)
67var solutionEditor = new SolutionEditor(document.Project.Solution); 82var solution = document.Project.Solution;
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (2)
EditAndContinue\CSharpEditAndContinueAnalyzerTests.cs (2)
45AddDocument("test.cs", SourceText.From(source, Encoding.UTF8), filePath: Path.Combine(TempRoot.Root, "test.cs")).Project.Solution; 465AddDocument("test.cs", root, filePath: Path.Combine(TempRoot.Root, "test.cs")).Project.Solution;
Microsoft.CodeAnalysis.CSharp.Workspaces (2)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpReplaceDiscardDeclarationsWithAssignmentsService.cs (1)
42var editor = new SyntaxEditor(memberDeclaration, document.Project.Solution.Services);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (1)
40var solution = project.Solution;
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (3)
CodeGeneration\SymbolEditorTests.cs (1)
45return ws.AddProject(proj).Solution;
Formatting\FormattingTreeEditTests.cs (2)
46var result1 = Formatter.Format(root1, document.Project.Solution.Services, options, CancellationToken.None); 59var result2 = Formatter.Format(root2, document.Project.Solution.Services, options, CancellationToken.None);
Microsoft.CodeAnalysis.EditorFeatures (68)
AddImports\AbstractAddImportsPasteCommandHandler.cs (2)
136var indicatorFactory = document.Project.Solution.Services.GetRequiredService<IBackgroundWorkIndicatorFactory>(); 165document.Project.Solution.Workspace.TryApplyChanges(updatedDocument.Project.Solution);
ChangeSignature\AbstractChangeSignatureCommandHandler.cs (1)
92HandleResult(result, document.Project.Solution, workspace, context);
CodeDefinitionWindow\DefinitionContextTracker.cs (3)
146var workspace = document.Project.Solution.Workspace; 156var text = await item.Document.GetTextAsync(document.Project.Solution, cancellationToken).ConfigureAwait(false); 175var definitionItem = symbol.ToNonClassifiedDefinitionItem(document.Project.Solution, includeHiddenLocations: false);
CommentSelection\AbstractCommentSelectionBase.cs (1)
154var formattedChanges = Formatter.GetFormattedTextChanges(newRoot, formattingSpans, document.Project.Solution.Services, formattingOptions, rules: default, cancellationToken);
Copilot\CopilotWpfTextCreationListener.cs (1)
129var changeAnalysisService = document.Project.Solution.Services.GetRequiredService<ICopilotChangeAnalysisService>();
EditAndContinue\ActiveStatementTrackingService.cs (2)
172var compileTimeSolution = _compileTimeSolutionProvider.GetCompileTimeSolution(designTimeDocument.Project.Solution); 356var solution = document.Project.Solution;
EditAndContinue\PdbMatchingSourceTextProvider.cs (1)
87var oldSolutionVersion = oldDocument.Project.Solution.WorkspaceVersion;
EncapsulateField\AbstractEncapsulateFieldCommandHandler.cs (2)
65var workspace = initialDocument.Project.Solution.Workspace; 105var solution = document.Project.Solution;
Extensibility\NavigationBar\AbstractEditorNavigationBarItemService.cs (1)
47var workspace = document.Project.Solution.Workspace;
ExternalAccess\IntelliCode\IntentProcessor.cs (2)
93newSolution = await newSolution.WithMergedLinkedFileChangesAsync(originalDocument.Project.Solution, cancellationToken: cancellationToken).ConfigureAwait(false); 99var docChanges = await GetTextChangesForDocumentAsync(newSolution, currentDocument.Project.Solution, changedDocumentId, cancellationToken).ConfigureAwait(false);
ExternalAccess\VSTypeScript\VSTypeScriptNavigationBarItemService.cs (1)
59var workspace = document.Project.Solution.Workspace;
ExtractInterface\AbstractExtractInterfaceCommandHandler.cs (1)
79if (!document.Project.Solution.Workspace.TryApplyChanges(result.UpdatedSolution))
ExtractMethod\ExtractMethodCommandHandler.cs (2)
116var indicatorFactory = document.Project.Solution.Services.GetRequiredService<IBackgroundWorkIndicatorFactory>(); 224var notificationService = document.Project.Solution.Services.GetService<INotificationService>();
Formatting\FormatCommandHandler.cs (1)
83var ruleFactory = document.Project.Solution.Services.GetRequiredService<IHostDependentFormattingRuleFactoryService>();
Formatting\FormatCommandHandler.Paste.cs (1)
65var solution = document.Project.Solution;
GoToDefinition\AbstractGoToCommandHandler`2.cs (2)
191document.Project.Solution.Workspace, 262var service = document.Project.Solution.Services.GetRequiredService<IWorkspaceStatusService>();
GoToDefinition\GoToDefinitionCommandHandler.cs (2)
103var indicatorFactory = document.Project.Solution.Services.GetRequiredService<IBackgroundWorkIndicatorFactory>(); 142var notificationService = document.Project.Solution.Services.GetRequiredService<INotificationService>();
InlineRename\AbstractEditorInlineRenameService.SymbolRenameInfo.cs (3)
134var solution = this.Document.Project.Solution; 156this.Document.Project.Solution.CanApplyChange(ApplyChangesKind.ChangeDocumentInfo)) 166var symbolSourceDocument = this.Document.Project.Solution.GetDocument(RenameSymbol.Locations.Single().SourceTree);
InlineRename\InlineRenameService.cs (2)
107document.Project.Solution.Workspace, 127var workspace = document.Project.Solution.Workspace;
InlineRename\InlineRenameSession.cs (1)
191_baseSolution = TriggerDocument.Project.Solution;
InlineRename\InlineRenameSession.OpenTextBufferManager.cs (2)
573var textDiffService = oldDocument.Project.Solution.Services.GetService<IDocumentTextDifferencingService>(); 591var textDiffService = preMergeDocument.Project.Solution.Services.GetService<IDocumentTextDifferencingService>();
IntelliSense\AsyncCompletion\CompletionSource.cs (3)
170document.Project, document.Project.Services, sourceText, triggerLocation.Position, roslynTrigger, options, document.Project.Solution.Options, _roles); 395document, triggerLocation, options, document.Project.Solution.Options, roslynTrigger, _roles, cancellationToken).ConfigureAwait(false); 537var supportedPlatforms = SymbolCompletionItem.GetSupportedPlatforms(roslynItem, document.Project.Solution);
Intents\DeleteParameterIntentProvider.cs (1)
61var changedDocuments = changeSignatureResult.UpdatedSolution.GetChangedDocuments(priorDocument.Project.Solution).ToImmutableArray();
Interactive\InteractiveSession.cs (2)
248solution = initProject.Solution.AddDocument( 255solution = newSubmissionProject.Solution.AddDocument(
NavigableSymbols\NavigableSymbolService.NavigableSymbolSource.cs (1)
49var indicatorFactory = document.Project.Solution.Services.GetRequiredService<IBackgroundWorkIndicatorFactory>();
Navigation\AbstractDefinitionLocationService.cs (2)
32var solution = document.Project.Solution; 131var solution = project.Solution;
NavigationBar\NavigationBarController.cs (1)
251workspace: d.Project.Solution.Workspace,
Peek\PeekableItemFactory.cs (1)
60var solution = project.Solution;
Peek\PeekableItemSource.cs (3)
74var services = document.Project.Solution.Services; 126var workspace = project.Solution.Workspace; 135var text = await document.GetTextAsync(project.Solution, cancellationToken).ConfigureAwait(false);
Preview\AbstractPreviewFactoryService.cs (6)
289using var rightWorkspace = new ReferenceCountedDisposable<PreviewWorkspace>(new PreviewWorkspace(document.Project.Solution)); 371using var leftWorkspace = new ReferenceCountedDisposable<PreviewWorkspace>(new PreviewWorkspace(document.Project.Solution)); 486var leftSolution = oldDocument.Project.Solution; 493var rightSolution = newDocument.Project.Solution; 553using var leftWorkspace = new ReferenceCountedDisposable<PreviewWorkspace>(new PreviewWorkspace(oldDocument.Project.Solution)); 556using var rightWorkspace = new ReferenceCountedDisposable<PreviewWorkspace>(new PreviewWorkspace(newDocument.Project.Solution));
QuickInfo\ContentControlService.cs (1)
70var workspace = new PreviewWorkspace(document.Project.Solution);
QuickInfo\Extensions.cs (1)
38var cloneServices = document.Project.Solution.Services.ExportProvider.GetExports<ITextBufferCloneService>();
RenameTracking\RenameTrackingCancellationCommandHandler.cs (1)
41RenameTrackingDismisser.DismissVisibleRenameTracking(document.Project.Solution.Workspace, document.Id);
RenameTracking\RenameTrackingTaggerProvider.RenameTrackingCodeAction.cs (1)
94_document.Project.Solution.Services.GetService<INotificationService>()
RenameTracking\RenameTrackingTaggerProvider.RenameTrackingCommitter.cs (2)
129var workspace = document.Project.Solution.Workspace; 198var solution = document.Project.Solution;
RenameTracking\RenameTrackingTaggerProvider.StateMachine.cs (1)
238var service = document.Project.Solution.Services.GetRequiredService<IDiagnosticAnalyzerService>();
RenameTracking\RenameTrackingTaggerProvider.TrackingSession.cs (2)
224var sourceSymbol = await SymbolFinder.FindSourceDefinitionAsync(symbol, document.Project.Solution, _cancellationToken).ConfigureAwait(false) ?? symbol; 238var sourceSymbol = await SymbolFinder.FindSourceDefinitionAsync(symbol, document.Project.Solution, _cancellationToken).ConfigureAwait(false) ?? symbol;
SignatureHelp\Controller.cs (1)
134_providers = [.. document.Project.Solution.Services.SelectMatchingExtensionValues(
SpellCheck\RoslynSpellCheckFixerProvider.cs (1)
109var workspace = document.Project.Solution.Workspace;
Structure\AbstractStructureTaggerProvider.cs (1)
74if (openDocument.Project.Solution.Workspace is MetadataAsSourceWorkspace masWorkspace &&
Suggestions\SuggestedActionsSource_Async.cs (1)
210var workspace = document.Project.Solution.Workspace;
Suggestions\SuggestedActionWithNestedFlavors.cs (1)
51originalDocument.Project.Solution,
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (7)
Completion\AbstractCompletionProviderTests.cs (3)
660document.Project.Solution.Workspace.TryApplyChanges(newDoc.Project.Solution); 1292var isTextualTriggerCharacterResult = service.ShouldTriggerCompletion(document.Project, document.Project.Services, text, position + 1, trigger, options, document.Project.Solution.Options, GetRoles(document));
Diagnostics\GenerateType\GenerateTypeTestState.cs (2)
67return (TestGenerateTypeOptionsService)InvocationDocument.Project.Solution.Services.GetRequiredService<IGenerateTypeOptionsService>(); 75return (TestProjectManagementService)InvocationDocument.Project.Solution.Services.GetService<IProjectManagementService>();
Diagnostics\GenerateType\TestGenerateTypeOptionsService.cs (1)
55DefaultNamespace ??= projectManagementService.GetDefaultNamespace(Project, Project?.Solution.Workspace);
ExtractInterface\ExtractInterfaceTestState.cs (1)
72return (TestExtractInterfaceOptionsService)ExtractFromDocument.Project.Solution.Services.GetService<IExtractInterfaceOptionsService>();
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (27)
CodeFixes\CodeFixServiceTests.cs (4)
388extensionManager = (EditorLayerExtensionManager.ExtensionManager)document.Project.Solution.Services.GetRequiredService<IExtensionManager>(); 876var solution = await codeAction.GetChangedSolutionInternalAsync(txtDocument.Project.Solution, CodeAnalysisProgress.None); 934return document.Project.Solution.WithAdditionalDocumentText(document.Id, newText); 1065var appliedChanges = workspace.TryApplyChanges(sourceDocument.Project.Solution);
CodeRefactorings\CodeRefactoringServiceTest.cs (5)
108var extensionManager = (EditorLayerExtensionManager.ExtensionManager)document.Project.Solution.Services.GetRequiredService<IExtensionManager>(); 180var solution = await codeAction.GetChangedSolutionInternalAsync(project.Solution, CodeAnalysisProgress.None); 219var solution = await codeAction.GetChangedSolutionInternalAsync(project.Solution, CodeAnalysisProgress.None); 248return document.Project.Solution.WithAdditionalDocumentText(document.Id, newText); 249return document.Project.Solution.WithAnalyzerConfigDocumentText(document.Id, newText);
Diagnostics\DiagnosticAnalyzerServiceTests.cs (4)
174var applied = workspace.TryApplyChanges(document.Project.Solution); 385var applied = workspace.TryApplyChanges(project.Solution); 683workspace.TryApplyChanges(project.Solution); 794Assert.True(workspace.TryApplyChanges(workspace.CurrentSolution.Projects.Single().AddAnalyzerReference(new TestGeneratorReference(generator)).Solution));
Diagnostics\DiagnosticDataTests.cs (3)
265secondDocument = firstDocument.Project.Solution.AddProject("TestProject2", "TestProject2", LanguageNames.CSharp) 273firstDocument = secondDocument.Project.Solution.GetRequiredDocument(firstDocument.Id); 297firstDocument = firstDocument.Project.Solution
LinkedFiles\LinkedFileDiffMergingEditorTests.cs (2)
103var linkedDocument = document.Project.Solution.Projects.Single(p => p != document.Project).Documents.Single(); 107var newSolution = document.Project.Solution
Preview\PreviewWorkspaceTests.cs (6)
56Assert.True(previewWorkspace.TryApplyChanges(project.Solution)); 70Assert.True(previewWorkspace.TryApplyChanges(project.Solution)); 74.AddDocument("document", "").Project.Solution; 80var changedSolution = previewWorkspace.CurrentSolution.Projects.First().Documents.First().WithText(SourceText.From(text)).Project.Solution; 86.RemoveDocument(previewWorkspace.CurrentSolution.Projects.First().DocumentIds[0]).Solution; 102Assert.True(previewWorkspace.TryApplyChanges(document.Project.Solution));
SymbolFinder\SymbolFinderTests.cs (1)
866.Project.Solution.WithFrozenPartialCompilations(CancellationToken.None);
TextEditor\OpenDocumentTests.cs (2)
64Assert.Same(workspace.CurrentSolution, newDocumentWithChanges.Project.Solution); 70Assert.NotSame(workspace.CurrentSolution, originalDocumentWithChanges.Project.Solution);
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (2)
Diagnostics\DiagnosticServiceTests.vb (1)
1429Dim descriptorsMap = project.Solution.SolutionState.Analyzers.GetDiagnosticDescriptorsPerReference(diagnosticService.AnalyzerInfoCache, project)
FindReferences\FindReferencesTests.vb (1)
386Function(g) GetFilePathAndProjectLabel(document.Project.Solution, g.Key),
Microsoft.CodeAnalysis.ExternalAccess.Extensions (1)
Internal\ExtensionDocumentMessageHandlerWrapper.cs (1)
17=> (Task)executeAsyncMethod.Invoke(handler, [message, new ExtensionMessageContext(argument.Project.Solution), argument, cancellationToken]);
Microsoft.CodeAnalysis.ExternalAccess.FSharp (1)
Internal\Editor\FSharpNavigationBarItemService.cs (1)
69var workspace = document.Project.Solution.Workspace;
Microsoft.CodeAnalysis.ExternalAccess.OmniSharp (3)
Completion\OmniSharpCompletionService.cs (2)
25return completionService.ShouldTriggerCompletion(document.Project, document.Project.Services, text, caretPosition, trigger, options.ToCompletionOptions(), document.Project.Solution.Options, roles); 37return completionService.GetCompletionsAsync(document, caretPosition, options.ToCompletionOptions(), document.Project.Solution.Options, trigger, roles, cancellationToken);
GoToDefinition\OmniSharpFindDefinitionService.cs (1)
25document.Project.Solution,
Microsoft.CodeAnalysis.ExternalAccess.Razor.Features (20)
Cohost\Handlers\CodeActions.cs (2)
24var solution = document.Project.Solution; 45var solution = document.Project.Solution;
Cohost\Handlers\Completion.cs (3)
41var globalOptions = document.Project.Solution.Services.ExportProvider.GetService<IGlobalOptionService>(); 63var globalOptions = document.Project.Solution.Services.ExportProvider.GetService<IGlobalOptionService>(); 79var xmlSnippetParser = document.Project.Solution.Services.ExportProvider.GetService<XmlSnippetParser>();
Cohost\Handlers\Diagnostics.cs (1)
20var solutionServices = document.Project.Solution.Services;
Cohost\Handlers\DocumentHighlights.cs (2)
19var globalOptions = document.Project.Solution.Services.ExportProvider.GetService<IGlobalOptionService>(); 20var highlightingService = document.Project.Solution.Services.ExportProvider.GetService<IHighlightingService>();
Cohost\Handlers\FindAllReferences.cs (2)
22var globalOptions = document.Project.Solution.Services.ExportProvider.GetService<IGlobalOptionService>(); 23var metadataAsSourceFileService = document.Project.Solution.Services.ExportProvider.GetService<IMetadataAsSourceFileService>();
Cohost\Handlers\FoldingRanges.cs (1)
19var globalOptions = document.Project.Solution.Services.ExportProvider.GetService<IGlobalOptionService>();
Cohost\Handlers\GoToDefinition.cs (2)
20var globalOptions = document.Project.Solution.Services.ExportProvider.GetService<IGlobalOptionService>(); 21var metadataAsSourceFileService = document.Project.Solution.Services.ExportProvider.GetService<IMetadataAsSourceFileService>();
Cohost\Handlers\GoToImplementation.cs (1)
20var globalOptions = document.Project.Solution.Services.ExportProvider.GetService<IGlobalOptionService>();
Cohost\Handlers\Hover.cs (1)
23var globalOptions = document.Project.Solution.Services.ExportProvider.GetService<IGlobalOptionService>();
Cohost\Handlers\OnAutoInsert.cs (2)
22var globalOptions = document.Project.Solution.Services.ExportProvider.GetService<IGlobalOptionService>(); 23var services = document.Project.Solution.Services.ExportProvider.GetExports<IBraceCompletionService, LanguageMetadata>().Where(s => s.Metadata.Language == LanguageNames.CSharp).SelectAsArray(s => s.Value);
Cohost\Handlers\SignatureHelp.cs (1)
18var signatureHelpService = document.Project.Solution.Services.ExportProvider.GetService<SignatureHelpService>();
RazorClassifierAccessor.cs (1)
20document.Project.Solution.Services, document.Project, semanticModel, textSpan, options.UnderlyingObject, cancellationToken);
RazorCSharpFormattingInteractionService.cs (1)
50var formattingOptions = GetFormattingOptions(document.Project.Solution.Services, indentationOptions);
Microsoft.CodeAnalysis.ExternalAccess.Xaml (4)
Internal\DescriptionService.cs (1)
66var services = project.Solution.Services;
Internal\LocationService.cs (3)
49var items = NavigableItemFactory.GetItemsFromPreferredSourceLocations(project.Solution, symbol, displayTaggedParts: null, cancellationToken); 54var document = await item.Document.GetRequiredDocumentAsync(project.Solution, cancellationToken).ConfigureAwait(false); 64var declarationFile = await _metadataAsSourceFileService.GetGeneratedFileAsync(project.Solution.Workspace, project, symbol, signaturesOnly: true, options: options, cancellationToken: cancellationToken).ConfigureAwait(false);
Microsoft.CodeAnalysis.Features (266)
AddConstructorParametersFromMembers\AddConstructorParametersFromMembersCodeRefactoringProvider.AddConstructorParametersCodeAction.cs (2)
50var services = _document.Project.Solution.Services; 69return Task.FromResult<Solution?>(constructorDocument.WithSyntaxRoot(newRoot).Project.Solution);
AddConstructorParametersFromMembers\AddConstructorParametersFromMembersCodeRefactoringProvider.cs (1)
186priorDocument.Project.Solution, CodeAnalysisProgress.None, postProcessChanges: true, cancellationToken).ConfigureAwait(false);
AddDebuggerDisplay\AbstractAddDebuggerDisplayCodeRefactoringProvider.cs (1)
118var editor = new SyntaxEditor(syntaxRoot, document.Project.Solution.Services);
AddImport\AbstractAddImportCodeFixProvider.cs (1)
58var services = document.Project.Solution.Services;
AddImport\AbstractAddImportFeatureService.cs (7)
73document.Project.Solution, 145var projectToAssembly = new ConcurrentDictionary<Project, AsyncLazy<IAssemblySymbol>>(concurrencyLevel: 2, capacity: project.Solution.ProjectIds.Count); 146var referenceToCompilation = new ConcurrentDictionary<PortableExecutableReference, Compilation>(concurrencyLevel: 2, capacity: project.Solution.Projects.Sum(p => p.MetadataReferences.Count)); 167=> project.Solution.WorkspaceKind is WorkspaceKind.Host or WorkspaceKind.RemoteWorkspace; 326var solution = project.Solution; 456var solution = project.Solution; 546document.Project.Solution,
AddImport\CodeActions\AssemblyReferenceCodeAction.cs (2)
46var operation = new ApplyChangesOperation(newProject.Solution); 101return new ApplyChangesOperation(newProject.Solution);
AddImport\CodeActions\InstallPackageAndAddImportCodeAction.cs (2)
57this.OriginalDocument.Project.Solution, cancellationToken).ConfigureAwait(false)); 73return updatedDocument.Project.Solution;
AddImport\CodeActions\MetadataSymbolReferenceCodeAction.cs (2)
30var projectWithReference = project.Solution.GetRequiredProject(FixData.PortableExecutableReferenceProjectId); 35return Task.FromResult<CodeActionOperation?>(new ApplyChangesOperation(project.AddMetadataReference(reference).Solution));
AddImport\CodeActions\ProjectSymbolReferenceCodeAction.cs (1)
46var applyOperation = new ApplyChangesOperation(projectWithAddedReference.Solution);
AddImport\CodeActions\SymbolReference.SymbolReferenceCodeAction.cs (1)
58return updatedProject ?? new ApplyChangesOperation(updatedDocument.Project.Solution);
AddImport\SearchScopes\MetadataSymbolsSearchScope.cs (1)
38var service = _assemblyProject.Solution.Services.GetRequiredService<ISymbolTreeInfoCacheService>();
AddImport\SearchScopes\SourceSymbolsProjectSearchScope.cs (1)
32var service = _project.Solution.Services.GetRequiredService<ISymbolTreeInfoCacheService>();
AddMissingReference\AddMissingReferenceCodeAction.cs (2)
31var dependencyGraph = project.Solution.GetProjectDependencyGraph(); 52var candidateProject = project.Solution.GetRequiredProject(candidateProjectId);
AddPackage\AbstractAddPackageCodeFixProvider.cs (1)
34var workspaceServices = document.Project.Solution.Services;
AddPackage\InstallPackageDirectlyCodeActionOperation.cs (1)
52_document.Project.Solution, packageName, versionOpt).ToList();
ChangeSignature\AbstractChangeSignatureService.cs (2)
110symbol = await SymbolFinder.FindSourceDefinitionAsync(symbol, document.Project.Solution, cancellationToken).ConfigureAwait(false) ?? symbol; 161var solution = document.Project.Solution;
ChangeSignature\ChangeSignatureAnalyzedContext.cs (1)
19public Solution Solution => Document.Project.Solution;
CodeFixes\Configuration\ConfigurationUpdater.cs (8)
258return currentProject.Solution; 267return _project.Solution; 270var solution = editorConfigDocument.Project.Solution; 294if (_project.Solution?.FilePath == null) 304var currentSolution = _project.Solution; 305foreach (var projectId in _project.Solution.ProjectIds) 314currentSolution = addedAnalyzerConfigDocument.Project.Solution; 336var newSolution = project.Solution.AddAnalyzerConfigDocuments([documentInfo]);
CodeFixes\Service\CodeFixService.cs (12)
108var service = document.Project.Solution.Services.GetRequiredService<IDiagnosticAnalyzerService>(); 200var service = document.Project.Solution.Services.GetRequiredService<IDiagnosticAnalyzerService>(); 232if (document.Project.Solution.WorkspaceKind != WorkspaceKind.Interactive && includeSuppressionFixes) 302var service = document.Project.Solution.Services.GetRequiredService<IDiagnosticAnalyzerService>(); 358var fixAllService = document.Project.Solution.Services.GetRequiredService<IFixAllGetFixesService>(); 371var workspaceFixersMap = GetFixerPerLanguageMap(document.Project.Solution.Services); 397var fixersPriorityByLanguageMap = GetFixerPriorityPerLanguageMap(document.Project.Solution.Services); 464var isInteractive = document.Project.Solution.WorkspaceKind == WorkspaceKind.Interactive; 507var extensionManager = document.Project.Solution.Services.GetService<IExtensionManager>(); 767var extensionManager = textDocument.Project.Solution.Services.GetRequiredService<IExtensionManager>(); 972return document.Project.Solution.WorkspaceKind == WorkspaceKind.Interactive 979var extensionManager = document.Project.Solution.Services.GetService<IExtensionManager>();
CodeFixes\Service\CodeFixService.FixAllDiagnosticProvider.cs (4)
46var service = document.Project.Solution.Services.GetRequiredService<IDiagnosticAnalyzerService>(); 57var service = document.Project.Solution.Services.GetRequiredService<IDiagnosticAnalyzerService>(); 69var service = project.Solution.Services.GetRequiredService<IDiagnosticAnalyzerService>(); 78var service = project.Solution.Services.GetRequiredService<IDiagnosticAnalyzerService>();
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.AbstractGlobalSuppressMessageCodeAction.cs (1)
37new ApplyChangesOperation(changedSuppressionDocument.Project.Solution),
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.GlobalSuppressMessageFixAllCodeAction.cs (2)
73var currentSolution = triggerDocument.Project.Solution; 102var currentSolution = triggerProject.Solution;
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaWarningCodeAction.cs (1)
85=> Formatter.Format(node, _document.Project.Solution.Services, _options, cancellationToken);
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction_Attribute.cs (2)
67return _project.Solution; 72return editor.GetChangedDocument().Project.Solution;
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction_Pragma.cs (1)
221=> Formatter.Format(node, _document.Project.Solution.Services, _options, cancellationToken);
CodeRefactorings\AddMissingImports\AbstractAddMissingImportsFeatureService.cs (5)
46var solution = document.Project.Solution; 82var solution = document.Project.Solution; 170var services = document.Project.Solution.Services; 220document.Project.Solution, progressTracker, cancellationToken).ConfigureAwait(false); 224newSolution = document.Project.Solution;
CodeRefactorings\CodeRefactoringService.cs (2)
77if (document.Project.Solution.WorkspaceKind == WorkspaceKind.Interactive) 215var extensionManager = textDocument.Project.Solution.Services.GetRequiredService<IExtensionManager>();
CodeRefactorings\MoveType\AbstractMoveTypeService.cs (2)
60return document.Project.Solution; 67return modifiedSolution ?? document.Project.Solution;
CodeRefactorings\MoveType\AbstractMoveTypeService.MoveTypeEditor.cs (3)
65var solutionWithNewDocument = documentWithMovedType.Project.Solution; 159var solutionWithNewDocument = projectToBeUpdated.Solution.AddDocument( 249return updatedDocument.Project.Solution;
CodeRefactorings\SyncNamespace\AbstractChangeNamespaceService.cs (4)
134var solution = document.Project.Solution; 193var solution = document.Project.Solution; 346var solution = document.Project.Solution; 552symbol, document.Project.Solution, progress, documents: null,
CodeRefactorings\SyncNamespace\AbstractSyncNamespaceCodeRefactoringProvider.MoveFileCodeAction.cs (1)
40var solution = _state.Document.Project.Solution;
CodeRefactorings\SyncNamespace\AbstractSyncNamespaceCodeRefactoringProvider.State.cs (1)
171var solution = document.Project.Solution;
Completion\CompletionOptions.cs (1)
77var solution = document.Project.Solution;
Completion\CompletionProvider.cs (1)
58=> ShouldTriggerCompletion(document.Project.Services, await document.GetValueTextAsync(cancellationToken).ConfigureAwait(false), caretPosition, trigger, options, document.Project.Solution.Options);
Completion\CompletionService.cs (2)
215var extensionManager = document.Project.Solution.Services.GetRequiredService<IExtensionManager>(); 247var extensionManager = document.Project.Solution.Services.GetRequiredService<IExtensionManager>();
Completion\CompletionService.ProviderManager.cs (1)
99if (project is null || project.Solution.WorkspaceKind == WorkspaceKind.Interactive)
Completion\CompletionService_GetCompletions.cs (3)
48var passThroughOptions = options ?? document.Project.Solution.Options; 155var extensionManager = document.Project.Solution.Services.GetRequiredService<IExtensionManager>(); 329var extensionManager = document.Project.Solution.Services.GetRequiredService<IExtensionManager>();
Completion\Providers\AbstractInternalsVisibleToCompletionProvider.cs (2)
137foreach (var project in context.Document.Project.Solution.Projects) 272var project = document.Project.Solution.GetRequiredProject(projectId);
Completion\Providers\AbstractMemberInsertingCompletionProvider.cs (1)
141document.Project.Solution,
Completion\Providers\AbstractPreprocessorCompletionProvider.cs (1)
22var solution = originatingDocument.Project.Solution;
Completion\Providers\AbstractRecommendationServiceBasedCompletionProvider.cs (2)
214var relatedDocumentIds = document.Project.Solution.GetRelatedDocumentIds(document.Id); 229var relatedDocument = await document.Project.Solution.GetRequiredDocumentAsync(documentId, includeSourceGenerated: true, cancellationToken).ConfigureAwait(false);
Completion\Providers\AbstractSymbolCompletionProvider.cs (2)
263supportedPlatformData = new SupportedPlatformData(completionContext.Document.Project.Solution, invalidProjects.ToImmutable(), totalProjects); 412var solution = document.Project.Solution;
Completion\Providers\ImportCompletionProvider\AbstractImportCompletionProvider.cs (1)
216document.Project.Solution.Services.GetRequiredService<IDocumentSupportsFeatureService>().SupportsRefactorings(document);
Completion\Providers\ImportCompletionProvider\AbstractTypeImportCompletionService.cs (1)
94var solution = currentProject.Solution;
Completion\Providers\ImportCompletionProvider\ExtensionMethodImportCompletionHelper.SymbolComputer.cs (5)
61=> project.Solution.Services.GetRequiredService<IImportCompletionCacheService<ExtensionMethodImportCompletionCacheEntry, object>>(); 80await SymbolTreeInfo.GetInfoForMetadataReferenceAsync(project.Solution, peReference, checksum: null, cancellationToken).ConfigureAwait(false); 141var graph = project.Solution.GetProjectDependencyGraph(); 143return [.. relevantProjectIds.Select(project.Solution.GetRequiredProject).Where(p => p.SupportsCompilation)]; 205_originatingDocument.Project.Solution, peReference, checksum: null, cancellationToken).ConfigureAwait(false);
Completion\Providers\ImportCompletionProvider\ImportCompletionItem.cs (1)
147document.Project.Solution.Services,
Completion\Providers\SymbolCompletionItem.cs (6)
150var linkedDoc = document.Project.Solution.GetRequiredDocument(id); 201var supportedPlatforms = GetSupportedPlatforms(item, document.Project.Solution); 205var services = document.Project.Solution.Services; 216return document.Project.Solution.GetRequiredDocument(contextId); 393var supportedPlatforms = GetSupportedPlatforms(item, document.Project.Solution); 397return await CommonCompletionUtilities.CreateDescriptionAsync(document.Project.Solution.Services, semanticModel, position, symbols, options, supportedPlatforms, cancellationToken).ConfigureAwait(false);
ConvertAutoPropertyToFullProperty\AbstractConvertAutoPropertyToFullPropertyCodeRefactoringProvider.cs (1)
94var editor = new SyntaxEditor(root, document.Project.Solution.Services);
ConvertForEachToFor\AbstractConvertForEachToForCodeRefactoringProvider.cs (1)
419var services = document.Project.Solution.Services;
ConvertLinq\ConvertForEachToLinqQuery\AbstractConvertForEachToLinqQueryProvider.cs (1)
151var editor = new SyntaxEditor(converter.ForEachInfo.SemanticModel.SyntaxTree.GetRoot(cancellationToken), document.Project.Solution.Services);
ConvertTupleToStruct\AbstractConvertTupleToStructCodeRefactoringProvider.cs (5)
192var hostServices = document.Project.Solution.Services 222var solution = document.Project.Solution; 437var solution = startingProject.Solution; 523var solution = startingDocument.Project.Solution; 585var currentSolution = startingDocument.Project.Solution;
Copilot\ICopilotChangeAnalysisService.cs (2)
131var projectConeCount = 1 + document.Project.Solution 285args: (@this: this, newDocument.Project.Solution, diagnosticIdToCount, diagnosticIdToApplicationTime, diagnosticIdToProviderName, providerNameToApplicationTime),
DesignerAttribute\DesignerAttributeDiscoveryService.cs (2)
64var solutionServices = project.Solution.Services; 65var solutionKey = SolutionKey.ToSolutionKey(project.Solution);
Diagnostics\CodeAnalysisDiagnosticAnalyzerService.cs (1)
92Contract.ThrowIfFalse(project.Solution.Workspace == _workspace);
Diagnostics\Service\DocumentAnalysisExecutor.cs (1)
358var diagnosticSpanMappingService = textDocument.Project.Solution.Services.GetService<IWorkspaceVenusSpanMappingService>();
Diagnostics\Service\DocumentAnalysisExecutor_Helpers.cs (1)
197foreach (var documentId in project.Solution.GetDocumentIdsWithFilePath(path))
Diagnostics\Service\EngineV2\DiagnosticIncrementalAnalyzer.cs (1)
49=> _stateManager.GetOrCreateAnalyzersAsync(project.Solution.SolutionState, project.State, cancellationToken);
Diagnostics\Service\EngineV2\DiagnosticIncrementalAnalyzer.Executor.cs (1)
63var compilerAnalyzer = project.Solution.SolutionState.Analyzers.GetCompilerDiagnosticAnalyzer(project.Language);
Diagnostics\Service\EngineV2\DiagnosticIncrementalAnalyzer_GetDiagnostics.cs (1)
63var solution = project.Solution;
Diagnostics\Service\EngineV2\DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs (1)
62var solutionState = project.Solution.SolutionState;
Diagnostics\Service\EngineV2\DiagnosticIncrementalAnalyzer_IncrementalAnalyzer.cs (1)
77var solutionState = project.Solution.SolutionState;
Diagnostics\Service\EngineV2\InProcOrRemoteHostAnalyzerRunner.cs (2)
101var skippedAnalyzersInfo = project.Solution.SolutionState.Analyzers.GetSkippedAnalyzersInfo(project.State, AnalyzerInfoCache); 193project.Solution,
DocumentHighlighting\AbstractDocumentHighlightsService.cs (4)
39var solution = document.Project.Solution; 73var solution = document.Project.Solution; 126symbol, document.Project.Solution, progress, 166var solution = startingDocument.Project.Solution;
DocumentSpanExtensions.cs (1)
16var solution = documentSpan.Document.Project.Solution;
EditAndContinue\DebuggingSession.cs (1)
844var newSolution = newProject.Solution;
EditAndContinue\EditSession.cs (2)
470var generatorDiagnostics = await project.Solution.CompilationState.GetSourceGeneratorDiagnosticsAsync(project.State, cancellationToken).ConfigureAwait(false); 487return await project.Solution.CompilationState.GetSourceGeneratedDocumentStatesAsync(project.State, cancellationToken).ConfigureAwait(false);
EditAndContinue\Remote\RemoteDebuggingSessionProxy.cs (1)
190document.Project.Solution,
EmbeddedLanguages\Classification\AbstractEmbeddedLanguageClassificationService.cs (1)
48project.Solution.Services, project, semanticModel, textSpans, options, result, cancellationToken);
EncapsulateField\AbstractEncapsulateFieldService.cs (5)
117var solution = document.Project.Solution; 145var currentSolution = document.Project.Solution; 181var solution = document.Project.Solution; 221document, document.Project.Solution, field, generatedProperty, cancellationToken).ConfigureAwait(false); 226return documentWithProperty.Project.Solution;
Extensions\ExtensionMessageHandlerService_RemoteOrLocal.cs (1)
122document.Project.Solution,
ExternalAccess\UnitTesting\API\UnitTestingSearchHelpers.cs (4)
31var client = await RemoteHostClient.TryGetClientAsync(project.Solution.Services, cancellationToken).ConfigureAwait(false); 42return await location.Value.Value.TryRehydrateAsync(project.Solution, cancellationToken).ConfigureAwait(false); 54var client = await RemoteHostClient.TryGetClientAsync(project.Solution.Services, cancellationToken).ConfigureAwait(false); 67result.AddIfNotNull(await location.TryRehydrateAsync(project.Solution, cancellationToken).ConfigureAwait(false));
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingSemanticChangeProcessor.cs (2)
176var solution = thisDocument.Project.Solution; 223var solution = project.Solution;
ExtractClass\AbstractExtractClassRefactoringProvider.cs (1)
29var solution = context.Document.Project.Solution;
ExtractInterface\AbstractExtractInterfaceService.cs (2)
138var solution = refactoringResult.DocumentToExtractFrom.Project.Solution; 267var service = document.Project.Solution.Services.GetRequiredService<IExtractInterfaceOptionsService>();
ExtractMethod\MethodExtractor.cs (2)
127if (!codeGenService.CanAddTo(destination, document.Project.Solution, cancellationToken)) 154var services = document.Project.Solution.Services;
FindUsages\AbstractFindUsagesService_FindImplementations.cs (2)
43var solution = project.Solution; 75var solution = project.Solution;
FindUsages\AbstractFindUsagesService_FindReferences.cs (5)
31document.Project.Solution, definitionTrackingContext.GetDefinitions(), cancellationToken).ConfigureAwait(false); 132var solution = project.Solution; 165project.Solution, symbol, context, searchOptions, classificationOptions); 167symbol, project.Solution, progress, documents: null, searchOptions, cancellationToken); 222var solution = document.Project.Solution;
FindUsages\FindUsagesHelpers.cs (1)
59var mappingService = document.Project.Solution.Services.GetService<ISymbolMappingService>();
GenerateComparisonOperators\GenerateComparisonOperatorsCodeRefactoringProvider.cs (1)
151document.Project.Solution,
GenerateConstructors\AbstractGenerateConstructorsCodeRefactoringProvider.cs (1)
112priorDocument.Project.Solution, codeAction, progressTracker, cancellationToken).ConfigureAwait(false);
GenerateOverrides\GenerateOverridesWithDialogCodeAction.cs (2)
40var services = _document.Project.Solution.Services; 74_document.Project.Solution,
GenerateType\AbstractGenerateTypeService.CodeAction.cs (3)
101var generateTypeOptionsService = _document.Project.Solution.Services.GetRequiredService<IGenerateTypeOptionsService>(); 102var notificationService = _document.Project.Solution.Services.GetService<INotificationService>(); 103var projectManagementService = _document.Project.Solution.Services.GetService<IProjectManagementService>();
GenerateType\AbstractGenerateTypeService.Editor.cs (3)
69Contract.ThrowIfFalse(document.Project.Solution == generateTypeOptionsResult.Project.Solution); 272var newSolution = projectToBeUpdated.Solution.AddDocument(newDocumentId, documentName, string.Empty, folders, fullFilePath); 349var updatedSolution = projectToBeUpdated.Solution.AddDocument(
GoToBase\AbstractGoToBaseService.cs (1)
43var solution = project.Solution;
GoToDefinition\AbstractGoToDefinitionSymbolService.cs (1)
26var services = document.Project.Solution.Services;
InheritanceMargin\AbstractInheritanceMarginService.cs (1)
36var solution = document.Project.Solution;
InheritanceMargin\AbstractInheritanceMarginService_Helpers.cs (3)
58var solution = project.Solution; 88var mappingService = document.Project.Solution.Services.GetRequiredService<ISymbolMappingService>(); 247var destinationDocument = document.Project.Solution.GetDocument(groupSyntaxTree);
InitializeParameter\AbstractAddParameterCheckCodeRefactoringProvider.cs (1)
395var editor = new SyntaxEditor(root, document.Project.Solution.Services);
InitializeParameter\AbstractInitializeMemberFromParameterCodeRefactoringProviderMemberCreation.cs (3)
377var currentSolution = document.WithSyntaxRoot(trackedRoot).Project.Solution; 435var solutionWithAssignmentAdded = documentWithMemberAdded.Project.Solution; 480var services = document.Project.Solution.Services;
InlineMethod\AbstractInlineMethodRefactoringProvider.cs (1)
339var solution = document.Project.Solution;
InlineMethod\AbstractInlineMethodRefactoringProvider.InlineContext.cs (2)
54var calleeDocument = document.Project.Solution.GetRequiredDocument(calleeMethodNode.SyntaxTree); 297.FindReferencesAsync(symbol, document.Project.Solution, ImmutableHashSet<Document>.Empty.Add(document), cancellationToken)
InlineMethod\AbstractInlineMethodRefactoringProvider.MethodParametersInfo.cs (2)
164var calleeDocument = document.Project.Solution.GetRequiredDocument(calleeMethodNode.SyntaxTree); 442.FindReferencesAsync(parameterSymbol, document.Project.Solution, ImmutableHashSet<Document>.Empty.Add(document), cancellationToken).ConfigureAwait(false);
InlineTemporary\AbstractInlineTemporaryCodeRefactoringProvider.cs (1)
40local, document.Project.Solution, options, cancellationToken).ConfigureAwait(false);
IntroduceParameter\AbstractIntroduceParameterCodeRefactoringProvider.cs (2)
240var modifiedSolution = originalDocument.Project.Solution; 275methodSymbol, document.Project.Solution, progress,
InvertConditional\AbstractInvertConditionalCodeRefactoringProvider.cs (1)
49var editor = new SyntaxEditor(root, document.Project.Solution.Services);
MetadataAsSource\AbstractMetadataAsSourceService.cs (1)
33document.Project.Solution,
MetadataAsSource\MetadataAsSourceGeneratedFileInfo.cs (1)
37: sourceProject.Solution.Services.GetLanguageServices(LanguageName).GetRequiredService<ISyntaxTreeFactoryService>().GetDefaultParseOptionsWithLatestLanguageVersion();
MetadataAsSource\SymbolMappingServiceFactory.cs (1)
34if (document.Project.Solution.WorkspaceKind is not WorkspaceKind.MetadataAsSource)
MoveToNamespace\AbstractMoveToNamespaceService.cs (1)
226var originalSolution = document.Project.Solution;
NameTupleElement\AbstractNameTupleElementCodeRefactoringProvider.cs (1)
43if (document.Project.Solution.WorkspaceKind == WorkspaceKind.MiscellaneousFiles)
NavigateTo\AbstractNavigateToSearchService.InProcess.cs (1)
58var linkedDocument = document.Project.Solution.GetRequiredDocument(linkedDocumentId);
NavigateTo\AbstractNavigateToSearchService.NormalSearch.cs (2)
33var solution = document.Project.Solution; 107var solution = document.Project.Solution;
NavigateTo\RoslynNavigateToItem.cs (1)
148var solution = firstProject.Solution;
Navigation\INavigableItem.cs (1)
61document.Project.Solution.TryGetWorkspace());
PullMemberUp\MembersPuller.cs (2)
95var solution = document.Project.Solution; 270var solution = document.Project.Solution;
RelatedDocuments\AbstractRelatedDocumentsService.cs (1)
70var solution = document.Project.Solution;
RemoveUnusedVariable\AbstractRemoveUnusedVariableCodeFixProvider.cs (1)
89var referencedSymbols = await SymbolFinder.FindReferencesAsync(symbol, document.Project.Solution, documentsToBeSearched, cancellationToken).ConfigureAwait(false);
Rename\SymbolicRenameInfo.cs (2)
175semanticModel, triggerToken.SpanStart, document.Project.Solution.Services, cancellationToken: cancellationToken).ConfigureAwait(false); 221var solution = document.Project.Solution;
ReplaceMethodWithProperty\ReplaceMethodWithPropertyCodeRefactoringProvider.cs (3)
162var originalSolution = project.Solution; 216return originalDocument.Project.Solution; 220var editor = new SyntaxEditor(root, originalDocument.Project.Solution.Services);
ReplacePropertyWithMethods\ReplacePropertyWithMethodsCodeRefactoringProvider.cs (2)
84var originalSolution = document.Project.Solution; 220var editor = new SyntaxEditor(root, originalDocument.Project.Solution.Services);
SemanticSearch\QueryExecutionContext.cs (1)
158classificationOptions, project.Solution, s_findReferencesSearchOptions, isPrimary: true, includeHiddenLocations: false, cancellationToken).ConfigureAwait(false);
SemanticSearch\SemanticSearchUtilities.cs (1)
84=> GetQueryDocumentId(document.Project.Solution) == document.Id;
Shared\Extensions\DocumentExtensions.cs (2)
64values = await getItemsWorker(document.Project.Solution.GetRequiredDocument(linkedDocumentId)).ConfigureAwait(false); 81var solution = document.Project.Solution;
Shared\Utilities\ExtractTypeHelpers.cs (1)
128return Formatter.Format(syntaxGenerator.SyntaxGeneratorInternal.TypeParameterList(typeParameterNames), document.Project.Solution.Services, formattingOptions, cancellationToken).ToString();
SignatureHelp\AbstractSignatureHelpProvider.cs (1)
292var platformData = new SupportedPlatformData(document.Project.Solution, invalidProjectsForCurrentSymbol.ToImmutableAndClear(), totalProjects);
SignatureHelp\SignatureHelpService.cs (1)
67var extensionManager = document.Project.Solution.Services.GetRequiredService<IExtensionManager>();
SpellCheck\AbstractSpellCheckCodeFixProvider.cs (1)
128var passThroughOptions = document.Project.Solution.Options;
src\Analyzers\Core\CodeFixes\AddParameter\AddParameterService.cs (2)
89var solution = invocationDocument.Project.Solution; 218method, invocationDocument.Project.Solution, cancellationToken).ConfigureAwait(false);
src\Analyzers\Core\CodeFixes\ConvertToAsync\AbstractConvertToAsyncCodeFixProvider.cs (1)
61var otherDocument = document.Project.Solution.GetRequiredDocument(syntaxTree);
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.State.cs (2)
451document.Project.Solution, 497document.Project.Solution,
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\GenerateDefaultConstructorsCodeAction.cs (1)
41_document.Project.Solution,
src\Analyzers\Core\CodeFixes\GenerateEnumMember\AbstractGenerateEnumMemberService.CodeAction.cs (2)
24var languageServices = _document.Project.Solution.Workspace.Services.GetExtendedLanguageServices(_state.TypeToGenerateIn.Language); 34_document.Project.Solution,
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.CodeAction.cs (3)
64var syntaxFactory = _document.Project.Solution.Services.GetLanguageServices(_state.TypeToGenerateIn.Language).GetService<SyntaxGenerator>(); 72_document.Project.Solution, 88_document.Project.Solution,
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.cs (1)
51var semanticFacts = document.Project.Solution.Workspace.Services
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\TypeParameterSubstitution.cs (2)
88var solution = _project.Solution; 126var solution = _project.Solution;
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.cs (1)
47var canGenerateMember = CodeGenerator.CanAdd(document.Project.Solution, state.TypeToGenerateIn, cancellationToken);
src\Analyzers\Core\CodeFixes\ImplementAbstractClass\ImplementAbstractClassData.cs (1)
60if (!CodeGenerator.CanAdd(document.Project.Solution, classType, cancellationToken))
src\Analyzers\Core\CodeFixes\ImplementInterface\AbstractImplementInterfaceService.State.cs (1)
55if (!CodeGenerator.CanAdd(document.Project.Solution, classOrStructType, cancellationToken))
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator.cs (1)
96this.Document.Project.Solution,
src\Analyzers\Core\CodeFixes\MakeMethodAsynchronous\AbstractMakeMethodAsynchronousCodeFixProvider.cs (2)
163var solution = document.Project.Solution; 197return newDocument.Project.Solution;
src\Analyzers\Core\CodeFixes\MakeMethodSynchronous\AbstractMakeMethodSynchronousCodeFixProvider.cs (3)
77var solution = document.Project.Solution; 110var newSolution = newDocument.Project.Solution; 151return document.Project.Solution;
src\Analyzers\Core\CodeFixes\MatchFolderAndNamespace\AbstractChangeNamespaceToMatchFolderCodeFixProvider.cs (3)
27var service = context.Document.Project.Solution.Services.GetRequiredService<ISupportedChangesService>(); 63var newSolution = await renameActionSet.UpdateSolutionAsync(documentWithInvalidFolders.Project.Solution, cancellationToken).ConfigureAwait(false); 64Debug.Assert(newSolution != document.Project.Solution);
src\Analyzers\Core\CodeFixes\MatchFolderAndNamespace\AbstractChangeNamespaceToMatchFolderCodeFixProvider.CustomFixAllProvider.cs (1)
45fixAllContext.Project.Solution,
src\Analyzers\Core\CodeFixes\NamingStyle\NamingStyleCodeFixProvider.cs (2)
92document.Project.Solution, 107document.Project.Solution, symbol, new SymbolRenameOptions(), fixedName,
src\Analyzers\Core\CodeFixes\RemoveAsyncModifier\AbstractRemoveAsyncModifierCodeFixProvider.cs (1)
67var solutionServices = document.Project.Solution.Services;
src\Analyzers\Core\CodeFixes\RemoveUnusedParametersAndValues\AbstractRemoveUnusedValuesCodeFixProvider.cs (2)
303var editor = new SyntaxEditor(root, document.Project.Solution.Services); 924var referencedSymbols = await SymbolFinder.FindReferencesAsync(local, document.Project.Solution, cancellationToken).ConfigureAwait(false);
src\Analyzers\Core\CodeFixes\UnsealClass\AbstractUnsealClassCodeFixProvider.cs (2)
43type, document.Project.Solution, cancellationToken).ConfigureAwait(false); 50c => UnsealDeclarationsAsync(document.Project.Solution, definition.DeclaringSyntaxReferences, c),
src\Analyzers\Core\CodeFixes\UpgradeProject\AbstractUpgradeProjectCodeFixProvider.cs (1)
44var solution = project.Solution;
src\Analyzers\Core\CodeFixes\UseConditionalExpression\AbstractUseConditionalExpressionCodeFixProvider.cs (1)
56var nestedEditor = new SyntaxEditor(root, document.Project.Solution.Services);
SymbolMapping\SymbolMappingResult.cs (1)
21public Solution Solution => Project.Solution;
SyncNamespaces\AbstractSyncNamespacesService.cs (1)
40var solution = projects[0].Solution;
UseAutoProperty\AbstractUseAutoPropertyCodeFixProvider.cs (1)
69var solution = context.Document.Project.Solution;
ValueTracking\ValueTracker.cs (3)
26var operationCollector = new OperationCollector(progressCollector, document.Project.Solution); 36var solution = document.Project.Solution; 68await progressCollector.TryReportAsync(document.Project.Solution, node.GetLocation(), symbol, cancellationToken).ConfigureAwait(false);
ValueTracking\ValueTrackingService.cs (1)
36var solution = document.Project.Solution;
Microsoft.CodeAnalysis.Features.Test.Utilities (5)
EditAndContinue\EditAndContinueTestVerifier.cs (1)
479var newSolution = oldProject.Solution;
EditAndContinue\EditAndContinueWorkspaceTestBase.cs (3)
112solution = project.Solution; 147solution = document.Project.Solution; 151return document.Project.Solution;
EditAndContinue\Extensions.cs (1)
85=> project.Solution.AddTestDocument(project.Id, source, path, out id);
Microsoft.CodeAnalysis.Features.UnitTests (10)
EditAndContinue\ActiveStatementsMapTests.cs (3)
118.AddDocument("doc", SourceText.From(source, Encoding.UTF8), filePath: "a.cs").Project.Solution; 173.AddDocument("doc", SourceText.From(source, Encoding.UTF8), filePath: "a.cs").Project.Solution; 224.AddDocument("doc", SourceText.From(source, Encoding.UTF8), filePath: "a.cs").Project.Solution;
EditAndContinue\EditAndContinueWorkspaceServiceTests.cs (4)
241solution = document.Project.Solution; 579solution = project.Solution; 770solution = project.Solution; 1148solution = project.Solution;
EditAndContinue\EditSessionActiveStatementsTests.cs (2)
76solution = project.Solution; 180solution = dummyProject.Solution.AddDocument(DocumentId.CreateNewId(dummyProject.Id, NoCompilationConstants.LanguageName), "a.dummy", "");
EditAndContinue\EmitSolutionUpdateResultsTests.cs (1)
80var solution = document.Project.Solution;
Microsoft.CodeAnalysis.LanguageServer (1)
LanguageServer\Handler\DebugConfiguration\WorkspaceDebugConfigurationHandler.cs (1)
51return new ProjectDebugConfiguration(project.FilePath!, project.OutputFilePath!, GetProjectName(project), targetsDotnetCore, isExe, project.Solution.FilePath);
Microsoft.CodeAnalysis.LanguageServer.Protocol (37)
Extensions\Extensions.cs (1)
171var solution = documents.First().Project.Solution;
Extensions\ProtocolConversions.cs (1)
835IsMiscellaneous = project.Solution.WorkspaceKind == WorkspaceKind.MiscellaneousFiles,
Extensions\ProtocolConversions.Diagnostics.cs (1)
119var informationService = project.Solution.Services.GetRequiredService<IDiagnosticProjectInformationService>();
ExternalAccess\Razor\FormatNewFileHandler.cs (1)
91root = Formatter.Format(root, project.Solution.Services, syntaxFormattingOptions, cancellationToken);
Features\CodeCleanup\AbstractCodeCleanupService.cs (4)
181var fixAllService = document.Project.Solution.Services.GetRequiredService<IFixAllGetFixesService>(); 197var diagnosticService = document.Project.Solution.Services.GetRequiredService<IDiagnosticAnalyzerService>(); 247var solutionChanges = updatedDocument.Project.Solution.GetChanges(currentDocument.Project.Solution);
Features\EditAndContinue\EditAndContinueDiagnosticSource_OpenDocument.cs (1)
27var designTimeSolution = designTimeDocument.Project.Solution;
Features\Options\BlockStructureOptionsStorage.cs (1)
12=> GetBlockStructureOptions(globalOptions, project.Language, isMetadataAsSource: project.Solution.WorkspaceKind == WorkspaceKind.MetadataAsSource);
Features\UnifiedSuggestions\UnifiedSuggestedActionsSource.cs (3)
43var originalSolution = document.Project.Solution; 511var originalSolution = document.Project.Solution; 600var originalSolution = document.Project.Solution;
Handler\CodeActions\CodeActionFixAllResolveHandler.cs (1)
59var operations = await fixAllCodeAction.GetOperationsAsync(document.Project.Solution, CodeAnalysisProgress.None, cancellationToken).ConfigureAwait(false);
Handler\CodeActions\CodeActionHelpers.cs (2)
399document.Project.Solution.Workspace, codeFixService, document, textSpan, 404document.Project.Solution.Workspace, codeRefactoringService, document, textSpan, priority: null,
Handler\CodeActions\CodeActionResolveHandler.cs (1)
76var solution = document.Project.Solution;
Handler\CodeLens\CodeLensResolveHandler.cs (2)
66var codeLensReferencesService = document.Project.Solution.Services.GetRequiredService<ICodeLensReferencesService>(); 67var referenceCount = await codeLensReferencesService.GetReferenceCountAsync(document.Project.Solution, document.Id, memberToResolve.Node, maxSearchResults: 99, cancellationToken).ConfigureAwait(false);
Handler\Completion\CompletionHandler.cs (2)
91&& !completionService.ShouldTriggerCompletion(project, project.Services, documentText, position, completionTrigger, completionOptions, project.Solution.Options, roles: null)) 174var completionList = await completionService.GetCompletionsAsync(document, position, completionOptions, document.Project.Solution.Options, completionTrigger, cancellationToken: cancellationToken).ConfigureAwait(false);
Handler\Definitions\AbstractGoToDefinitionHandler.cs (2)
68await definition.Document.GetRequiredDocumentAsync(document.Project.Solution, cancellationToken).ConfigureAwait(false), 79var symbol = await SymbolFinder.FindSymbolAtPositionAsync(semanticModel, position, document.Project.Solution.Services, includeType: true, cancellationToken).ConfigureAwait(false);
Handler\Extensions\ExtensionDocumentMessageHandler.cs (1)
31var solution = context.Document.Project.Solution;
Handler\Formatting\AbstractFormatDocumentHandlerBase.cs (1)
42var services = document.Project.Solution.Services;
Handler\InlineCompletions\InlineCompletionsHandler.cs (1)
193var formattingChanges = Formatter.GetFormattedTextChanges(root, spanToFormat, originalDocument.Project.Solution.Services, formattingOptions, cancellationToken: cancellationToken)
Handler\PullHandlers\VersionedPullCache.cs (2)
79var isFullyLoaded = await IsFullyLoadedAsync(project.Solution, cancellationToken).ConfigureAwait(false); 83(project.Solution.Workspace, projectOrDocumentId),
Handler\Rename\RenameHandler.cs (1)
36var oldSolution = document.Project.Solution;
Handler\SemanticTokens\SemanticTokensRefreshQueue.cs (1)
44var projectChecksum = await project.Solution.CompilationState.GetChecksumAsync(project.Id, cancellationToken).ConfigureAwait(false);
Handler\SourceGenerators\SourceGeneratedDocumentCache.cs (2)
23var executionVersion = state.Document.Project.Solution.GetSourceGeneratorExecutionVersion(state.Document.Project.Id); 45var unfrozenDocument = await state.Document.Project.Solution.WithoutFrozenSourceGeneratedDocuments().GetDocumentAsync(state.Document.Id, includeSourceGenerated: true, cancellationToken).ConfigureAwait(false);
Workspaces\LspWorkspaceManager.cs (5)
247var workspaceKind = document.Project.Solution.WorkspaceKind; 260return (workspace, document.Project.Solution, document); 275return (miscDocument.Project.Solution.Workspace, miscDocument.Project.Solution, miscDocument); 474_logger.LogWarning($"Text for {uriInWorkspace} did not match document text {firstDocument.Id} in workspace's {firstDocument.Project.Solution.WorkspaceKind} current solution");
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (6)
Workspaces\LspWorkspaceManagerTests.cs (6)
447await testWorkspaceTwo.ChangeProjectAsync(newProjectWorkspaceTwo.Id, newProjectWorkspaceTwo.Solution); 503await testWorkspace.ChangeProjectAsync(newProject.Id, newProject.Solution); 710Assert.Same(testLspServer.TestWorkspace.CurrentSolution, sourceGeneratedDocument.Project.Solution); 727Assert.NotSame(testLspServer.TestWorkspace.CurrentSolution, sourceGeneratedDocument.Project.Solution); 743Assert.Same(testLspServer.TestWorkspace.CurrentSolution, sourceGeneratedDocument.Project.Solution); 751Assert.NotSame(testLspServer.TestWorkspace.CurrentSolution, sourceGeneratedDocument.Project.Solution);
Microsoft.CodeAnalysis.PublicApiAnalyzers.CodeFixes (4)
AnnotatePublicApiFix.cs (1)
67return publicSurfaceAreaDocument.Project.Solution.WithAdditionalDocumentText(publicSurfaceAreaDocument.Id, newSourceText);
DeclarePublicApiFix.cs (2)
98return surfaceAreaDocument.Project.Solution.WithAdditionalDocumentText(surfaceAreaDocument.Id, newSourceText); 107return project.Solution;
NullableEnablePublicApiFix.cs (1)
61return surfaceAreaDocument.Project.Solution.WithAdditionalDocumentText(surfaceAreaDocument.Id, newSourceText);
Microsoft.CodeAnalysis.Remote.ServiceHub (15)
Host\RemoteWorkspace.SolutionCreator.cs (10)
421return project.Solution; 496project = addDocuments(project.Solution, lazyDocumentsToAdd.ToImmutable()).GetProject(project.Id)!; 513project = removeDocuments(project.Solution, lazyDocumentsToRemove.ToImmutable()).GetProject(project.Id)!; 557TextDocumentKind.Document => document.Project.Solution.WithDocumentTextLoader(document.Id, loader, mode).GetRequiredDocument(document.Id), 558TextDocumentKind.AnalyzerConfigDocument => document.Project.Solution.WithAnalyzerConfigDocumentTextLoader(document.Id, loader, mode).GetRequiredAnalyzerConfigDocument(document.Id), 559TextDocumentKind.AdditionalDocument => document.Project.Solution.WithAdditionalDocumentTextLoader(document.Id, loader, mode).GetRequiredAdditionalDocument(document.Id), 578document = document.Project.Solution.WithDocumentName(document.Id, newDocumentInfo.Name).GetRequiredDocument(document.Id); 581document = document.Project.Solution.WithDocumentFilePath(document.Id, newDocumentInfo.FilePath).GetRequiredDocument(document.Id); 587document = document.Project.Solution.WithDocumentFolders(document.Id, newDocumentInfo.Folders).GetRequiredDocument(document.Id); 594document = document.Project.Solution.WithDocumentSourceCodeKind(document.Id, newDocumentInfo.SourceCodeKind).GetRequiredDocument(document.Id);
Services\DiagnosticAnalyzer\DiagnosticComputer.cs (3)
81_performanceTracker = project.Solution.Services.GetService<IPerformanceTrackerService>(); 167var skippedAnalyzersInfo = _project.Solution.SolutionState.Analyzers.GetSkippedAnalyzersInfo( 371foreach (var reference in _project.Solution.AnalyzerReferences)
Services\SemanticClassification\RemoteSemanticClassificationService.Caching.cs (1)
126var solution = document.Project.Solution;
Services\SemanticClassification\RemoteSemanticClassificationService.cs (1)
38solution = document.Project.Solution;
Microsoft.CodeAnalysis.Remote.Workspaces (1)
SolutionAssetStorage.cs (1)
56=> StoreAssetsAsync(project.Solution.CompilationState, project.Id, cancellationToken);
Microsoft.CodeAnalysis.TestAnalyzerReference (2)
NonSourceFileRefactoring.cs (2)
30return document.Project.Solution.WithAdditionalDocumentText(document.Id, newText); 31return document.Project.Solution.WithAnalyzerConfigDocumentText(document.Id, newText);
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (3)
src\Analyzers\VisualBasic\CodeFixes\RemoveUnnecessaryCast\VisualBasicRemoveUnnecessaryCastCodeFixProvider.vb (2)
102Dim innerEditor = New SyntaxEditor(root, document.Project.Solution.Services) 136Dim editor = New SyntaxEditor(root, document.Project.Solution.Services)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\InitializeParameter\VisualBasicInitializeParameterService.vb (1)
55Return Task.FromResult(document.Project.Solution)
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures (7)
LineCommit\CommitBufferManager.vb (1)
311Dim refProject = project.Solution.GetProject(reference.ProjectId)
LineCommit\CommitCommandHandler.vb (1)
243Dim formattingRuleService = document.Project.Solution.Services.GetService(Of IHostDependentFormattingRuleFactoryService)()
NavigationBar\VisualBasicEditorNavigationBarItemService.vb (1)
48Dim destinationDocument = document.Project.Solution.GetDocument(navigationLocation.documentId)
NavigationBar\VisualBasicEditorNavigationBarItemService_CodeGeneration.vb (4)
147document.Project.Solution, 202document.Project.Solution, 246document.Project.Solution, 273document.Project.Solution,
Microsoft.CodeAnalysis.VisualBasic.Features (21)
ChangeSignature\VisualBasicChangeSignatureService.vb (2)
705convertedType = If(Await SymbolFinder.FindSourceDefinitionAsync(convertedType, document.Project.Solution, cancellationToken).ConfigureAwait(False), convertedType) 724nodeType = If(Await SymbolFinder.FindSourceDefinitionAsync(nodeType, document.Project.Solution, cancellationToken).ConfigureAwait(False), nodeType)
CodeFixes\GenerateEvent\GenerateEventCodeFixProvider.vb (13)
108Dim sourceDefinition = Await SymbolFinder.FindSourceDefinitionAsync(targetType, document.Project.Solution, cancellationToken).ConfigureAwait(False) 127Dim codeGenService = document.Project.Solution.Services.GetLanguageServices(targetType.Language).GetService(Of ICodeGenerationService) 128Dim syntaxFactService = document.Project.Solution.Services.GetLanguageServices(targetType.Language).GetService(Of ISyntaxFactsService) 132document.Project.Solution, eventHandlerName, Not syntaxFactService.IsCaseSensitive, SymbolFilter.Type, cancellationToken).ConfigureAwait(False) 157Return New GenerateEventCodeAction(document.Project.Solution, targetType, generatedEvent, codeGenService) 259Dim targetType = TryCast(Await SymbolFinder.FindSourceDefinitionAsync(semanticModel.GetSymbolInfo(node.Left, cancellationToken).Symbol, document.Project.Solution, cancellationToken).ConfigureAwait(False), INamedTypeSymbol) 269Dim codeGenService = document.Project.Solution.Services.GetLanguageServices(targetType.Language).GetService(Of ICodeGenerationService) 306Return New GenerateEventCodeAction(document.Project.Solution, targetType, generatedEvent, codeGenService) 310Return New GenerateEventCodeAction(document.Project.Solution, targetType, generatedMember, codeGenService) 350targetType = TryCast(Await SymbolFinder.FindSourceDefinitionAsync(withEventsProperty.Type, document.Project.Solution, cancellationToken).ConfigureAwait(False), INamedTypeSymbol) 354targetType = TryCast(Await SymbolFinder.FindSourceDefinitionAsync(targetType, document.Project.Solution, cancellationToken).ConfigureAwait(False), INamedTypeSymbol) 379Dim codeGenService = document.Project.Solution.Services.GetLanguageServices(originalTargetType.Language).GetService(Of ICodeGenerationService) 406document.Project.Solution, originalTargetType, generatedEvent, codeGenService)
CodeFixes\OverloadBase\OverloadBaseCodeFixProvider.AddKeywordAction.vb (1)
75Dim services = document.Project.Solution.Services
CodeRefactorings\InlineTemporary\VisualBasicInlineTemporaryCodeRefactoringProvider.vb (2)
33If document.Project.Solution.WorkspaceKind = WorkspaceKind.MiscellaneousFiles Then 185Return Simplifier.Expand(DirectCast(n, StatementSyntax), semanticModel, document.Project.Solution.Services, cancellationToken:=cancellationToken)
NavigationBar\VisualBasicNavigationBarItemService.vb (1)
55document.Project.Solution, type, position, semanticModel, workspaceSupportsDocumentChanges, symbolDeclarationService, cancellationToken))
src\Analyzers\VisualBasic\CodeFixes\RemoveUnnecessaryCast\VisualBasicRemoveUnnecessaryCastCodeFixProvider.vb (2)
102Dim innerEditor = New SyntaxEditor(root, document.Project.Solution.Services) 136Dim editor = New SyntaxEditor(root, document.Project.Solution.Services)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (3)
CodeCleanup\Providers\NormalizeModifiersOrOperatorsCodeCleanupProvider.vb (1)
37Dim newRoot = Await CleanupAsync(root, spans, options.FormattingOptions, document.Project.Solution.Services, cancellationToken).ConfigureAwait(False)
CodeCleanup\Providers\RemoveUnnecessaryLineContinuationCodeCleanupProvider.vb (1)
40Dim newRoot = Await CleanupAsync(root, spans, options.FormattingOptions, document.Project.Solution.Services, cancellationToken).ConfigureAwait(False)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\InitializeParameter\VisualBasicInitializeParameterService.vb (1)
55Return Task.FromResult(document.Project.Solution)
Microsoft.CodeAnalysis.Workspaces (159)
Classification\AbstractClassificationService.cs (3)
82var workspaceStatusService = document.Project.Solution.Services.GetRequiredService<IWorkspaceStatusService>(); 190var extensionManager = document.Project.Solution.Services.GetRequiredService<IExtensionManager>(); 204AddSyntacticClassifications(document.Project.Solution.Services, root, textSpans, result, cancellationToken);
Classification\Classifier.cs (1)
35return GetClassifiedSpans(document.Project.Solution.Services, document.Project, semanticModel, textSpan, ClassificationOptions.Default, cancellationToken);
Classification\SemanticClassificationCacheUtilities.cs (1)
23var projectKey = new ProjectKey(SolutionKey.ToSolutionKey(project.Solution), project.Id, project.FilePath, project.Name, Checksum.Null);
CodeActions\CodeAction.cs (3)
331return changedDocument?.Project.Solution; 353return changedDocument?.Project.Solution; 697return [new ApplyChangesOperation(newDocument.Project.Solution)];
CodeActions\CodeAction_Cleanup.cs (1)
116document.Project.Solution,
CodeActions\Operations\ApplyChangesOperation.cs (2)
127var originalDocument = changedProject.OldProject.Solution.GetRequiredTextDocument(documentId); 128var changedDocument = changedProject.NewProject.Solution.GetRequiredTextDocument(documentId);
CodeFixes\FixAllOccurrences\FixAllContext.DiagnosticProvider.cs (1)
86source: project.Solution.Projects,
CodeFixes\FixAllOccurrences\FixAllContextHelper.cs (1)
67var projectsToFix = project.Solution.Projects
CodeFixes\FixAllOccurrences\TextChangeMerger.cs (1)
36_differenceService = document.Project.Solution.Services.GetRequiredService<IDocumentTextDifferencingService>();
CodeFixesAndRefactorings\CommonFixAllState.cs (1)
21public Solution Solution => Project.Solution;
CodeRefactorings\FixAllOccurences\FixAllContext.cs (1)
63public Solution Solution => Project.Solution;
CodeRefactorings\FixAllOccurences\FixAllState.cs (1)
116documentsToFix = Project.Solution.Projects.SelectMany(p => p.Documents);
CodeRefactorings\SyntaxEditorBasedCodeRefactoringProvider.cs (1)
68var editor = new SyntaxEditor(root, document.Project.Solution.Services);
Diagnostics\DiagnosticData.cs (3)
177var diagnosticSpanMappingService = document?.Project.Solution.Services.GetService<IWorkspaceVenusSpanMappingService>(); 202location: new DiagnosticDataLocation(new FileLinePositionSpan(project.FilePath ?? project.Solution.FilePath ?? "", span: default)), 277builder.Add(CreateLocation(document.Project.Solution.GetDocument(location.SourceTree), location));
Diagnostics\Extensions.cs (4)
480var solution = project.Solution; 512var options = project.Solution.Services.GetRequiredService<IWorkspaceConfigurationService>().Options; 517project.Solution, 558var documentIds = targetTextDocument.Project.Solution.GetDocumentIdsWithFilePath(lineSpan.Path);
Editing\DocumentEditor.cs (1)
19: base(root, document.Project.Solution.Services)
Editing\SymbolEditor.cs (2)
51return new SymbolEditor(document.Project.Solution); 292ChangedSolution = newDoc.Project.Solution;
FindSymbols\Declarations\DeclarationFinder.cs (1)
83project.Solution, reference, checksum: null, cancellationToken).ConfigureAwait(false);
FindSymbols\Declarations\DeclarationFinder_AllDeclarations.cs (2)
40var solution = project.Solution; 99var referencedProject = project.Solution.GetProject(projectReference.ProjectId);
FindSymbols\Declarations\DeclarationFinder_SourceDeclarations.cs (4)
85project.Solution, 94return await RehydrateAsync(project.Solution, result.Value, cancellationToken).ConfigureAwait(false); 151project.Solution, 160return await RehydrateAsync(project.Solution, result.Value, cancellationToken).ConfigureAwait(false);
FindSymbols\FindReferences\DependentTypeFinder.cs (1)
345project.Solution, reference, checksum: null, cancellationToken).ConfigureAwait(false);
FindSymbols\FindReferences\DependentTypeFinder_ProjectIndex.cs (2)
77var solutionKey = SolutionKey.ToSolutionKey(project.Solution); 80var sourceGeneratorDocumentStates = await project.Solution.CompilationState.GetSourceGeneratedDocumentStatesAsync(project.State, cancellationToken).ConfigureAwait(false);
FindSymbols\FindReferences\FindReferencesDocumentState.cs (1)
29public Solution Solution => this.Document.Project.Solution;
FindSymbols\Shared\AbstractSyntaxIndex_Persistence.cs (1)
147SolutionKey.ToSolutionKey(document.Project.Solution),
FindSymbols\SymbolFinder.cs (1)
132return await FindSymbolAtPositionAsync(semanticModel, position, document.Project.Solution.Services, cancellationToken).ConfigureAwait(false);
FindSymbols\SymbolTree\SymbolTreeInfo_Source.cs (3)
36var solution = project.Solution; 56project.Solution.Services, 57SolutionKey.ToSolutionKey(project.Solution),
FindSymbols\SymbolTree\SymbolTreeInfoCacheService.cs (3)
84var solution = project.Solution; 195var checksum = SymbolTreeInfo.GetMetadataChecksum(project.Solution.Services, reference, cancellationToken); 200project.Solution, reference, checksum, cancellationToken).ConfigureAwait(false);
FindSymbols\SyntaxTree\SyntaxTreeIndex.cs (3)
39=> GetRequiredIndexAsync(SolutionKey.ToSolutionKey(document.Project.Solution), document.Project.State, (DocumentState)document.State, cancellationToken); 45=> GetIndexAsync(SolutionKey.ToSolutionKey(document.Project.Solution), document.Project.State, (DocumentState)document.State, cancellationToken); 51=> GetIndexAsync(SolutionKey.ToSolutionKey(document.Project.Solution), document.Project.State, (DocumentState)document.State, loadOnly, cancellationToken);
FindSymbols\TopLevelSyntaxTree\TopLevelSyntaxTreeIndex.cs (3)
47=> GetRequiredIndexAsync(SolutionKey.ToSolutionKey(document.Project.Solution), document.Project.State, (DocumentState)document.State, cancellationToken); 53=> GetIndexAsync(SolutionKey.ToSolutionKey(document.Project.Solution), document.Project.State, (DocumentState)document.State, cancellationToken); 59=> GetIndexAsync(SolutionKey.ToSolutionKey(document.Project.Solution), document.Project.State, (DocumentState)document.State, loadOnly, cancellationToken);
Formatting\Formatter.cs (3)
95var services = document.Project.Solution.Services; 116var services = document.Project.Solution.Services; 133var services = document.Project.Solution.Services;
Recommendations\Recommender.cs (1)
60options ??= project.Solution.Options;
Remote\RemoteArguments.cs (1)
56: Dehydrate(document.Project.Solution, alias, cancellationToken);
Remote\RemoteHostClient.cs (1)
38return TryGetClientAsync(project.Solution.Services, cancellationToken);
Remote\RemoteServiceConnection.cs (4)
82=> TryInvokeAsync(project.Solution.CompilationState, project.Id, invocation, cancellationToken); 88=> TryInvokeAsync(project.Solution.CompilationState, project.Id, invocation, cancellationToken); 132=> TryInvokeAsync(project.Solution.CompilationState, project.Id, invocation, cancellationToken); 138=> TryInvokeAsync(project.Solution.CompilationState, project.Id, invocation, cancellationToken);
Rename\ConflictEngine\ConflictResolver.Session.cs (1)
654var newReferencedSymbols = RenameUtilities.GetSymbolsTouchingPosition(tokenOrNode.Span.Start, newDocumentSemanticModel, newDocument.Project.Solution.Services, _cancellationToken);
Rename\ConflictEngine\RenamedSpansTracker.cs (1)
217solution = document.Project.Solution;
Rename\Renamer.cs (1)
74=> RenameDocumentAsync(document, GetDocumentRenameOptions(optionSet ?? document.Project.Solution.Options), newDocumentName, newDocumentFolders, cancellationToken);
Rename\Renamer.RenameSymbolDocumentAction.cs (1)
38var solution = document.Project.Solution;
Rename\Renamer.SyncNamespaceDocumentAction.cs (1)
47return solution ?? document.Project.Solution;
Rename\RenameUtilities.cs (1)
306var definitionSymbol = await FindDefinitionSymbolAsync(symbol, document.Project.Solution, cancellationToken).ConfigureAwait(false);
Shared\Extensions\DocumentExtensions.cs (1)
25=> document.Project.Solution.WithOptions(options).GetRequiredDocument(document.Id);
Shared\Extensions\ProjectExtensions.cs (3)
17=> project.Solution.WithOptions(options).GetProject(project.Id)!; 20=> project.Solution.GetTextDocument(documentId); 32=> project.Solution.GetDocumentIdsWithFilePath(filePath).FirstOrDefault(id => id.ProjectId == project.Id);
Shared\Extensions\SyntaxGeneratorExtensions.cs (1)
80&& (await SymbolFinder.FindSourceDefinitionAsync(overriddenProperty, document.Project.Solution, cancellationToken).ConfigureAwait(false))
Simplification\Simplifier.cs (3)
75return Expand(node, semanticModel, document.Project.Solution.Services, expandInsideNode, expandParameter, cancellationToken); 120return Expand(token, semanticModel, document.Project.Solution.Services, expandInsideNode, cancellationToken); 258var simplificationService = document.Project.Solution.Services.GetRequiredLanguageService<ISimplificationService>(document.Project.Language);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\ForkingSyntaxEditorBasedCodeFixProvider.cs (1)
71var solutionServices = document.Project.Solution.Services;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\SyntaxEditorBasedCodeFixProvider.cs (1)
75var editor = new SyntaxEditor(root, document.Project.Solution.Services);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (3)
93var workspace = document.Project.Solution.Workspace; 158var semanticModelService = document.Project.Solution.Services.GetRequiredService<ISemanticModelReuseWorkspaceService>(); 214var solution = document.Project.Solution;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ProjectExtensions.cs (2)
39=> project.Solution.Services.GetExtendedLanguageServices(project.Language); 90var solutionOrProjectFilePath = project.Solution?.FilePath ?? project.FilePath;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\TextDocumentExtensions.cs (2)
51return textDocument.Project.Solution.WithAdditionalDocumentText(textDocument.Id, text, PreservationMode.PreserveIdentity).GetTextDocument(textDocument.Id)!; 60return textDocument.Project.Solution.WithAnalyzerConfigDocumentText(textDocument.Id, text, PreservationMode.PreserveIdentity).GetTextDocument(textDocument.Id)!;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\InitializeParameter\AbstractInitializerParameterService.cs (4)
108return document.Project.Solution; 124var editor = new SyntaxEditor(root, document.Project.Solution.Services); 128return newDocument.Project.Solution; 131return document.Project.Solution;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.cs (1)
84var editor = new SyntaxEditor(root, document.Project.Solution.Services);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (1)
91var findReferencesResult = await SymbolFinder.FindReferencesAsync(LocalSymbol, document.Project.Solution, cancellationToken).ConfigureAwait(false);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Workspace\Host\SupportedChangesServiceExtensions.cs (1)
13=> project.Solution.Services.GetRequiredService<ISupportedChangesService>().CanApplyParseOptionChange(oldOptions, newOptions, project);
Workspace\Host\PersistentStorage\ProjectKey.cs (1)
35=> ToProjectKey(project.Solution.SolutionState, project.State);
Workspace\Solution\Document.cs (11)
332this.Project.Solution.OnSemanticModelObtained(this.Id, semanticModel); 385=> this.Project.Solution.WithDocumentSourceCodeKind(this.Id, kind).GetRequiredDocument(Id); 392var solution = this.Project.Solution.WithDocumentText(this.Id, text, PreservationMode.PreserveIdentity); 408var solution = this.Project.Solution.WithDocumentSyntaxRoot(this.Id, root, PreservationMode.PreserveIdentity); 423=> this.Project.Solution.WithDocumentName(this.Id, name).GetRequiredDocument(Id); 429=> this.Project.Solution.WithDocumentFolders(this.Id, folders).GetRequiredDocument(Id); 435=> this.Project.Solution.WithDocumentFilePath(this.Id, filePath).GetRequiredDocument(Id); 524var filteredDocumentIds = this.Project.Solution.GetRelatedDocumentIds(this.Id); 557var solution = this.Project.Solution; 566var newSolution = this.Project.Solution.WithFrozenPartialCompilationIncludingSpecificDocument(this.Id, cancellationToken); 593InitializeCachedOptions(Project.Solution.Options);
Workspace\Solution\Project.cs (47)
24/// Represents a project that is part of a <see cref="Solution"/>. 136public IEnumerable<ProjectReference> ProjectReferences => State.ProjectReferences.Where(pr => this.Solution.ContainsProject(pr.ProjectId)); 232=> Solution.GetDocumentId(syntaxTree, this.Id); 238=> Solution.GetDocument(syntaxTree, this.Id); 318var generatedDocumentStates = await Solution.CompilationState.GetSourceGeneratedDocumentStatesAsync(this.State, cancellationToken).ConfigureAwait(false); 350var generatedDocumentStates = await Solution.CompilationState.GetSourceGeneratedDocumentStatesAsync(State, cancellationToken).ConfigureAwait(false); 385var documentState = Solution.CompilationState.TryGetSourceGeneratedDocumentStateForAlreadyGeneratedId(documentId); 394return Solution.CompilationState.GetSourceGeneratorDiagnosticsAsync(this.State, cancellationToken); 399return Solution.CompilationState.GetSourceGeneratorRunResultAsync(this.State, cancellationToken); 513=> Solution.CompilationState.TryGetCompilation(this.Id, out compilation); 524=> Solution.CompilationState.GetCompilationAsync(State, cancellationToken); 531=> Solution.CompilationState.HasSuccessfullyLoadedAsync(State, cancellationToken); 561=> Solution.CompilationState.GetDependentVersionAsync(this.Id, cancellationToken); 568=> Solution.CompilationState.GetDependentSemanticVersionAsync(this.Id, cancellationToken); 581=> this.Solution.WithProjectAssemblyName(this.Id, assemblyName).GetRequiredProject(Id); 587=> this.Solution.WithProjectDefaultNamespace(this.Id, defaultNamespace).GetRequiredProject(Id); 590=> Solution.WithProjectOutputFilePath(Id, path).GetRequiredProject(Id); 593=> Solution.WithProjectOutputRefFilePath(Id, path).GetRequiredProject(Id); 596=> Solution.WithProjectCompilationOutputInfo(Id, info).GetRequiredProject(Id); 602=> this.Solution.WithProjectCompilationOptions(this.Id, options).GetRequiredProject(Id); 608=> this.Solution.WithProjectParseOptions(this.Id, options).GetRequiredProject(Id); 615=> this.Solution.AddProjectReference(this.Id, projectReference).GetRequiredProject(Id); 622=> this.Solution.AddProjectReferences(this.Id, projectReferences).GetRequiredProject(Id); 628=> this.Solution.RemoveProjectReference(this.Id, projectReference).GetRequiredProject(Id); 635=> this.Solution.WithProjectReferences(this.Id, projectReferences).GetRequiredProject(Id); 642=> this.Solution.AddMetadataReference(this.Id, metadataReference).GetRequiredProject(Id); 649=> this.Solution.AddMetadataReferences(this.Id, metadataReferences).GetRequiredProject(Id); 655=> this.Solution.RemoveMetadataReference(this.Id, metadataReference).GetRequiredProject(Id); 662=> this.Solution.WithProjectMetadataReferences(this.Id, metadataReferences).GetRequiredProject(Id); 669=> this.Solution.AddAnalyzerReference(this.Id, analyzerReference).GetRequiredProject(Id); 676=> this.Solution.AddAnalyzerReferences(this.Id, analyzerReferences).GetRequiredProject(Id); 682=> this.Solution.RemoveAnalyzerReference(this.Id, analyzerReference).GetRequiredProject(Id); 689=> this.Solution.WithProjectAnalyzerReferences(this.Id, analyzerReferencs).GetRequiredProject(Id); 696=> Solution.WithProjectAttributes(attributes).GetRequiredProject(Id); 707return this.Solution.AddDocument(id, name, syntaxRoot, folders, filePath, preservationMode: PreservationMode.PreserveIdentity).GetDocument(id)!; 716return this.Solution.AddDocument(id, name, text, folders, filePath).GetDocument(id)!; 725return this.Solution.AddDocument(id, name, text, folders, filePath).GetDocument(id)!; 734return this.Solution.AddAdditionalDocument(id, name, text, folders, filePath).GetAdditionalDocument(id)!; 743return this.Solution.AddAdditionalDocument(id, name, text, folders, filePath).GetAdditionalDocument(id)!; 752return this.Solution.AddAnalyzerConfigDocument(id, name, text, folders, filePath).GetAnalyzerConfigDocument(id)!; 762return this.Solution.RemoveDocument(documentId).GetRequiredProject(Id); 772return this.Solution.RemoveDocuments(documentIds).GetRequiredProject(this.Id); 781=> this.Solution.RemoveAdditionalDocument(documentId).GetRequiredProject(Id); 790return this.Solution.RemoveAdditionalDocuments(documentIds).GetRequiredProject(this.Id); 799=> this.Solution.RemoveAnalyzerConfigDocument(documentId).GetRequiredProject(Id); 808return this.Solution.RemoveAnalyzerConfigDocuments(documentIds).GetRequiredProject(this.Id); 830=> Solution.FallbackAnalyzerOptions.GetValueOrDefault(Language, StructuredAnalyzerConfigOptions.Empty);
Workspace\Solution\SolutionCompilationState.cs (1)
1857if (!projectWithCachedGeneratorState.Solution.CompilationState.TryGetCompilationTracker(projectWithCachedGeneratorState.Id, out var tracker) ||
Workspace\Workspace.cs (2)
859oldSolution.RemoveProject(projectId).AddProject(reloadedProjectInfo).GetRequiredProject(projectId)).Solution; 1516solution = project.Solution;
Workspace\Workspace_Editor.cs (4)
872newSolution = document.WithText(this.GetOpenDocumentText(oldSolution, docId)).Project.Solution; 881var oldSolution = oldProject.Solution; 882var newSolution = reloadedProject.Solution; 890newSolution = document.WithText(this.GetOpenDocumentText(oldSolution, docId)).Project.Solution;
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (15)
NetCoreTests.cs (2)
200Assert.Equal(projectRefFilePath, project.Solution.GetProject(projectRefId).FilePath); 546Assert.Equal(projectRefFilePath, project.Solution.GetProject(projectRefId).FilePath);
VisualStudioMSBuildWorkspaceTests.cs (13)
351var p2 = p1.Solution.Projects.First(p => p.Language == LanguageNames.VisualBasic); 1230Assert.Single(project.Solution.ProjectIds); // didn't really open referenced project due to invalid file path. 1259Assert.Single(project.Solution.ProjectIds); // didn't really open referenced project due to invalid file path. 1292Assert.Single(project.Solution.ProjectIds); // didn't really open referenced project due to unrecognized extension. 1327Assert.Single(project.Solution.ProjectIds); 1348Assert.Single(project.Solution.ProjectIds); 1368Assert.Single(project.Solution.ProjectIds); 2458Assert.NotNull(project.Solution.GetProjectsByName("CSharpProject").SingleOrDefault()); 2897var noEncodingSolution = noEncodingDoc.Project.Solution; 2926workspace.TryApplyChanges(project.AddAnalyzerReference(aref).Solution); 2931workspace.TryApplyChanges(workspace.CurrentSolution.GetProject(project.Id).RemoveAnalyzerReference(aref).Solution); 2952workspace.TryApplyChanges(workspace.CurrentSolution.GetProject(project.Id).RemoveProjectReference(pref).Solution); 2959workspace.TryApplyChanges(workspace.CurrentSolution.GetProject(project.Id).AddProjectReference(pref).Solution);
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (1)
WorkspaceExtensions.cs (1)
19var newSolution = oldSolution.AddDocument(id, name, initialText, folders).GetDocument(id)!.WithSourceCodeKind(sourceCodeKind).Project.Solution;
Microsoft.CodeAnalysis.Workspaces.UnitTests (101)
FindReferencesTests.cs (5)
188var references = await SymbolFinder.FindReferencesAsync(symbol, prj.Solution); 193references = await SymbolFinder.FindReferencesAsync(symbol, prj.Solution); 224var references = await SymbolFinder.FindReferencesAsync(symbol, prj.Solution); 292var references = await SymbolFinder.FindReferencesAsync(symbol, prj.Solution); 297references = await SymbolFinder.FindReferencesAsync(symbol, prj.Solution);
Formatter\FormatterTests.cs (1)
78document = document.Project.Solution.WithOptions(solutionOptions).GetRequiredDocument(document.Id);
SolutionTests\SolutionTests.cs (42)
2788.Project.Solution; 3695var doc2 = doc.Project.Solution.WithDocumentSyntaxRoot(doc.Id, newRoot, PreservationMode.PreserveValue).GetDocument(doc.Id); 3698var observed2 = GetObservedSyntaxTreeRootAsync(doc2.Project.Solution, did); 4145var solution = project.Solution.WithDocumentText(documentToFreezeOriginal.Id, SourceText.From("class DocumentToFreeze { void M() { /*no top level change*/ } }")); 4190var solution = project.Solution.WithDocumentText(documentToFreezeOriginal.Id, SourceText.From("class DocumentToFreeze { void M() { } public void NewMethod() { } }")); 4255var frozenSolution = document.WithFrozenPartialSemantics(CancellationToken.None).Project.Solution; 4367var solution = workspace.CurrentSolution.AddProject("TestProject", "TestProject", LanguageNames.CSharp).Solution; 4426currentSolution = document1.Project.Solution; 4430currentSolution = document2.Project.Solution; 4452var frozenDoc2 = frozenDoc1.Project.Solution.GetRequiredDocument(document2.Id); 4467var frozenDoc1 = frozenDoc2.Project.Solution.GetRequiredDocument(document1.Id); 5293.AddProject("CS2", "CS2", LanguageNames.CSharp).Solution 5294.AddProject("NC1", "NC1", NoCompilationConstants.LanguageName).Solution; 5433var s2 = s1.AddProject("P1", "A1", LanguageNames.VisualBasic).Solution; 5472var newDoc = doc.Project.Solution.WithDocumentSyntaxRoot(doc.Id, newRoot).GetDocument(doc.Id); 5504static (sourceText, document) => document.Project.Solution.WithDocumentText(document.Id, sourceText, PreservationMode.PreserveIdentity), 5579.AddAdditionalDocument("File.cs", text: "", filePath: FilePath).Project.Solution; 5598.AddDocument("File.cs", "", filePath: "File.cs").Project.Solution 5600.AddDocument("file.cs", "", filePath: "file.cs").Project.Solution; 5615var frozenSolution = project.Solution.WithFrozenPartialCompilations(CancellationToken.None); 5634var frozenSolution = project.Solution.WithFrozenPartialCompilations(CancellationToken.None); 5648var project2 = project1.Solution.AddProject("CSharpProject2", "CSharpProject2", LanguageNames.CSharp); 5649project1 = project2.Solution.GetProject(project1.Id).AddDocument("Doc1", SourceText.From("class Doc1 { }")).Project; 5650project2 = project1.Solution.GetProject(project2.Id).AddDocument("Doc2", SourceText.From("class Doc2 { }")).Project; 5651project1 = project2.Solution.GetProject(project1.Id); 5656var frozenSolution = project1.Solution.WithFrozenPartialCompilations(CancellationToken.None); 5676var project2 = project1.Solution.AddProject("CSharpProject2", "CSharpProject2", LanguageNames.CSharp); 5677project1 = project2.Solution.GetProject(project1.Id).AddDocument("Doc1", SourceText.From("class Doc1 { }")).Project; 5678project2 = project1.Solution.GetProject(project2.Id).AddDocument("Doc2", SourceText.From("class Doc2 { }")).Project; 5681project1 = project2.Solution.GetProject(project1.Id); 5686var frozenSolution = project1.Solution.WithFrozenPartialCompilations(CancellationToken.None); 5706var project2 = project1.Solution.AddProject("CSharpProject2", "CSharpProject2", LanguageNames.CSharp); 5707project1 = project2.Solution.GetProject(project1.Id).AddDocument("Doc1", SourceText.From("class Doc1 { }")).Project; 5708project2 = project1.Solution.GetProject(project2.Id).AddDocument("Doc2", SourceText.From("class Doc2 { }")).Project; 5711project1 = project2.Solution.GetProject(project1.Id); 5716var frozenSolution = project1.Solution.WithFrozenPartialCompilations(CancellationToken.None); 5746var frozenSolution = project1.Solution.WithFrozenPartialCompilations(CancellationToken.None); 5784? project1.Solution.WithFrozenPartialCompilations(CancellationToken.None) 5785: project1.Solution; 5819var frozenSolution = project.Solution.WithFrozenPartialCompilations(CancellationToken.None); 5846var project2 = project1.Solution 5853_ => project2.Solution,
SolutionTests\SolutionWithSourceGeneratorTests.cs (40)
190var generatorDriver = project.Solution.CompilationState.GetTestAccessor().GetGeneratorDriver(project)!; 210generatorDriver = project.Solution.CompilationState.GetTestAccessor().GetGeneratorDriver(project)!; 234generatorDriver = project.Solution.CompilationState.GetTestAccessor().GetGeneratorDriver(project)!; 264project = project.Solution.WithDocumentText(documentId, SourceText.From("// Changed Source File")).Projects.Single(); 307project = project.Solution.WithAdditionalDocumentText(additionalDocumentId, SourceText.From("Hello, everyone!")).Projects.Single(); 312project = project.Solution.WithAdditionalDocumentText(additionalDocumentId, SourceText.From("Good evening, everyone!")).Projects.Single(); 374projectBeforeChange.Solution.WithAdditionalDocumentText( 411return project.Solution; 422.AddAdditionalDocument("Test.txt", "Hello, world!").Project.Solution; 593Assert.True(workspace.SetCurrentSolution(_ => project.Solution, WorkspaceChangeKind.SolutionChanged)); 602Assert.NotSame(workspace.CurrentSolution, generatedDocument.Project.Solution); 617Assert.True(workspace.SetCurrentSolution(_ => project.Solution, WorkspaceChangeKind.SolutionChanged)); 625Assert.Same(workspace.CurrentSolution, generatedDocument!.Project.Solution); 637Assert.True(workspace.SetCurrentSolution(_ => originalAdditionalFile.Project.Solution, WorkspaceChangeKind.SolutionChanged)); 662.AddAnalyzerReference(analyzerReference).Solution; 666new ProjectReference(projectIdWithGenerator)).Solution; 695Assert.True(workspace.SetCurrentSolution(_ => project.Solution, WorkspaceChangeKind.SolutionChanged)); 724Assert.True(workspace.SetCurrentSolution(_ => project.Solution, WorkspaceChangeKind.SolutionChanged)); 815var originalDocument2 = AddEmptyProject(originalDocument1.Project.Solution, name: "Project2") 819var frozenSolution = originalDocument2.WithFrozenPartialSemantics(CancellationToken.None).Project.Solution; 854project = project.Solution.AddDocument(documentInfo).Projects.Single() 888var frozenWithSingleDocument = project.Solution.WithFrozenSourceGeneratedDocument( 905var solution = AddEmptyProject(workspace.CurrentSolution).AddAnalyzerReference(analyzerReference).Solution; 908solution = project2.Solution; 935var frozenSolution = project.Solution.WithFrozenSourceGeneratedDocument( 937Assert.Same(project.Solution, frozenSolution.Project.Solution); 951var checksum0 = await project0.Solution.SolutionState.GetChecksumAsync(CancellationToken.None); 954var checksum1 = await project1.Solution.SolutionState.GetChecksumAsync(CancellationToken.None); 960var checksum2 = await project2.Solution.SolutionState.GetChecksumAsync(CancellationToken.None); 970var checksum3 = await project3.Solution.SolutionState.GetChecksumAsync(CancellationToken.None); 999var solution = project.Solution.WithDocumentTexts( 1276var frozenWithSingleDocument = project.Solution.WithFrozenSourceGeneratedDocument( 1313var frozenWithSingleDocument = project.Solution.WithFrozenSourceGeneratedDocument( 1338var changes = new SolutionChanges(newSolution, project.Solution); 1344var frozenWithSingleDocument = project.Solution.WithFrozenSourceGeneratedDocument( 1350return frozenWithSingleDocument.Project.Solution; 1374var changes = new SolutionChanges(newSolution, project.Solution); 1379var frozenWithSingleDocument = project.Solution.WithFrozenSourceGeneratedDocument( 1385return frozenWithSingleDocument.Project.Solution;
SolutionTests\TryApplyChangesTests.cs (4)
79Assert.True(workspace.TryApplyChanges(project.WithCompilationOptions(project.CompilationOptions!.WithMainTypeName("Test")).Solution)); 92Assert.True(workspace.TryApplyChanges(project.WithCompilationOptions(project.CompilationOptions!.WithMainTypeName("Test")).Solution)); 106() => workspace.TryApplyChanges(project.WithCompilationOptions(project.CompilationOptions!.WithMainTypeName("WrongThing")).Solution)); 166Assert.True(workspace.TryApplyChanges(project.AddAnalyzerConfigDocument(".editorconfig", SourceText.From("")).Project.Solution));
SymbolKeyTests.cs (2)
875workspace.TryApplyChanges(document.WithText(updated).Project.Solution); 922workspace.TryApplyChanges(document.WithText(updated).Project.Solution);
WorkspaceTests\AdhocWorkspaceTests.cs (3)
432Assert.True(ws.TryApplyChanges(changedDoc.Project.Solution)); 499Assert.True(ws.TryApplyChanges(changedDoc.Project.Solution)); 530Assert.True(ws.TryApplyChanges(changedDoc.Project.Solution));
WorkspaceTests\WorkspaceTests.cs (4)
30Assert.Throws<NotSupportedException>(() => ws.TryApplyChanges(changedDoc.Project.Solution)).Message); 46Assert.Throws<NotSupportedException>(() => ws.TryApplyChanges(changedDoc.Project.Solution)).Message); 81Assert.Throws<NotSupportedException>(() => ws.TryApplyChanges(changedDoc.Project.Solution)).Message); 97Assert.Throws<NotSupportedException>(() => ws.TryApplyChanges(changedDoc.Project.Solution)).Message);
Microsoft.Gen.ComplianceReports.Unit.Tests (2)
test\Generators\Shared\RoslynTestUtils.cs (2)
90Assert.True(proj.Solution.Workspace.TryApplyChanges(proj.Solution));
Microsoft.Gen.ContextualOptions.Unit.Tests (2)
test\Generators\Shared\RoslynTestUtils.cs (2)
90Assert.True(proj.Solution.Workspace.TryApplyChanges(proj.Solution));
Microsoft.Gen.Logging.Unit.Tests (2)
test\Generators\Shared\RoslynTestUtils.cs (2)
90Assert.True(proj.Solution.Workspace.TryApplyChanges(proj.Solution));
Microsoft.Gen.MetadataExtractor.Unit.Tests (2)
test\Generators\Shared\RoslynTestUtils.cs (2)
90Assert.True(proj.Solution.Workspace.TryApplyChanges(proj.Solution));
Microsoft.Gen.Metrics.Unit.Tests (2)
test\Generators\Shared\RoslynTestUtils.cs (2)
90Assert.True(proj.Solution.Workspace.TryApplyChanges(proj.Solution));
Microsoft.Gen.MetricsReports.Unit.Tests (2)
test\Generators\Shared\RoslynTestUtils.cs (2)
90Assert.True(proj.Solution.Workspace.TryApplyChanges(proj.Solution));
Microsoft.Interop.ComInterfaceGenerator (1)
src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (1)
140ct => ApplyActionAndEnableUnsafe(doc.Project.Solution, doc.Id, fix.ApplyFix, ct),
Microsoft.Interop.LibraryImportGenerator (4)
Analyzers\AddDisableRuntimeMarshallingAttributeFixer.cs (1)
68return editor.GetChangedDocument().Project.Solution;
Analyzers\ConvertToLibraryImportFixer.cs (1)
275methodSymbol, document.Project.Solution, cancellationToken).ConfigureAwait(false);
Analyzers\CustomMarshallerAttributeFixer.cs (1)
169SymbolEditor editor = SymbolEditor.Create(doc.Project.Solution);
src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (1)
140ct => ApplyActionAndEnableUnsafe(doc.Project.Solution, doc.Id, fix.ApplyFix, ct),
Microsoft.ML.CodeAnalyzer.Tests (1)
Code\BestFriendTest.cs (1)
72solution = projectA.Solution;
Microsoft.ML.InternalCodeAnalyzer (2)
NameFixProvider.cs (2)
112var originalSolution = document.Project.Solution; 114var newSolution = await Renamer.RenameSymbolAsync(document.Project.Solution, typeSymbol, newName, optionSet, cancellationToken).ConfigureAwait(false);
Microsoft.VisualStudio.LanguageServices (68)
CallHierarchy\CallHierarchyCommandHandler.cs (1)
97var notificationService = document.Project.Solution.Services.GetRequiredService<INotificationService>();
CallHierarchy\CallHierarchyItem.cs (1)
40_workspace = project.Solution.Workspace;
CallHierarchy\CallHierarchyProvider.cs (3)
66symbol, project.Solution, this.ThreadingContext, _streamingPresenter.Value, cancellationToken).ConfigureAwait(false); 116var @overrides = await SymbolFinder.FindOverridesAsync(symbol, project.Solution, cancellationToken: cancellationToken).ConfigureAwait(false); 127var implementedInterfaceMembers = await SymbolFinder.FindImplementedInterfaceMembersAsync(symbol, project.Solution, cancellationToken: cancellationToken).ConfigureAwait(false);
CallHierarchy\Finders\AbstractCallFinder.cs (5)
120var documentTrackingService = project.Solution.Services.GetRequiredService<IDocumentTrackingService>(); 126var currentProject = project.Solution.GetProject(activeDocument.ProjectId); 134var currentDocument = project.Solution.GetDocument(activeDocument); 161loc => new CallHierarchyDetail(this.Provider, loc, project.Solution.Workspace))); 165var callingProject = project.Solution.GetProject(caller.CallingSymbol.ContainingAssembly, cancellationToken);
CallHierarchy\Finders\BaseMemberFinder.cs (1)
29var calls = await SymbolFinder.FindCallersAsync(symbol, project.Solution, documents, cancellationToken).ConfigureAwait(false);
CallHierarchy\Finders\CallToOverrideFinder.cs (2)
25var overrides = await SymbolFinder.FindOverridesAsync(symbol, project.Solution, cancellationToken: cancellationToken).ConfigureAwait(false); 30var calls = await SymbolFinder.FindCallersAsync(@override, project.Solution, documents, cancellationToken).ConfigureAwait(false);
CallHierarchy\Finders\FieldReferenceFinder.cs (1)
32var callers = await SymbolFinder.FindCallersAsync(symbol, project.Solution, documents, cancellationToken).ConfigureAwait(false);
CallHierarchy\Finders\ImplementerFinder.cs (2)
38var implementations = await SymbolFinder.FindImplementationsAsync(symbol, project.Solution, cancellationToken: cancellationToken).ConfigureAwait(false); 42var sourceLocations = implementation.DeclaringSyntaxReferences.Select(d => project.Solution.GetDocument(d.SyntaxTree)).WhereNotNull();
CallHierarchy\Finders\InterfaceImplementationCallFinder.cs (1)
32var calls = await SymbolFinder.FindCallersAsync(symbol, project.Solution, documents, cancellationToken).ConfigureAwait(false);
CallHierarchy\Finders\MethodCallFinder.cs (1)
35var callers = await SymbolFinder.FindCallersAsync(symbol, project.Solution, documents, cancellationToken).ConfigureAwait(false);
CallHierarchy\Finders\OverridingMemberFinder.cs (2)
34var overrides = await SymbolFinder.FindOverridesAsync(symbol, project.Solution, cancellationToken: cancellationToken).ConfigureAwait(false); 38var sourceLocations = @override.DeclaringSyntaxReferences.Select(d => project.Solution.GetDocument(d.SyntaxTree)).WhereNotNull();
DebuggerIntelliSense\AbstractDebuggerIntelliSenseContext.cs (1)
131var solution = document.Project.Solution;
ExtractClass\VisualStudioExtractClassOptionsService.cs (1)
50var solution = document.Project.Solution;
ExtractInterface\VisualStudioExtractInterfaceOptionsService.cs (1)
48var solution = document.Project.Solution;
FindReferences\Entries\DocumentSpanEntry.cs (2)
183var controlService = document.Project.Solution.Services.GetRequiredService<IContentControlService>(); 194var clonedBuffer = excerpt.Value.Content.CreateTextBufferWithRoslynContentType(document.Project.Solution.Workspace);
FindReferences\StreamingFindUsagesPresenter.cs (1)
279var vsWorkspace = document.Project.Solution.Workspace as VisualStudioWorkspace;
GenerateType\GenerateTypeDialogViewModel.cs (4)
439this.ProjectFolders = _projectManagementService.GetFolders(this.SelectedProject.Id, this.SelectedProject.Solution.Workspace); 727var dependencyGraph = document.Project.Solution.GetProjectDependencyGraph(); 739projectListing.AddRange(document.Project.Solution.Projects 777this.ProjectFolders = _projectManagementService.GetFolders(this.SelectedProject.Id, this.SelectedProject.Solution.Workspace);
GenerateType\VisualStudioGenerateTypeOptionsServiceFactory.cs (1)
67var defaultNamespace = projectManagementService.GetDefaultNamespace(viewModel.SelectedProject, viewModel.SelectedProject?.Solution.Workspace);
Implementation\AbstractEditorFactory.cs (1)
326var forkedSolution = projectToAddTo.Solution.AddDocument(
Implementation\VisualStudioSupportsFeatureService.cs (1)
97=> SupportsRenameWorker(document.Project.Solution.GetRelatedDocumentIds(document.Id));
InheritanceMargin\InheritanceMarginTaggerProvider.cs (1)
79if (document.Project.Solution.WorkspaceKind == WorkspaceKind.Interactive)
LanguageServer\Handler\Diagnostics\VisualStudioDiagnosticProjectInformationService.cs (1)
21if (project.Solution.Workspace is VisualStudioWorkspace workspace)
LanguageService\AbstractLanguageService`2.cs (1)
159if (openDocument?.Project.Solution.Workspace is MetadataAsSourceWorkspace masWorkspace)
Library\ObjectBrowser\Extensions.cs (4)
68else if (project.Solution.Workspace is VisualStudioWorkspace workspace 83foreach (var other in project.Solution.Projects) 102if (project.Solution.Workspace is not VisualStudioWorkspaceImpl) 126if (project.Solution.Workspace is not VisualStudioWorkspace workspace)
Library\VsNavInfo\NavInfoFactory.cs (1)
178if (project.Solution.Workspace is not VisualStudioWorkspace workspace)
Preview\FileChange.cs (1)
222var workspace = document.Project.Solution.Workspace;
Preview\PreviewUpdater.cs (1)
72_previewWorkspace ??= new PreviewDialogWorkspace(document.Project.Solution);
Preview\ReferenceChange.cs (2)
31var oldSolution = projectChanges.OldProject.Solution; 32var newSolution = projectChanges.NewProject.Solution;
Preview\TopLevelChange.cs (1)
89var oldLinkedDocument = oldDocument.Project.Solution.GetDocument(linkedDocumentId);
Progression\GraphBuilder.cs (2)
162var thisProject = project.Solution.GetProject(symbol.ContainingAssembly) ?? project; 213var newSymbol = await SymbolFinder.FindSourceDefinitionAsync(symbol, contextProject.Solution, cancellationToken).ConfigureAwait(false);
ProjectSystem\VisualStudioWorkspaceImpl.AbstractAddDocumentUndoUnit.cs (1)
36Workspace.TryApplyChanges(updatedProject.Solution);
ProjectSystem\VisualStudioWorkspaceImpl.AbstractRemoveDocumentUndoUnit.cs (1)
39Workspace.TryApplyChanges(updatedProject.Solution);
ProjectSystem\VisualStudioWorkspaceImpl.AddMetadataReferenceUndoUnit.cs (1)
51Workspace.TryApplyChanges(updatedProject.Solution);
ProjectSystem\VisualStudioWorkspaceImpl.AddProjectReferenceUndoUnit.cs (1)
37Workspace.TryApplyChanges(updatedProject.Solution);
ProjectSystem\VisualStudioWorkspaceImpl.RemoveMetadataReferenceUndoUnit.cs (1)
40Workspace.TryApplyChanges(updatedProject.Solution);
ProjectSystem\VisualStudioWorkspaceImpl.RemoveProjectReferenceUndoUnit.cs (1)
37Workspace.TryApplyChanges(updatedProject.Solution);
PullMemberUp\VisualStudioPullMemberUpService.cs (1)
60document.Project.Solution,
Snippets\SnippetExpansionClient.cs (3)
772var semanticInfo = semanticModel.GetSemanticInfo(token, document.Project.Solution.Services, cancellationToken); 904foreach (var provider in GetArgumentProviders(document.Project.Solution.Workspace)) 1085var workspace = originalProject.Solution.Workspace;
ValueTracking\ValueTrackingCommandHandler.cs (1)
123var solution = document.Project.Solution;
Venus\ContainedDocument.cs (1)
807var services = document.Project.Solution.Services;
Venus\ContainedLanguage.IVsContainedLanguageCodeSupport.cs (1)
51var targetDocument = thisDocument.Project.Solution.GetDocument(targetDocumentId);
Venus\ContainedLanguageCodeSupport.cs (4)
231targetDocument.Project.Solution.Services, 272var memberNodeDocument = thisDocument.Project.Solution.GetDocument(memberNode.SyntaxTree); 329var newSolution = Renamer.RenameSymbolAsync(document.Project.Solution, symbol, options, newName, cancellationToken).WaitAndGetResult_Venus(cancellationToken); 330var changedDocuments = newSolution.GetChangedDocuments(document.Project.Solution);
Workspace\VisualStudioSymbolNavigationService.cs (3)
56var solution = project.Solution; 188var definitionItem = symbol.ToNonClassifiedDefinitionItem(project.Solution, includeHiddenLocations: true); 290if (document.Project.Solution.Workspace is VisualStudioWorkspace visualStudioWorkspace
Microsoft.VisualStudio.LanguageServices.CSharp (2)
LanguageService\CSharpHelpContextService.cs (1)
170symbol = semanticModel.GetSemanticInfo(token, document.Project.Solution.Services, cancellationToken)
Snippets\CSharpSnippetExpansionLanguageHelper.cs (1)
102await document.Project.Solution.Workspace.ApplyDocumentChangesAsync(
Microsoft.VisualStudio.LanguageServices.UnitTests (11)
GoToDefinition\GoToDefinitionApiTests.vb (1)
47symbolInfo.Symbol, document.Project.Solution,
Preview\PreviewChangesTests.vb (5)
49forkedDocument.Project.Solution, 97Dim newSolution = forkedDocument.Project.Solution 144forkedDocument.Project.Solution, 192Dim newSolution = forkedDocument.Project.Solution 281Dim updatedSolution = document1.Project.Solution _
PullMemberUp\PullMemberUpViewModelTest.vb (1)
257Dim baseTypeTree = BaseTypeTreeNodeViewModel.CreateBaseTypeTree(glyphService:=Nothing, workspaceDoc.Project.Solution, memberSymbol.ContainingType, CancellationToken.None)
Venus\DocumentService_IntegrationTests.vb (4)
198Assert.True(workspace.TryApplyChanges(newDocument.Project.Solution)) 205Assert.Throws(Of NotSupportedException)(Sub() workspace.TryApplyChanges(newDocument.Project.Solution)) 270Dim testWorkspace = DirectCast(document.Project.Solution.Workspace, EditorTestWorkspace) 308Dim testWorkspace = DirectCast(document.Project.Solution.Workspace, EditorTestWorkspace)
Microsoft.VisualStudio.LanguageServices.VisualBasic (4)
Help\VisualBasicHelpContextService.vb (1)
48Dim visitor = New Visitor(token.Span, Await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(False), document.Project.Solution.WorkspaceKind <> WorkspaceKind.MetadataAsSource, Me, cancellationToken)
Snippets\VisualBasicSnippetExpansionLanguageHelper.vb (1)
71Await document.Project.Solution.Workspace.ApplyDocumentChangesAsync(Me.ThreadingContext, formattedDocument, cancellationToken).configureawait(True)
Venus\ContainedLanguageStaticEventBinding.vb (2)
65Dim targetDocument = document.Project.Solution.GetDocument(memberSymbol.Locations.First().SourceTree) 93Dim targetDocument = document.Project.Solution.GetDocument(memberSymbol.Locations.First().SourceTree)
Microsoft.VisualStudio.LanguageServices.Xaml (4)
Extensions.cs (1)
34return document.Project.Solution.Projects.Single(p => p.SupportsCompilation && p.FilePath == document.Project.FilePath);
Features\InlineRename\XamlEditorInlineRenameService.cs (1)
90_renameInfo, _document.Project.Solution,
Implementation\LanguageServer\Extensions\SymbolExtensions.cs (1)
54var services = codeProject.Solution.Services;
Implementation\LanguageServer\Handler\Definitions\GoToDefinitionHandler.cs (1)
61var solution = document.Project.Solution;
Roslyn.Diagnostics.Analyzers (3)
AbstractExposeMemberForTesting`1.cs (3)
115return document.Project.Solution; 163return document.Project.Solution; 167return document.WithSyntaxRoot(syntaxRoot.ReplaceNode(testAccessorTypeDeclaration, newTypeDeclaration)).Project.Solution;
Roslyn.Diagnostics.CSharp.Analyzers (2)
CSharpAvoidOptSuffixForNullableEnableCodeCodeFixProvider.cs (2)
67=> await Renamer.RenameSymbolAsync(document.Project.Solution, variableSymbol, newName, document.Project.Solution.Options, cancellationToken)
Roslyn.VisualStudio.Next.UnitTests (38)
Remote\RemoteHostClientServiceFactoryTests.cs (1)
52var newSolution = document.Project.Solution.WithDocumentText(document.Id, newText, PreservationMode.PreserveIdentity);
Remote\SnapshotSerializationTests.cs (2)
53var project2 = document1.Project.Solution.AddProject("Project2", "Project2.dll", LanguageNames.VisualBasic); 56solution = document2.Project.Solution.GetRequiredProject(project1.Id)
Services\ServiceHubServicesTests.cs (5)
1730return document.WithText(GetNewText(document, csAddition, vbAddition)).Project.Solution; 1849solution = project.Solution; 1854solution = current.AddDocument($"Document{i}", SourceText.From(documents[i])).Project.Solution; 1860solution = current.AddAdditionalDocument($"AdditionalDocument{i}", SourceText.From(additionalDocuments[i])).Project.Solution; 1866solution = current.AddProjectReference(new ProjectReference(p2pReferences[i])).Solution;
Services\SolutionAssetCacheTests.cs (1)
108workspace.SetCurrentSolution(solution => solution.AddProject("Project", "Assembly", LanguageNames.CSharp).Solution, WorkspaceChangeKind.ProjectAdded);
Services\SolutionServiceTests.cs (29)
221solution = solution.AddProject("CS" + i, "CS" + i, LanguageNames.CSharp).Solution; 224.AddProject("VB1", "VB1", LanguageNames.VisualBasic).Solution; 307s = s.AddProject("newProject", "newProject", LanguageNames.CSharp).Solution; 320return document.Project.Solution; 511.Solution; 522var frozenSolution1 = solution.WithFrozenSourceGeneratedDocument(documentIdentity, DateTime.Now, frozenText1).Project.Solution; 531var frozenSolution2 = solution.WithFrozenSourceGeneratedDocument(documentIdentity, DateTime.Now, frozenText2).Project.Solution; 552solution = project2.Solution; 593solution = project2.Solution; 633var project3 = project2.Solution.AddProject("P3", "P3", LanguageNames.CSharp); 635solution = project3.Solution.AddProjectReference(project3.Id, new(project3.Solution.Projects.Single(p => p.Name == "P2").Id)); 666var project3 = project2.Solution.AddProject("P3", "P3", LanguageNames.CSharp); 668solution = project3.Solution.AddProjectReference(project3.Id, new(project3.Solution.Projects.Single(p => p.Name == "P2").Id)); 707var project3 = project2.Solution.AddProject("P3", "P3", LanguageNames.CSharp); 709solution = project3.Solution.AddProjectReference(project3.Id, new(project2.Id)) 747var project3 = project2.Solution.AddProject("P3", "P3", LanguageNames.CSharp); 749solution = project3.Solution.AddProjectReference(project3.Id, new(project2.Id)) 788solution = project2.Solution; 821solution = project2.Solution; 834solution = solution.GetProject(project1.Id).AddDocument("X.cs", SourceText.From("// X")).Project.Solution; 835solution = solution.GetProject(project2.Id).AddDocument("Y.vb", SourceText.From("' Y")).Project.Solution; 876solution = project2.Solution; 889solution = solution.GetProject(project1.Id).AddDocument("X.cs", SourceText.From("// X")).Project.Solution; 890solution = solution.GetProject(project2.Id).AddDocument("Y.cs", SourceText.From("// Y")).Project.Solution; 891solution = solution.GetProject(project1.Id).AddProjectReference(new ProjectReference(project2.Id)).Solution; 925solution = project1.Solution; 945solution = project2.Solution;