1 write to Solution
Microsoft.CodeAnalysis.Workspaces (1)
Workspace\Solution\Project.cs (1)
41Solution = solution;
1610 references to Solution
AnalyzerRunner (2)
CodeRefactoringRunner.cs (2)
95document.Project.Solution, CodeAnalysisProgress.None, cancellationToken).ConfigureAwait(false); 103var changes = applyChangesOperation.ChangedSolution.GetChanges(document.Project.Solution);
GenerateDocumentationAndConfigFiles (17)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\FixAllContextHelper.cs (1)
72var projectsToFix = project.Solution.Projects
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\ForkingSyntaxEditorBasedCodeFixProvider.cs (1)
71var solutionServices = document.Project.Solution.Services;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\SyntaxEditorBasedCodeFixProvider.cs (1)
84var 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)
85var 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);
IdeBenchmarks (1)
RegexClassifierBenchmarks.cs (1)
82var 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 (24)
MetaAnalyzers\Fixers\AnalyzerReleaseTrackingFix.cs (5)
109return Task.FromResult(project.Solution); 174return project.Solution; 178return project.Solution.WithAdditionalDocumentText(unshippedDataDocument.Id, newText); 192return project.Solution; 196return project.Solution.WithAdditionalDocumentText(unshippedDataDocument.Id, newText);
MetaAnalyzers\Fixers\DefineDiagnosticDescriptorArgumentsCorrectlyFix.cs (2)
168return document.WithSyntaxRoot(newRoot).Project.Solution; 178return document.Project.Solution.WithAdditionalDocumentText(fixInfo.AdditionalDocumentToFix.Id, newText);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\FixAllContextHelper.cs (1)
72var projectsToFix = project.Solution.Projects
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\ForkingSyntaxEditorBasedCodeFixProvider.cs (1)
71var solutionServices = document.Project.Solution.Services;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\SyntaxEditorBasedCodeFixProvider.cs (1)
84var 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)
85var 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.Analyzers.UnitTests (2)
MetaAnalyzers\DiagnosticDescriptorCreationAnalyzerTests.cs (2)
1691(solution, projectId) => solution.GetProject(projectId)!.WithAssemblyName(assemblyName).Solution, 1724(solution, projectId) => solution.GetProject(projectId)!.WithAssemblyName(assemblyName).Solution,
Microsoft.CodeAnalysis.BannedApiAnalyzers (17)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\FixAllContextHelper.cs (1)
72var projectsToFix = project.Solution.Projects
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\ForkingSyntaxEditorBasedCodeFixProvider.cs (1)
71var solutionServices = document.Project.Solution.Services;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\SyntaxEditorBasedCodeFixProvider.cs (1)
84var 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)
85var 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.CodeStyle.Fixes (71)
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)
60var otherDocument = document.Project.Solution.GetRequiredDocument(syntaxTree);
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.State.cs (5)
106if (!CodeGenerator.CanAdd(_document.Project.Solution, TypeToGenerateIn, cancellationToken)) 237=> _document.Project.Solution.Workspace.Services.GetExtendedLanguageServices(language).GetRequiredService<TLanguageService>(); 397var definition = await SymbolFinderInternal.FindSourceDefinitionAsync(original, _document.Project.Solution, cancellationToken).ConfigureAwait(false); 445document.Project.Solution, 491document.Project.Solution,
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.State.cs (1)
79var destinationProvider = semanticDocument.Project.Solution.Services.GetLanguageServices(ClassType.Language);
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\GenerateDefaultConstructorsCodeAction.cs (1)
35_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\GenerateEnumMember\AbstractGenerateEnumMemberService.State.cs (2)
67var sourceType = (await SymbolFinderInternal.FindSourceDefinitionAsync(TypeToGenerateIn, document.Project.Solution, cancellationToken).ConfigureAwait(false)) as INamedTypeSymbol; 72return CodeGenerator.CanAdd(document.Project.Solution, TypeToGenerateIn, cancellationToken);
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\AbstractGenerateParameterizedMemberService.SignatureInfo.cs (1)
121var languageServiceProvider = Document.Project.Solution.Workspace.Services.GetExtendedLanguageServices(State.TypeToGenerateIn.Language);
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.State.cs (3)
61TypeToGenerateIn = await SymbolFinderInternal.FindSourceDefinitionAsync(TypeToGenerateIn, document.Project.Solution, cancellationToken).ConfigureAwait(false) as INamedTypeSymbol; 72if (!CodeGenerator.CanAdd(document.Project.Solution, TypeToGenerateIn, cancellationToken)) 85var destinationProvider = document.Project.Solution.Workspace.Services.GetExtendedLanguageServices(TypeToGenerateIn.Language);
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\TypeParameterSubstitution.cs (2)
88var solution = _project.Solution; 126var solution = _project.Solution;
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.CodeAction.cs (2)
53_semanticDocument.Project.Solution, 108var syntaxFactory = _semanticDocument.Project.Solution.Services
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.cs (1)
47var canGenerateMember = CodeGenerator.CanAdd(document.Project.Solution, state.TypeToGenerateIn, cancellationToken);
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.State.cs (2)
153TypeToGenerateIn, _document.Project.Solution, cancellationToken).ConfigureAwait(false) as INamedTypeSymbol; 162return CanGenerateLocal() || CodeGenerator.CanAdd(_document.Project.Solution, TypeToGenerateIn, cancellationToken);
src\Analyzers\Core\CodeFixes\ImplementAbstractClass\ImplementAbstractClassData.cs (1)
54if (!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)
90this.Document.Project.Solution,
src\Analyzers\Core\CodeFixes\MakeMethodAsynchronous\AbstractMakeMethodAsynchronousCodeFixProvider.cs (2)
168var solution = document.Project.Solution; 198var solution = document.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\UseAutoProperty\AbstractUseAutoPropertyCodeFixProvider.cs (2)
85var solution = context.Document.Project.Solution; 248var editor = new SyntaxEditor(declaratorTreeRoot, fieldDocument.Project.Solution.Services);
src\Analyzers\Core\CodeFixes\UseConditionalExpression\AbstractUseConditionalExpressionCodeFixProvider.cs (1)
56var nestedEditor = new SyntaxEditor(root, document.Project.Solution.Services);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\FixAllContextHelper.cs (1)
72var projectsToFix = project.Solution.Projects
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\ForkingSyntaxEditorBasedCodeFixProvider.cs (1)
71var solutionServices = document.Project.Solution.Services;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\SyntaxEditorBasedCodeFixProvider.cs (1)
84var 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)
85var 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 (21)
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)
62var 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)
110document.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\CodeGeneration\CSharpCodeGenerationService.cs (1)
75var newContext = context with { Solution = newDocument.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.CodeStyle.UnitTests (2)
src\Analyzers\CSharp\Tests\MatchFolderAndNamespace\CSharpMatchFolderAndNamespaceTests.cs (2)
74return project.WithDefaultNamespace(defaultNamespace).Solution; 940solution = project.WithDefaultNamespace(DefaultNamespace).Solution;
Microsoft.CodeAnalysis.CSharp.EditorFeatures (7)
EventHookup\EventHookupCommandHandler_TabKeyCommand.cs (3)
147var factory = document.Project.Solution.Workspace.Services.GetRequiredService<IBackgroundWorkIndicatorFactory>(); 173var workspace = document.Project.Solution.Workspace; 223var 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)
211var 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 (33)
CodeActions\ApplyChangesOperationTests.cs (1)
36var codeAction = new TestCodeAction(_changeSolution(context.Document.Project.Solution));
CodeActions\MoveType\MoveTypeTests.MoveScope.cs (2)
855Assert.NotEqual(documentToModify.Project.Solution, modifiedSolution); 859Assert.Equal(documentToModify.Project.Solution, modifiedSolution);
CodeActions\PreviewExceptionTests.cs (1)
113extensionManager = document.Project.Solution.Services.GetService<IExtensionManager>() as EditorLayerExtensionManager.ExtensionManager;
CodeActions\PreviewTests.cs (1)
70var solution = _oldDocument.Project.Solution;
Completion\CompletionProviders\OverrideCompletionProviderTests.cs (4)
3476await workspace.ChangeSolutionAsync(updatedP1.Solution); 3523await workspace.ChangeSolutionAsync(updatedProject.Solution); 3540document.Project.Solution.Workspace.TryApplyChanges(newDoc.Project.Solution);
Completion\CompletionServiceTests.cs (1)
210Assert.True(workspace.SetCurrentSolution(_ => project.Solution, WorkspaceChangeKind.SolutionChanged));
Diagnostics\DiagnosticAnalyzerDriver\DiagnosticAnalyzerDriverTests.cs (1)
62.Projects.Single().AddAdditionalDocument(name: "dummy.txt", text: "", filePath: "dummy.txt").Project.Solution;
Formatting\CodeCleanupTests.cs (3)
830project = project.Solution.WithProjectFilePath(project.Id, @$"z:\\{project.FilePath}").GetRequiredProject(project.Id); 832workspace.TryApplyChanges(project.Solution); 934solution = project.Solution;
PdbSourceDocument\AbstractPdbSourceDocumentTests.cs (2)
126using var workspace = (EditorTestWorkspace)project.Solution.Workspace; 258var compilationFactory = project.Solution.Services.GetRequiredLanguageService<ICompilationFactoryService>(LanguageNames.CSharp);
PdbSourceDocument\ImplementationAssemblyLookupServiceTests.cs (3)
50var workspace = (EditorTestWorkspace)project.Solution.Workspace; 85var workspace = (EditorTestWorkspace)project.Solution.Workspace; 123var workspace = (EditorTestWorkspace)project.Solution.Workspace;
PdbSourceDocument\PdbSourceDocumentTests.cs (10)
778using var workspace = (EditorTestWorkspace)project.Solution.Workspace; 866using var workspace = (EditorTestWorkspace)project.Solution.Workspace; 868var file = await service.GetGeneratedFileAsync(project.Solution.Workspace, project, symbol, signaturesOnly: false, options: MetadataAsSourceOptions.Default, cancellationToken: CancellationToken.None); 887using var workspace = (EditorTestWorkspace)project.Solution.Workspace; 889var file = await service.GetGeneratedFileAsync(project.Solution.Workspace, project, symbol, signaturesOnly: false, options: MetadataAsSourceOptions.Default, cancellationToken: CancellationToken.None); 909using var workspace = (EditorTestWorkspace)project.Solution.Workspace; 911var file = await service.GetGeneratedFileAsync(project.Solution.Workspace, project, symbol, signaturesOnly: false, options: MetadataAsSourceOptions.Default, cancellationToken: CancellationToken.None); 930using var workspace = (EditorTestWorkspace)project.Solution.Workspace; 932var fileOne = await service.GetGeneratedFileAsync(project.Solution.Workspace, project, symbol, signaturesOnly: false, options: MetadataAsSourceOptions.Default, cancellationToken: CancellationToken.None); 939var fileTwo = await service.GetGeneratedFileAsync(project.Solution.Workspace, project, symbolTwo, signaturesOnly: false, MetadataAsSourceOptions.Default, CancellationToken.None);
Workspaces\WorkspaceTests_EditorFeatures.cs (4)
1323workspace.TryApplyChanges(doc.Project.Solution); 1330workspace.TryApplyChanges(project.RemoveAdditionalDocument(doc.Id).Solution); 1351workspace.TryApplyChanges(doc.Project.Solution); 1358workspace.TryApplyChanges(project.RemoveAnalyzerConfigDocument(doc.Id).Solution);
Microsoft.CodeAnalysis.CSharp.Features (45)
ChangeSignature\CSharpChangeSignatureService.cs (1)
891convertedType = await SymbolFinder.FindSourceDefinitionAsync(convertedType, document.Project.Solution, cancellationToken).ConfigureAwait(false)
CodeRefactorings\ConvertLocalFunctionToMethod\CSharpConvertLocalFunctionToMethodCodeRefactoringProvider.cs (1)
36if (document.Project.Solution.WorkspaceKind == WorkspaceKind.MiscellaneousFiles)
CodeRefactorings\EnableNullable\EnableNullableCodeRefactoringProvider.cs (1)
71var solution = project.Solution;
CodeRefactorings\InlineTemporary\InlineTemporaryCodeRefactoringProvider.cs (2)
43if (document.Project.Solution.WorkspaceKind == WorkspaceKind.MiscellaneousFiles) 218var editor = new SyntaxEditor(scope, document.Project.Solution.Services);
CodeRefactorings\SyncNamespace\CSharpChangeNamespaceService.cs (2)
50if (document.Project.Solution.WorkspaceKind == WorkspaceKind.MiscellaneousFiles 76document.Project.Solution, allDocumentIds, containerSpan, cancellationToken).ConfigureAwait(false);
CodeRefactorings\UseExplicitOrImplicitType\AbstractUseTypeCodeRefactoringProvider.cs (2)
30if (document.Project.Solution.WorkspaceKind == WorkspaceKind.MiscellaneousFiles) 121var editor = new SyntaxEditor(root, document.Project.Solution.Services);
CodeRefactorings\UseRecursivePatterns\UseRecursivePatternsCodeRefactoringProvider.cs (1)
49if (document.Project.Solution.WorkspaceKind == WorkspaceKind.MiscellaneousFiles)
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)
98var 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)
214var 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;
IntroduceVariable\CSharpIntroduceVariableService_IntroduceLocal.cs (1)
316var editor = new SyntaxEditor(compilationUnit, document.Project.Solution.Services);
NavigationBar\CSharpNavigationBarItemService.cs (1)
59return GetMembersInTypes(document.Project.Solution, semanticModel, typesInFile, cancellationToken);
QuickInfo\CSharpDiagnosticAnalyzerQuickInfoProvider.cs (1)
134var hostAnalyzers = document.Project.Solution.SolutionState.Analyzers;
QuickInfo\CSharpSemanticQuickInfoProvider.cs (1)
268var 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)
62var 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)
110document.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 (4)
EditAndContinue\CSharpEditAndContinueAnalyzerTests.cs (2)
41AddTestDocument(source, path: Path.Combine(TempRoot.Root, "test.cs")).Project.Solution; 457AddTestDocument(source, path: Path.Combine(TempRoot.Root, "test.cs")).Project.Solution;
src\Analyzers\CSharp\Tests\MatchFolderAndNamespace\CSharpMatchFolderAndNamespaceTests.cs (2)
74return project.WithDefaultNamespace(defaultNamespace).Solution; 940solution = project.WithDefaultNamespace(DefaultNamespace).Solution;
Microsoft.CodeAnalysis.CSharp.Workspaces (3)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (1)
75var newContext = context with { Solution = newDocument.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.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 (77)
AddImports\AbstractAddImportsPasteCommandHandler.cs (3)
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);
Classification\Semantic\AbstractSemanticOrEmbeddedClassificationViewTaggerProvider.cs (1)
99var workspaceContextService = document.Project.Solution.Services.GetRequiredService<IWorkspaceContextService>();
Classification\Syntactic\SyntacticClassificationTaggerProvider.TagComputer.cs (1)
137var workspace = document?.Project.Solution.Workspace;
CodeDefinitionWindow\DefinitionContextTracker.cs (3)
145var workspace = document.Project.Solution.Workspace; 155var text = await item.Document.GetTextAsync(document.Project.Solution, cancellationToken).ConfigureAwait(false); 174var 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);
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.SolutionStateContentVersion;
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)
58var 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>(); 225var 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;
GoOrFind\AbstractGoOrFindNavigationService.cs (2)
186document.Project.Solution.Workspace, 270var statusService = document.Project.Solution.Services.GetRequiredService<IWorkspaceStatusService>();
GoToDefinition\GoToDefinitionCommandHandler.cs (2)
103var indicatorFactory = document.Project.Solution.Services.GetRequiredService<IBackgroundWorkIndicatorFactory>(); 144var notificationService = document.Project.Solution.Services.GetRequiredService<INotificationService>();
InlineDiagnostics\AbstractDiagnosticsTaggerProvider.SingleDiagnosticKindPullTaggerProvider.cs (1)
105var solution = project.Solution;
InlineHints\InlineHintsDataTaggerProvider.cs (1)
78var workspaceContextService = document.Project.Solution.Services.GetRequiredService<IWorkspaceContextService>();
InlineRename\AbstractEditorInlineRenameService.SymbolRenameInfo.cs (3)
133var solution = this.Document.Project.Solution; 155this.Document.Project.Solution.CanApplyChange(ApplyChangesKind.ChangeDocumentInfo)) 165var symbolSourceDocument = this.Document.Project.Solution.GetDocument(RenameSymbol.Locations.Single().SourceTree);
InlineRename\InlineRenameService.cs (2)
103document.Project.Solution.Workspace, 121var workspace = document.Project.Solution.Workspace;
InlineRename\InlineRenameSession.cs (2)
179_baseSolution = TriggerDocument.Project.Solution; 819TriggerDocument.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);
IntelliSense\NavigationActionFactory.cs (1)
32var workspace = document.Project.Solution.Workspace;
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 (3)
33var solution = document.Project.Solution; 92var solution = project.Solution; 132var 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)
225var sourceSymbol = await SymbolFinder.FindSourceDefinitionAsync(symbol, document.Project.Solution, _cancellationToken).ConfigureAwait(false) ?? symbol; 239var sourceSymbol = await SymbolFinder.FindSourceDefinitionAsync(symbol, document.Project.Solution, _cancellationToken).ConfigureAwait(false) ?? symbol;
Shared\Extensions\ITextSnapshotExtensions.cs (1)
74var service = document.Project.Solution.Services.GetService<IWorkspaceStatusService>();
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 (3)
81await document.Project.Solution.Services.GetRequiredService<IWorkspaceStatusService>() 93using var _1 = await RemoteKeepAliveSession.CreateAsync(document.Project.Solution, cancellationToken).ConfigureAwait(false); 208var workspace = document.Project.Solution.Workspace;
Suggestions\SuggestedActionWithNestedFlavors.cs (1)
51originalDocument.Project.Solution,
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (7)
Completion\AbstractCompletionProviderTests.cs (3)
650document.Project.Solution.Workspace.TryApplyChanges(newDoc.Project.Solution); 1275var 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 (29)
CodeFixes\CodeFixServiceTests.cs (4)
373extensionManager = (EditorLayerExtensionManager.ExtensionManager)document.Project.Solution.Services.GetRequiredService<IExtensionManager>(); 861var solution = await codeAction.GetChangedSolutionInternalAsync(txtDocument.Project.Solution, CodeAnalysisProgress.None, CancellationToken.None); 919return document.Project.Solution.WithAdditionalDocumentText(document.Id, newText); 1051var appliedChanges = workspace.TryApplyChanges(sourceDocument.Project.Solution);
CodeRefactorings\CodeRefactoringServiceTest.cs (5)
110var extensionManager = (EditorLayerExtensionManager.ExtensionManager)document.Project.Solution.Services.GetRequiredService<IExtensionManager>(); 182var solution = await codeAction.GetChangedSolutionInternalAsync(project.Solution, CodeAnalysisProgress.None, CancellationToken.None); 221var solution = await codeAction.GetChangedSolutionInternalAsync(project.Solution, CodeAnalysisProgress.None, CancellationToken.None); 307return document.Project.Solution.WithAdditionalDocumentText(document.Id, newText); 308return document.Project.Solution.WithAnalyzerConfigDocumentText(document.Id, newText);
Diagnostics\DiagnosticAnalyzerServiceTests.cs (4)
172var applied = workspace.TryApplyChanges(document.Project.Solution); 382var applied = workspace.TryApplyChanges(project.Solution); 678workspace.TryApplyChanges(project.Solution); 789Assert.True(workspace.TryApplyChanges(workspace.CurrentSolution.Projects.Single().AddAnalyzerReference(new TestGeneratorReference(generator)).Solution));
Diagnostics\DiagnosticDataTests.cs (3)
276secondDocument = firstDocument.Project.Solution.AddProject("TestProject2", "TestProject2", LanguageNames.CSharp) 284firstDocument = secondDocument.Project.Solution.GetRequiredDocument(firstDocument.Id); 308firstDocument = firstDocument.Project.Solution
EditAndContinue\EditAndContinueLanguageServiceTests.cs (1)
123.AddTestDocument("class C { }", "test.cs", out var documentId).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 (7)
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)); 134Assert.True(previewWorkspace.TryApplyChanges(project.Solution));
SymbolFinder\SymbolFinderTests.cs (1)
867.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)
1433Dim descriptorsMap = project.Solution.SolutionState.Analyzers.GetDiagnosticDescriptorsPerReference(diagnosticService.AnalyzerInfoCache, project)
FindReferences\FindReferencesTests.vb (1)
387Function(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)
70var workspace = document.Project.Solution.Workspace;
Microsoft.CodeAnalysis.ExternalAccess.OmniSharp (4)
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,
NavigateTo\OmniSharpNavigateToSearchService.cs (1)
44var document = await result.NavigableItem.Document.GetRequiredDocumentAsync(project.Solution, cancellationToken).ConfigureAwait(false);
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)
82var globalOptions = document.Project.Solution.Services.ExportProvider.GetService<IGlobalOptionService>(); 127var globalOptions = document.Project.Solution.Services.ExportProvider.GetService<IGlobalOptionService>(); 143var 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)
57var formattingOptions = GetFormattingOptions(document.Project.Solution.Services, indentationOptions, csharpSyntaxFormattingOptionsOverride);
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 (371)
AddConstructorParametersFromMembers\AddConstructorParametersFromMembersCodeRefactoringProvider.AddConstructorParametersCodeAction.cs (2)
49var services = _document.Project.Solution.Services; 68return Task.FromResult<Solution?>(constructorDocument.WithSyntaxRoot(newRoot).Project.Solution);
AddConstructorParametersFromMembers\AddConstructorParametersFromMembersCodeRefactoringProvider.cs (2)
38if (document.Project.Solution.WorkspaceKind == WorkspaceKind.MiscellaneousFiles) 185priorDocument.Project.Solution, CodeAnalysisProgress.None, 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)
47var operation = new ApplyChangesOperation(newProject.Solution); 102return 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)
29var projectWithReference = project.Solution.GetRequiredProject(FixData.PortableExecutableReferenceProjectId); 34return 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 (4)
31var dependencyGraph = project.Solution.GetProjectDependencyGraph(); 52var candidateProject = project.Solution.GetRequiredProject(candidateProjectId); 81new ApplyChangesOperation(_project.AddProjectReference(_projectReferenceToAdd).Solution))); 86var factoryService = _project.Solution.Services.GetRequiredService<IAddMetadataReferenceCodeActionOperationFactoryWorkspaceService>();
AddPackage\AbstractAddPackageCodeFixProvider.cs (1)
35var workspaceServices = document.Project.Solution.Services;
AddPackage\InstallPackageDirectlyCodeActionOperation.cs (1)
52_document.Project.Solution, packageName, versionOpt).ToList();
AddPackage\ParentInstallPackageCodeAction.cs (1)
71installerService ??= document.Project.Solution.Services.GetService<IPackageInstallerService>();
ChangeSignature\AbstractChangeSignatureService.cs (3)
110symbol = await SymbolFinder.FindSourceDefinitionAsync(symbol, document.Project.Solution, cancellationToken).ConfigureAwait(false) ?? symbol; 161var solution = document.Project.Solution; 409doc.Project.Solution.Services,
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)
39new ApplyChangesOperation(changedSuppressionDocument.Project.Solution),
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.GlobalSuppressMessageCodeAction.cs (1)
27var services = suppressionsDoc.Project.Solution.Services;
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.GlobalSuppressMessageFixAllCodeAction.cs (5)
73var currentSolution = triggerDocument.Project.Solution; 88currentSolution = newDocument.Project.Solution; 102var currentSolution = triggerProject.Solution; 117currentSolution = newDocument.Project.Solution; 131var services = suppressionsDoc.Project.Solution.Services;
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaWarningCodeAction.cs (1)
85=> Formatter.Format(node, _document.Project.Solution.Services, _options, cancellationToken);
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction.BatchFixer.cs (1)
115var oldSolution = fixAllState.Project.Solution;
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);
CodeFixesAndRefactorings\AbstractFixAllCodeAction.cs (2)
57var service = FixAllState.Project.Solution.Services.GetRequiredService<IFixAllGetFixesService>(); 71var service = FixAllState.Project.Solution.Services.GetRequiredService<IFixAllGetFixesService>();
CodeFixesAndRefactorings\AbstractFixAllGetFixesService.cs (2)
60var workspace = fixAllState.Project.Solution.Workspace; 84fixAllState.Project.Solution,
CodeRefactorings\AddMissingImports\AbstractAddMissingImportsFeatureService.cs (6)
39var solution = document.Project.Solution; 78var solution = document.Project.Solution; 153var services = document.Project.Solution.Services; 201document.Project.Solution, progressTracker, cancellationToken).ConfigureAwait(false); 205newSolution = document.Project.Solution; 219var textDiffingService = document.Project.Solution.Services.GetRequiredService<IDocumentTextDifferencingService>();
CodeRefactorings\AddMissingImports\AbstractAddMissingImportsRefactoringProvider.cs (1)
26var services = document.Project.Solution.Workspace.Services.HostServices as IMefHostExportProvider;
CodeRefactorings\CodeRefactoringService.cs (2)
107if (document.Project.Solution.WorkspaceKind == WorkspaceKind.Interactive) 245var extensionManager = textDocument.Project.Solution.Services.GetRequiredService<IExtensionManager>();
CodeRefactorings\ExtractMethod\AbstractExtractMethodCodeRefactoringProvider.cs (1)
36var solution = document.Project.Solution;
CodeRefactorings\MoveType\AbstractMoveTypeService.cs (2)
60return document.Project.Solution; 67return modifiedSolution ?? document.Project.Solution;
CodeRefactorings\MoveType\AbstractMoveTypeService.MoveTypeEditor.cs (3)
66var solutionWithNewDocument = documentWithMovedType.Project.Solution; 160var solutionWithNewDocument = projectToBeUpdated.Solution.AddDocument( 247return updatedDocument.Project.Solution;
CodeRefactorings\MoveType\AbstractMoveTypeService.MoveTypeNamespaceScopeEditor.cs (1)
83return changedDocument.Project.Solution;
CodeRefactorings\MoveType\AbstractMoveTypeService.RenameFileEditor.cs (1)
33SemanticDocument.Project.Solution.WithDocumentName(SemanticDocument.Document.Id, FileName));
CodeRefactorings\MoveType\AbstractMoveTypeService.RenameTypeEditor.cs (1)
29var solution = SemanticDocument.Project.Solution;
CodeRefactorings\MoveType\MoveTypeCodeRefactoringProvider.cs (1)
21if (document.Project.Solution.WorkspaceKind == WorkspaceKind.MiscellaneousFiles)
CodeRefactorings\SyncNamespace\AbstractChangeNamespaceService.cs (6)
144var solution = document.Project.Solution; 201var solution = document.Project.Solution; 349var solution = document.Project.Solution; 471var solutionWithChangedNamespace = documentWithNewNamespace.Project.Solution; 546symbol, document.Project.Solution, progress, documents: null, 625var services = documentWithAddedImports.Project.Solution.Services;
CodeRefactorings\SyncNamespace\AbstractSyncNamespaceCodeRefactoringProvider.cs (1)
35if (document.Project.Solution.WorkspaceKind == WorkspaceKind.MiscellaneousFiles ||
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 (3)
107var passThroughOptions = options ?? document?.Project.Solution.Options ?? OptionSet.Empty; 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)
264supportedPlatformData = new SupportedPlatformData(completionContext.Document.Project.Solution, invalidProjects.ToImmutable(), totalProjects); 413var solution = document.Project.Solution;
Completion\Providers\CompletionUtilities.cs (2)
41if (solution is null || project.Solution.SolutionStateContentVersion > solution.SolutionStateContentVersion) 43solution = project.Solution;
Completion\Providers\ImportCompletionProvider\AbstractImportCompletionProvider.cs (1)
216document.Project.Solution.Services.GetRequiredService<IDocumentSupportsFeatureService>().SupportsRefactorings(document);
Completion\Providers\ImportCompletionProvider\AbstractTypeImportCompletionService.cs (1)
92var solution = currentProject.Solution;
Completion\Providers\ImportCompletionProvider\ExtensionMethodImportCompletionHelper.SymbolComputer.cs (5)
60=> project.Solution.Services.GetRequiredService<IImportCompletionCacheService<ExtensionMethodImportCompletionCacheEntry, object>>(); 78await SymbolTreeInfo.GetInfoForMetadataReferenceAsync(project.Solution, peReference, checksum: null, cancellationToken).ConfigureAwait(false); 126var graph = project.Solution.GetProjectDependencyGraph(); 128return [.. relevantProjectIds.Select(project.Solution.GetRequiredProject).Where(p => p.SupportsCompilation)]; 190_originatingDocument.Project.Solution, peReference, checksum: null, cancellationToken).ConfigureAwait(false);
Completion\Providers\ImportCompletionProvider\ImportCompletionItem.cs (1)
147document.Project.Solution.Services,
Completion\Providers\SymbolCompletionItem.cs (6)
149var linkedDoc = document.Project.Solution.GetRequiredDocument(id); 200var supportedPlatforms = GetSupportedPlatforms(item, document.Project.Solution); 204var services = document.Project.Solution.Services; 215return document.Project.Solution.GetRequiredDocument(contextId); 392var supportedPlatforms = GetSupportedPlatforms(item, document.Project.Solution); 396return 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;
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.cs (1)
37if (document.Project.Solution.WorkspaceKind == WorkspaceKind.MiscellaneousFiles)
ConvertLinq\ConvertForEachToLinqQuery\AbstractConvertForEachToLinqQueryProvider.cs (1)
151var editor = new SyntaxEditor(converter.ForEachInfo.SemanticModel.SyntaxTree.GetRoot(cancellationToken), document.Project.Solution.Services);
ConvertTupleToStruct\AbstractConvertTupleToStructCodeRefactoringProvider.cs (7)
193var hostServices = document.Project.Solution.Services 223var solution = document.Project.Solution; 259return document.WithSyntaxRoot(newRoot).Project.Solution; 438var solution = startingProject.Solution; 524var solution = startingDocument.Project.Solution; 586var currentSolution = startingDocument.Project.Solution; 607currentSolution = updatedDocument.Project.Solution;
Copilot\CopilotChangeAnalysisUtilities.cs (1)
55var changeAnalysisService = document.Project.Solution.Services.GetRequiredService<ICopilotChangeAnalysisService>();
Copilot\ICopilotChangeAnalysisService.cs (3)
132var projectConeCount = 1 + document.Project.Solution 226var diagnosticAnalyzerService = newDocument.Project.Solution.Services.GetRequiredService<IDiagnosticAnalyzerService>(); 334args: (@this: this, newDocument.Project.Solution, diagnosticIdToCount, diagnosticIdToApplicationTime, diagnosticIdToProviderName,
DesignerAttribute\DesignerAttributeDiscoveryService.cs (2)
64var solutionServices = project.Solution.Services; 65var solutionKey = SolutionKey.ToSolutionKey(project.Solution);
Diagnostics\CodeAnalysisDiagnosticAnalyzerService.cs (1)
89Contract.ThrowIfFalse(project.Solution.Workspace == _workspace);
Diagnostics\Service\DocumentAnalysisExecutor.cs (1)
358var diagnosticSpanMappingService = textDocument.Project.Solution.Services.GetService<IWorkspaceVenusSpanMappingService>();
Diagnostics\Service\DocumentAnalysisExecutor_Helpers.cs (1)
196foreach (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)
62var 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)
78var 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\AbstractEditAndContinueAnalyzer.cs (1)
3329? new(await oldProject.Solution.GetRequiredDocument(oldDeclaration.SyntaxTree).GetRequiredNullableDisabledSemanticModelAsync(cancellationToken).ConfigureAwait(false))
EditAndContinue\DebuggingSession.cs (3)
495var analysis = await EditSession.Analyses.GetDocumentAnalysisAsync(LastCommittedSolution, document.Project.Solution, oldDocument, document, activeStatementSpanProvider, cancellationToken).ConfigureAwait(false); 858var newSolution = newProject.Solution; 899var analysis = await EditSession.Analyses.GetDocumentAnalysisAsync(LastCommittedSolution, newUnmappedDocument.Project.Solution, oldUnmappedDocument, newUnmappedDocument, activeStatementSpanProvider, cancellationToken).ConfigureAwait(false);
EditAndContinue\EditSession.cs (2)
549var generatorDiagnostics = await project.Solution.CompilationState.GetSourceGeneratorDiagnosticsAsync(project.State, cancellationToken).ConfigureAwait(false); 561return await project.Solution.CompilationState.GetSourceGeneratedDocumentStatesAsync(project.State, cancellationToken).ConfigureAwait(false);
EditAndContinue\Remote\RemoteDebuggingSessionProxy.cs (1)
145document.Project.Solution,
EditAndContinue\Remote\RemoteEditAndContinueServiceProxy.cs (1)
170document.Project.Solution,
EmbeddedLanguages\Classification\AbstractEmbeddedLanguageClassificationService.cs (1)
48project.Solution.Services, project, semanticModel, textSpans, options, result, cancellationToken);
EncapsulateField\AbstractEncapsulateFieldService.cs (5)
118var solution = document.Project.Solution; 146var currentSolution = document.Project.Solution; 182var solution = document.Project.Solution; 222document, document.Project.Solution, field, generatedProperty, cancellationToken).ConfigureAwait(false); 227return 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;
ExtractClass\ExtractClassWithDialogCodeAction.cs (4)
57var extractClassService = _service ?? _document.Project.Solution.Services.GetRequiredService<IExtractClassOptionsService>(); 74_document.Project.Solution, 116updatedDocument.Project.Solution, 255unformattedSolution = document.WithSyntaxRoot(currentRoot).Project.Solution;
ExtractInterface\AbstractExtractInterfaceService.cs (6)
138var solution = refactoringResult.DocumentToExtractFrom.Project.Solution; 195unformattedInterfaceDocument.Project.Solution, 234var unformattedSolution = documentWithInterface.Project.Solution; 267var service = document.Project.Solution.Services.GetRequiredService<IExtractInterfaceOptionsService>(); 301formattedSolution = simplifiedDocument.Project.Solution; 345unformattedSolution = document.WithSyntaxRoot(editor.GetChangedRoot()).Project.Solution;
ExtractMethod\MethodExtractor.cs (2)
127if (!codeGenService.CanAddTo(destination, document.Project.Solution, cancellationToken)) 154var services = document.Project.Solution.Services;
FindUsages\AbstractFindUsagesService_FindImplementations.cs (2)
44var solution = project.Solution; 76var 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)
150document.Project.Solution,
GenerateConstructors\AbstractGenerateConstructorsCodeRefactoringProvider.ConstructorDelegatingCodeAction.cs (2)
41var languageServices = project.Solution.Services.GetLanguageServices(_state.ContainingType.Language); 85_document.Project.Solution,
GenerateConstructors\AbstractGenerateConstructorsCodeRefactoringProvider.cs (3)
113priorDocument.Project.Solution, codeAction, progressTracker, cancellationToken).ConfigureAwait(false); 163if (document.Project.Solution.WorkspaceKind == WorkspaceKind.MiscellaneousFiles) 247var globalOptions = document.Project.Solution.Services.GetService<ILegacyGlobalOptionsWorkspaceService>();
GenerateConstructors\AbstractGenerateConstructorsCodeRefactoringProvider.FieldDelegatingCodeAction.cs (1)
74_document.Project.Solution,
GenerateConstructors\AbstractGenerateConstructorsCodeRefactoringProvider.GenerateConstructorWithDialogCodeAction.cs (3)
44var service = _service._pickMembersService_forTesting ?? _document.Project.Solution.Services.GetRequiredService<IPickMembersService>(); 62var globalOptions = _document.Project.Solution.Services.GetRequiredService<ILegacyGlobalOptionsWorkspaceService>(); 81var solution = _document.Project.Solution;
GenerateEqualsAndGetHashCodeFromMembers\GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider.cs (2)
56if (document.Project.Solution.WorkspaceKind == WorkspaceKind.MiscellaneousFiles) 112var globalOptions = document.Project.Solution.Services.GetService<ILegacyGlobalOptionsWorkspaceService>();
GenerateEqualsAndGetHashCodeFromMembers\GenerateEqualsAndHashWithDialogCodeAction.cs (2)
45var service = _service._pickMembersService_forTestingPurposes ?? _document.Project.Solution.Services.GetRequiredService<IPickMembersService>(); 57var solution = _document.Project.Solution;
GenerateOverrides\GenerateOverridesWithDialogCodeAction.cs (3)
40var services = _document.Project.Solution.Services; 74_document.Project.Solution, 84new ApplyChangesOperation(newDocument.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.cs (2)
109if (document.Project.Solution.CanApplyChange(ApplyChangesKind.AddDocument)) 152semanticDocument.Document.GetLanguageService<ICodeGenerationService>().CanAddTo(decl, semanticDocument.Project.Solution, cancellationToken);
GenerateType\AbstractGenerateTypeService.Editor.cs (9)
69Contract.ThrowIfFalse(document.Project.Solution == generateTypeOptionsResult.Project.Solution); 272var newSolution = projectToBeUpdated.Solution.AddDocument(newDocumentId, documentName, string.Empty, folders, fullFilePath); 349var updatedSolution = projectToBeUpdated.Solution.AddDocument( 390var solution = _semanticDocument.Project.Solution; 399return [new ApplyChangesOperation(codeGenResult.Project.Solution)]; 436var solution = _semanticDocument.Project.Solution; 549var solution = _semanticDocument.Project.Solution; 559return [new ApplyChangesOperation(codeGenResult.Project.Solution)];
GenerateType\AbstractGenerateTypeService.State.cs (3)
295var symbol = await SymbolFinder.FindSourceDefinitionAsync(TypeToGenerateInOpt, document.Project.Solution, cancellationToken).ConfigureAwait(false); 305var documentToBeGeneratedIn = document.Project.Solution.GetDocument(sourceTreeToBeGeneratedIn); 327if (!CodeGenerator.CanAdd(document.Project.Solution, TypeToGenerateInOpt, cancellationToken))
GoToBase\AbstractGoToBaseService.cs (1)
43var solution = project.Solution;
GoToDefinition\AbstractGoToDefinitionSymbolService.cs (1)
26var services = document.Project.Solution.Services;
InheritanceMargin\AbstractInheritanceMarginService.cs (1)
37var 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 (2)
608var editor = new SyntaxEditor(root, document.Project.Solution.Services); 645var 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)
336var 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 (3)
51if (document.Project.Solution.WorkspaceKind == WorkspaceKind.MiscellaneousFiles) 245var modifiedSolution = originalDocument.Project.Solution; 280methodSymbol, document.Project.Solution, progress,
IntroduceVariable\IntroduceVariableCodeRefactoringProvider.cs (1)
26if (document.Project.Solution.WorkspaceKind == WorkspaceKind.MiscellaneousFiles)
InvertConditional\AbstractInvertConditionalCodeRefactoringProvider.cs (1)
49var editor = new SyntaxEditor(root, document.Project.Solution.Services);
MetadataAsSource\AbstractMetadataAsSourceService.cs (1)
33document.Project.Solution,
MetadataAsSource\DecompilationMetadataAsSourceFileProvider.cs (2)
202var newLoader = new WorkspaceFileTextLoader(temporaryDocument.Project.Solution.Services, fileInfo.TemporaryFilePath, MetadataAsSourceGeneratedFileInfo.Encoding); 322: sourceProject.Solution.Services.GetLanguageServices(fileInfo.LanguageName).GetRequiredService<ISyntaxTreeFactoryService>().GetDefaultParseOptionsWithLatestLanguageVersion();
MetadataAsSource\SymbolMappingServiceFactory.cs (1)
34if (document.Project.Solution.WorkspaceKind is not WorkspaceKind.MetadataAsSource)
MoveStaticMembers\AbstractMoveStaticMembersRefactoringProvider.cs (1)
24var service = document.Project.Solution.Services.GetService<IMoveStaticMembersOptionsService>();
MoveStaticMembers\MoveStaticMembersWithDialogCodeAction.cs (5)
66var destinationDocId = _document.Project.Solution.GetDocumentIdsWithFilePath(moveOptions.FilePath).Single(); 71_document.Project.Solution, 103sourceDoc.Project.Solution, 118var memberReferenceLocations = await FindMemberReferencesAsync(newDoc.Project.Solution, newDoc.Project.Id, moveOptions.SelectedMembers, cancellationToken).ConfigureAwait(false); 120var solutionWithFixedReferences = await RefactorReferencesAsync(projectToLocations, newDoc.Project.Solution, newType, typeArgIndices, cancellationToken).ConfigureAwait(false);
MoveToNamespace\AbstractMoveToNamespaceService.cs (2)
226var originalSolution = document.Project.Solution; 280var solution = formattedDocument.Project.Solution;
NameTupleElement\AbstractNameTupleElementCodeRefactoringProvider.cs (1)
43if (document.Project.Solution.WorkspaceKind == WorkspaceKind.MiscellaneousFiles)
NavigateTo\AbstractNavigateToSearchService.InProcess.cs (1)
59var 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\AbstractNavigableItemsService.cs (1)
49var solution = project.Solution;
Navigation\INavigableItem.cs (1)
61document.Project.Solution.TryGetWorkspace());
PullMemberUp\AbstractPullMemberUpRefactoringProvider.cs (2)
30_service ??= document.Project.Solution.Services.GetService<IPullMemberUpOptionsService>(); 56document.Project.Solution,
PullMemberUp\MembersPuller.cs (2)
96var solution = document.Project.Solution; 271var solution = document.Project.Solution;
QuickInfo\CommonSemanticQuickInfoProvider.cs (3)
34var services = context.Document.Project.Solution.Services; 64var services = document.Project.Solution.Services; 86var 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)
176semanticModel, triggerToken.SpanStart, document.Project.Solution.Services, cancellationToken: cancellationToken).ConfigureAwait(false); 222var 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\SemanticSearchDocumentSupportsFeatureService.cs (1)
21return solutionService.Value.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\AnnotatedSymbolMapping.cs (1)
101annotatedSolution = document.WithSyntaxRoot(root.Value).Project.Solution;
Shared\Utilities\ExtractTypeHelpers.cs (2)
85newDocument.Project.Solution, 128return Formatter.Format(syntaxGenerator.SyntaxGeneratorInternal.TypeParameterList(typeParameterNames), document.Project.Solution.Services, formattingOptions, cancellationToken).ToString();
SignatureHelp\AbstractSignatureHelpProvider.cs (1)
293var 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)
60var otherDocument = document.Project.Solution.GetRequiredDocument(syntaxTree);
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.State.cs (5)
106if (!CodeGenerator.CanAdd(_document.Project.Solution, TypeToGenerateIn, cancellationToken)) 237=> _document.Project.Solution.Workspace.Services.GetExtendedLanguageServices(language).GetRequiredService<TLanguageService>(); 397var definition = await SymbolFinderInternal.FindSourceDefinitionAsync(original, _document.Project.Solution, cancellationToken).ConfigureAwait(false); 445document.Project.Solution, 491document.Project.Solution,
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.State.cs (1)
79var destinationProvider = semanticDocument.Project.Solution.Services.GetLanguageServices(ClassType.Language);
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\GenerateDefaultConstructorsCodeAction.cs (1)
35_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\GenerateEnumMember\AbstractGenerateEnumMemberService.State.cs (2)
67var sourceType = (await SymbolFinderInternal.FindSourceDefinitionAsync(TypeToGenerateIn, document.Project.Solution, cancellationToken).ConfigureAwait(false)) as INamedTypeSymbol; 72return CodeGenerator.CanAdd(document.Project.Solution, TypeToGenerateIn, cancellationToken);
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\AbstractGenerateParameterizedMemberService.SignatureInfo.cs (1)
121var languageServiceProvider = Document.Project.Solution.Workspace.Services.GetExtendedLanguageServices(State.TypeToGenerateIn.Language);
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.State.cs (3)
61TypeToGenerateIn = await SymbolFinderInternal.FindSourceDefinitionAsync(TypeToGenerateIn, document.Project.Solution, cancellationToken).ConfigureAwait(false) as INamedTypeSymbol; 72if (!CodeGenerator.CanAdd(document.Project.Solution, TypeToGenerateIn, cancellationToken)) 85var destinationProvider = document.Project.Solution.Workspace.Services.GetExtendedLanguageServices(TypeToGenerateIn.Language);
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\TypeParameterSubstitution.cs (2)
88var solution = _project.Solution; 126var solution = _project.Solution;
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.CodeAction.cs (2)
53_semanticDocument.Project.Solution, 108var syntaxFactory = _semanticDocument.Project.Solution.Services
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.cs (1)
47var canGenerateMember = CodeGenerator.CanAdd(document.Project.Solution, state.TypeToGenerateIn, cancellationToken);
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.State.cs (2)
153TypeToGenerateIn, _document.Project.Solution, cancellationToken).ConfigureAwait(false) as INamedTypeSymbol; 162return CanGenerateLocal() || CodeGenerator.CanAdd(_document.Project.Solution, TypeToGenerateIn, cancellationToken);
src\Analyzers\Core\CodeFixes\ImplementAbstractClass\ImplementAbstractClassData.cs (1)
54if (!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)
90this.Document.Project.Solution,
src\Analyzers\Core\CodeFixes\MakeMethodAsynchronous\AbstractMakeMethodAsynchronousCodeFixProvider.cs (2)
168var solution = document.Project.Solution; 198var solution = document.Project.Solution;
src\Analyzers\Core\CodeFixes\MakeMethodSynchronous\AbstractMakeMethodSynchronousCodeFixProvider.cs (5)
77var solution = document.Project.Solution; 110var newSolution = newDocument.Project.Solution; 138[methodSymbol], 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 (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 (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\UseAutoProperty\AbstractUseAutoPropertyCodeFixProvider.cs (2)
85var solution = context.Document.Project.Solution; 248var editor = new SyntaxEditor(declaratorTreeRoot, fieldDocument.Project.Solution.Services);
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;
UseNamedArguments\AbstractUseNamedArgumentsCodeRefactoringProvider.cs (1)
200if (document.Project.Solution.WorkspaceKind == WorkspaceKind.MiscellaneousFiles)
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)
480var 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 (153)
EditAndContinue\ActiveStatementsMapTests.cs (3)
120.AddDocument("doc", SourceText.From(source, Encoding.UTF8), filePath: "a.cs").Project.Solution; 177.AddDocument("doc", SourceText.From(source, Encoding.UTF8), filePath: "a.cs").Project.Solution; 230.AddDocument("doc", SourceText.From(source, Encoding.UTF8), filePath: "a.cs").Project.Solution;
EditAndContinue\EditAndContinueWorkspaceServiceTests.cs (71)
83.AddTestProject("P", LanguageNames.CSharp, id: projectPId).Solution 127solution = projectQ.Solution; 239solution = document.Project.Solution; 281AddTestDocument(source1, sourceFile.Path, out var documentId).Project.Solution; 367AddTestDocument(source, sourceFile1.Path, out var documentId).Project.Solution; 412solution = project.WithParseOptions(newOptions).Solution; 460AddTestDocument(source, sourceFile1.Path, out var documentId).Project.Solution; 497solution = project.WithCompilationOptions(newOptions).Solution; 539AddTestDocument(source, sourceFile1.Path, out var documentId).Project.Solution; 573solution = project.WithCompilationOptions(newOptions).Solution; 607AddTestDocument(source, sourceFile.Path).Project.Solution; 668AddTestDocument(source, sourceFile.Path, out var documentId).Project.Solution; 677solution = project.RemoveMetadataReference(libV1).AddMetadataReference(libV2).Solution; 714AddTestDocument(source, sourceFile.Path, out var documentId).Project.Solution; 723solution = project.RemoveMetadataReference(libV1).Solution; 731solution = project.AddMetadataReference(libV2).Solution; 762AddTestDocument(source, sourceFile.Path, out var documentId).Project.Solution; 771solution = project.AddMetadataReference(libV1).Solution; 797AddTestDocument(source, sourceFile.Path, out var documentId).Project.Solution; 806solution = project.AddMetadataReference(libV3).Solution; 923AddTestDocument(source, path: sourceFilePath, out var documentId).Project.Solution; 1098solution = project.Solution; 1153solution = project.Solution; 1214solution = project.Solution; 1228solution = documentB.Project.Solution; 1277AddTestDocument(sourceB, sourceFileA.Path, out var documentBId).Project.Solution; 1307AddTestDocument(source1, sourceFile1.Path, out var documentBId).Project.Solution; 1318solution = solution.AddTestDocument(projectId, source2, sourceFile2.Path, out var document2Id).Project.Solution; 1365solution = project.Solution; 1376solution = document0.Project.Solution; 1748solution = project.Solution; 1759solution = document1.Project.Solution; 1844solution = project.Solution; 1888solution = project.Solution; 2149AddDocument("A.cs", "class Program { void Main() { System.Console.WriteLine(1); } }", filePath: pathA).Project.Solution. 2152AddDocument("B.cs", "class B {}", filePath: pathB).Project.Solution. 2155AddDocument("C.cs", "class C {}", filePath: pathC).Project.Solution; 2186solution = projectD.Solution; 2197solution = projectE.Solution; 2249solution = project.Solution.AddAnalyzerReference(projectId, new TestGeneratorReference(generator)); 2419solution = project.Solution.AddAnalyzerReference(projectId, new TestGeneratorReference(generator)); 2423var generatedDocuments = await project.Solution.CompilationState.GetSourceGeneratedDocumentStatesAsync(project.State, CancellationToken.None); 2476AddTestDocument("class C;", sourcePath).Project.Solution; 2484.WithCompilationOptions<CSharpCompilationOptions>(options => options.WithOverflowChecks(!options.CheckOverflow)).Solution; 2498AddTestProject("A", out var projectAId).Solution. 2499AddTestProject("B", out var projectBId).Solution; 2533.AddTestDocument(sourceA1, path: sourceFileA.Path, out var documentAId).Project.Solution; 2542.AddTestDocument(sourceB1, path: sourceFileB.Path, out var documentBId).Project.Solution 2574.AddTestDocument(sourceA1, path: sourceFileA.Path, out var documentAId).Project.Solution 2576.AddTestDocument(sourceB1, path: sourceFileB.Path, out var documentBId).Project.Solution; 2619.AddTestDocument(sourceA1, path: sourceFileA.Path, out var documentAId).Project.Solution; 2650AddTestDocument("class B { virtual int F() => 1; }", path: sourceFileB.Path, out var documentBId).Project.Solution; 2958solution = document1.Project.Solution; 3045solution = project.Solution; 3114solution = project.Solution; 3140solution = document1.Project.Solution; 3177solution = project.Solution; 3529""", "A.cs", out var documentAId).Project.Solution 3537""", "B.cs", out var documentBId).Project.Solution; 3608""", "A.cs", out var documentAId).Project.Solution 3618""", "B.cs", out var documentBId).Project.Solution; 4020solution = document1.Project.Solution.RemoveDocument(document1.Id); 4149solution = projectB.Solution; 4290var documentB = documentA.Project.Solution.AddTestProject("B", targetFramework: TargetFramework.Net90).WithAssemblyName("A"). 4293solution = documentB.Project.Solution; 4390var documentB = documentA.Project.Solution.AddTestProject("B", targetFramework: TargetFramework.Net90).WithAssemblyName("A"). 4393solution = documentB.Project.Solution; 4658var document = project.Solution.AddDocument(documentInfo).GetDocument(documentInfo.Id); 4660solution = document.Project.Solution; 4729solution = p.Solution.AddDocument(linkedDocId, doc.Name, text, filePath: doc.FilePath); 5486solution = projectP.Solution;
EditAndContinue\EditSessionActiveStatementsTests.cs (2)
76solution = project.Solution; 183solution = dummyProject.Solution.AddDocument(DocumentId.CreateNewId(dummyProject.Id, NoCompilationConstants.LanguageName), "a.dummy", "");
EditAndContinue\EmitSolutionUpdateResultsTests.cs (73)
78var solution = document.Project.Solution; 166.AddTestProject("C", out var c).Solution 167.AddTestProject("D", out var d).Solution 168.AddTestProject("A", out var a).AddProjectReferences([new(c)]).Solution 169.AddTestProject("B", out var b).AddProjectReferences([new(c), new(d)]).Solution; 190.AddTestProject("C", out var c).Solution 191.AddTestProject("D", out var d).Solution 192.AddTestProject("A", out var a).AddProjectReferences([new(c)]).Solution 193.AddTestProject("B", out var b).AddProjectReferences([new(c), new(d)]).Solution; 216.AddTestProject("C", out var c).Solution 217.AddTestProject("D", out var d).Solution 218.AddTestProject("A", out var a).AddProjectReferences([new(c)]).Solution 219.AddTestProject("B", out var b).AddProjectReferences([new(c), new(d)]).Solution; 247.AddTestProject("C", out var c).Solution 248.AddTestProject("D", out var d).Solution 249.AddTestProject("A", out var a).AddProjectReferences([new(c)]).Solution 250.AddTestProject("B", out var b).AddProjectReferences([new(c), new(d)]).Solution; 274.AddTestProject("C", out var c).Solution 275.AddTestProject("D", out var d).Solution 276.AddTestProject("A", out var a).AddProjectReferences([new(c)]).Solution 277.AddTestProject("B", out var b).AddProjectReferences([new(c), new(d)]).Solution; 308.AddTestProject("C", out var c).Solution 309.AddTestProject("D", out var d).Solution 310.AddTestProject("A", out var a).AddProjectReferences([new(c)]).Solution 311.AddTestProject("B", out var b).AddProjectReferences([new(c), new(d)]).Solution; 336.AddTestProject("C", out var c).Solution 337.AddTestProject("D", out var d).Solution 338.AddTestProject("A", out var a).AddProjectReferences([new(c)]).Solution 339.AddTestProject("B", out var b).AddProjectReferences([new(c), new(d)]).Solution; 360.AddTestProject("C", out var c).Solution 361.AddTestProject("D", out var d).Solution 362.AddTestProject("A", out var a).AddProjectReferences([new(c)]).Solution 363.AddTestProject("B", out var b).AddProjectReferences([new(c), new(d)]).Solution; 391.AddTestProject("Q", out var q).Solution 392.AddTestProject("P0", out var p0).AddProjectReferences([new(q)]).Solution 393.AddTestProject("P1", out var p1).AddProjectReferences([new(q)]).Solution 394.AddTestProject("P2", out var p2).Solution 395.AddTestProject("R0", out var r0).AddProjectReferences([new(p0)]).Solution 396.AddTestProject("R1", out var r1).AddProjectReferences([new(p1), new(p0)]).Solution 397.AddTestProject("R2", out var r2).AddProjectReferences([new(p2), new(p0)]).Solution; 431.AddTestProject("C", out var c).Solution 432.AddTestProject("D", out var d).Solution 433.AddTestProject("A", out var a).AddProjectReferences([new(c)]).Solution 434.AddTestProject("B", out var b).AddProjectReferences([new(c), new(d)]).Solution; 462.AddTestProject("C", out var c).Solution 463.AddTestProject("D", out var d).Solution 464.AddTestProject("A", out var a).AddProjectReferences([new(c)]).Solution 465.AddTestProject("B", out var b).AddProjectReferences([new(c), new(d)]).Solution; 493.AddTestProject("C", out var c).Solution 494.AddTestProject("D", out var d).Solution 495.AddTestProject("A", out var a).AddProjectReferences([new(c)]).Solution 496.AddTestProject("B", out var b).AddProjectReferences([new(c), new(d)]).Solution; 519.AddTestProject("C", out var c).Solution 520.AddTestProject("D", out var d).Solution 521.AddTestProject("A", out var a).AddProjectReferences([new(c)]).Solution 522.AddTestProject("B", out var b).AddProjectReferences([new(c), new(d)]).Solution 523.AddTestProject("E", out var e).AddProjectReferences([new(b)]).Solution; 552.AddTestProject("C", out var c).Solution 553.AddTestProject("D", out var d).Solution 554.AddTestProject("A", out var a).AddProjectReferences([new(c)]).Solution 555.AddTestProject("B", out var b).AddProjectReferences([new(d)]).Solution; 577.AddTestProject("C", out var c).Solution 578.AddTestProject("D", out var d).Solution 579.AddTestProject("A", out var a).AddProjectReferences([new(c)]).Solution 580.AddTestProject("B", out var b).AddProjectReferences([new(c), new(d)]).Solution; 611.AddTestProject("P1", out var p1).Solution 612.AddTestProject("P2", out var p2).Solution 613.AddTestProject("P3", out var p3).Solution 614.AddTestProject("P4", out var p4).Solution 615.AddTestProject("R1", out var r1).AddProjectReferences([new(p1), new(p2)]).Solution 616.AddTestProject("R2", out var r2).AddProjectReferences([new(p2), new(p3)]).Solution 617.AddTestProject("R3", out var r3).AddProjectReferences([new(p3), new(p4)]).Solution 618.AddTestProject("R4", out var r4).AddProjectReferences([new(p4)]).Solution;
EditAndContinue\UnitTestingHotReloadServiceTests.cs (1)
37solution = projectP.Solution;
EditAndContinue\WatchHotReloadServiceTests.cs (3)
54solution = projectP.Solution; 191solution = project.Solution.AddAnalyzerReference(projectId, new TestGeneratorReference(generator)); 195var generatedDocuments = await project.Solution.CompilationState.GetSourceGeneratedDocumentStatesAsync(project.State, CancellationToken.None);
Microsoft.CodeAnalysis.LanguageServer (2)
FileBasedPrograms\FileBasedProgramsProjectSystem.cs (1)
65return document.Project.Solution.Workspace == _workspaceFactory.MiscellaneousFilesWorkspaceProjectFactory.Workspace ||
LanguageServer\Handler\DebugConfiguration\WorkspaceDebugConfigurationHandler.cs (1)
51return new ProjectDebugConfiguration(project.FilePath!, project.OutputFilePath!, GetProjectName(project), targetsDotnetCore, isExe, project.Solution.FilePath);
Microsoft.CodeAnalysis.LanguageServer.Protocol (41)
Extensions\Extensions.cs (1)
177var solution = documents.First().Project.Solution;
Extensions\ProtocolConversions.cs (1)
839IsMiscellaneous = project.Solution.WorkspaceKind == WorkspaceKind.MiscellaneousFiles && !project.State.HasAllInformation,
Extensions\ProtocolConversions.Diagnostics.cs (1)
128var informationService = project.Solution.Services.GetRequiredService<IDiagnosticProjectInformationService>();
ExternalAccess\Razor\FormatNewFileHandler.cs (2)
55var solution = project.Solution.AddDocument( 90root = Formatter.Format(root, project.Solution.Services, syntaxFormattingOptions, cancellationToken);
Features\CodeCleanup\AbstractCodeCleanupService.cs (4)
197var fixAllService = document.Project.Solution.Services.GetRequiredService<IFixAllGetFixesService>(); 213var diagnosticService = document.Project.Solution.Services.GetRequiredService<IDiagnosticAnalyzerService>(); 263var solutionChanges = updatedDocument.Project.Solution.GetChanges(currentDocument.Project.Solution);
Features\EditAndContinue\EditAndContinueDiagnosticSource_OpenDocument.cs (1)
24var 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\Diagnostics\DiagnosticSources\AbstractDocumentDiagnosticSource.cs (1)
17public Solution Solution => this.Document.Project.Solution;
Handler\Diagnostics\DiagnosticSources\AbstractProjectDiagnosticSource.cs (1)
19protected Solution Solution => this.Project.Solution;
Handler\Extensions\DispatchDocumentExtensionMessageHandler.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)
72var isFullyLoaded = await IsFullyLoadedAsync(project.Solution, cancellationToken).ConfigureAwait(false); 76(project.Solution.Workspace, projectOrDocumentId),
Handler\Rename\RenameHandler.cs (1)
35var oldSolution = document.Project.Solution;
Handler\SemanticTokens\SemanticTokensRefreshQueue.cs (1)
43var 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); 40var unfrozenDocument = await state.Document.Project.Solution.WithoutFrozenSourceGeneratedDocuments().GetDocumentAsync(state.Document.Id, includeSourceGenerated: true, cancellationToken).ConfigureAwait(false);
Workspaces\LspMiscellaneousFilesWorkspaceProvider.cs (1)
36return ValueTask.FromResult(document.Project.Solution.Workspace == this);
Workspaces\LspWorkspaceManager.cs (5)
285var workspaceKind = document.Project.Solution.WorkspaceKind; 290return (workspace, document.Project.Solution, document); 307return (miscDocument.Project.Solution.Workspace, miscDocument.Project.Solution, miscDocument); 518_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 (29)
Definitions\GoToDefinitionTests.cs (1)
368workspace.TryApplyChanges(project.Solution);
Diagnostics\PullDiagnosticTests.cs (4)
240var solution = document.Project.Solution; 1676await testLspServer.TestWorkspace.ChangeDocumentAsync(csproj2Document.Id, newCsProj2Document.Project.Solution); 1764await testLspServer.TestWorkspace.ChangeDocumentAsync(csproj3Document.Id, newCsProj3Document.Project.Solution).ConfigureAwait(false); 1834await testLspServer.TestWorkspace.ChangeDocumentAsync(csproj2Document.Id, newCsProj2Document.Project.Solution);
DocumentChanges\DocumentChangesTests.LinkedDocuments.cs (1)
108return lspDocument.Project.Solution;
References\FindAllReferencesHandlerTests.cs (1)
378workspace.TryApplyChanges(project.Solution);
Rename\RenameTests.cs (2)
268workspace.TryApplyChanges(project.Solution); 317workspace.TryApplyChanges(project.Solution);
SpellCheck\SpellCheckTests.cs (1)
124var solution = document.Project.Solution;
Workspaces\LspWorkspaceManagerTests.cs (19)
49Assert.Equal(testLspServer.GetCurrentSolution(), closedDocument!.Project.Solution); 153Assert.Equal(testLspServer.TestWorkspace.CurrentSolution, openedDocument!.Project.Solution); 157await testLspServer.TestWorkspace.ChangeProjectAsync(newProject.Id, newProject.Solution); 164Assert.Equal(testLspServer.TestWorkspace.CurrentSolution, openedDocument.Project.Solution); 181Assert.Equal(testLspServer.TestWorkspace.CurrentSolution, openedDocument!.Project.Solution); 185Assert.NotEqual(testLspServer.TestWorkspace.CurrentSolution, openedDocument!.Project.Solution); 190await testLspServer.TestWorkspace.ChangeProjectAsync(newProject.Id, newProject.Solution); 201Assert.Equal(testLspServer.TestWorkspace.CurrentSolution, openedDocument.Project.Solution); 205Assert.NotEqual(testLspServer.TestWorkspace.CurrentSolution, openedDocument.Project.Solution); 229Assert.Equal(testLspServer.TestWorkspace.CurrentSolution, lspDocument.Project.Solution); 405await testWorkspaceTwo.ChangeProjectAsync(newProjectWorkspaceTwo.Id, newProjectWorkspaceTwo.Solution); 460await testWorkspace.ChangeProjectAsync(newProject.Id, newProject.Solution); 488Assert.Same(testLspServer.TestWorkspace.CurrentSolution, lspDocument.Project.Solution); 517.Project.Solution); 542testLspServer.TestWorkspace.CurrentSolution.Projects.Single().RemoveDocument(document1.Id).Solution); 667Assert.Same(testLspServer.TestWorkspace.CurrentSolution, sourceGeneratedDocument.Project.Solution); 683Assert.NotSame(testLspServer.TestWorkspace.CurrentSolution, sourceGeneratedDocument.Project.Solution); 699Assert.Same(testLspServer.TestWorkspace.CurrentSolution, sourceGeneratedDocument.Project.Solution); 707Assert.NotSame(testLspServer.TestWorkspace.CurrentSolution, sourceGeneratedDocument.Project.Solution);
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (17)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\FixAllContextHelper.cs (1)
72var projectsToFix = project.Solution.Projects
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\ForkingSyntaxEditorBasedCodeFixProvider.cs (1)
71var solutionServices = document.Project.Solution.Services;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\SyntaxEditorBasedCodeFixProvider.cs (1)
84var 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)
85var 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.PublicApiAnalyzers.CodeFixes (4)
AnnotatePublicApiFix.cs (1)
76return publicSurfaceAreaDocument.Project.Solution.WithAdditionalDocumentText(publicSurfaceAreaDocument.Id, newSourceText);
DeclarePublicApiFix.cs (2)
110return surfaceAreaDocument.Project.Solution.WithAdditionalDocumentText(surfaceAreaDocument.Id, newSourceText); 119return project.Solution;
NullableEnablePublicApiFix.cs (1)
61return surfaceAreaDocument.Project.Solution.WithAdditionalDocumentText(surfaceAreaDocument.Id, newSourceText);
Microsoft.CodeAnalysis.Remote.ServiceHub (16)
Host\RemoteWorkspace.SolutionCreator.cs (10)
422return project.Solution; 497project = addDocuments(project.Solution, lazyDocumentsToAdd.ToImmutable()).GetProject(project.Id)!; 514project = removeDocuments(project.Solution, lazyDocumentsToRemove.ToImmutable()).GetProject(project.Id)!; 558TextDocumentKind.Document => document.Project.Solution.WithDocumentTextLoader(document.Id, loader, mode).GetRequiredDocument(document.Id), 559TextDocumentKind.AnalyzerConfigDocument => document.Project.Solution.WithAnalyzerConfigDocumentTextLoader(document.Id, loader, mode).GetRequiredAnalyzerConfigDocument(document.Id), 560TextDocumentKind.AdditionalDocument => document.Project.Solution.WithAdditionalDocumentTextLoader(document.Id, loader, mode).GetRequiredAdditionalDocument(document.Id), 579document = document.Project.Solution.WithDocumentName(document.Id, newDocumentInfo.Name).GetRequiredDocument(document.Id); 582document = document.Project.Solution.WithDocumentFilePath(document.Id, newDocumentInfo.FilePath).GetRequiredDocument(document.Id); 588document = document.Project.Solution.WithDocumentFolders(document.Id, newDocumentInfo.Folders).GetRequiredDocument(document.Id); 595document = document.Project.Solution.WithDocumentSourceCodeKind(document.Id, newDocumentInfo.SourceCodeKind).GetRequiredDocument(document.Id);
Services\DiagnosticAnalyzer\DiagnosticComputer.cs (3)
79_performanceTracker = project.Solution.Services.GetService<IPerformanceTrackerService>(); 165var skippedAnalyzersInfo = _project.Solution.SolutionState.Analyzers.GetSkippedAnalyzersInfo( 369foreach (var reference in _project.Solution.AnalyzerReferences)
Services\DocumentHighlights\RemoteDocumentHighlightsService.cs (1)
38solution = document.Project.Solution;
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)
101Dim innerEditor = New SyntaxEditor(root, document.Project.Solution.Services) 135Dim 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)
309Dim 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)
704convertedType = If(Await SymbolFinder.FindSourceDefinitionAsync(convertedType, document.Project.Solution, cancellationToken).ConfigureAwait(False), convertedType) 723nodeType = 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)
73Dim services = document.Project.Solution.Services
CodeRefactorings\InlineTemporary\VisualBasicInlineTemporaryCodeRefactoringProvider.vb (2)
32If document.Project.Solution.WorkspaceKind = WorkspaceKind.MiscellaneousFiles Then 184Return Simplifier.Expand(DirectCast(n, StatementSyntax), semanticModel, document.Project.Solution.Services, cancellationToken:=cancellationToken)
NavigationBar\VisualBasicNavigationBarItemService.vb (1)
54document.Project.Solution, type, position, semanticModel, workspaceSupportsDocumentChanges, symbolDeclarationService, cancellationToken))
src\Analyzers\VisualBasic\CodeFixes\RemoveUnnecessaryCast\VisualBasicRemoveUnnecessaryCastCodeFixProvider.vb (2)
101Dim innerEditor = New SyntaxEditor(root, document.Project.Solution.Services) 135Dim 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 (161)
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)
335return changedDocument?.Project.Solution; 357return changedDocument?.Project.Solution; 690return [new ApplyChangesOperation(newDocument.Project.Solution)];
CodeActions\CodeAction_Cleanup.cs (1)
154document.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\TextChangeMerger.cs (1)
37_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)
71var editor = new SyntaxEditor(root, document.Project.Solution.Services);
Diagnostics\DiagnosticData.cs (3)
182var diagnosticSpanMappingService = document?.Project.Solution.Services.GetService<IWorkspaceVenusSpanMappingService>(); 207location: new DiagnosticDataLocation(new FileLinePositionSpan(project.FilePath ?? project.Solution.FilePath ?? "", span: default)), 282builder.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\SolutionEditor.cs (1)
50changedSolution = newDoc.Project.Solution;
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)
346project.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)
37var solution = project.Solution; 57project.Solution.Services, 58SolutionKey.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 (2)
95var services = document.Project.Solution.Services; 135var 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)
633var newReferencedSymbols = RenameUtilities.GetSymbolsTouchingPosition(tokenOrNode.Span.Start, newDocumentSemanticModel, newDocument.Project.Solution.Services, _cancellationToken);
Rename\ConflictEngine\RenamedSpansTracker.cs (1)
225solution = 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\FixAllContextHelper.cs (1)
72var projectsToFix = project.Solution.Projects
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\ForkingSyntaxEditorBasedCodeFixProvider.cs (1)
71var solutionServices = document.Project.Solution.Services;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\SyntaxEditorBasedCodeFixProvider.cs (1)
84var 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)
85var 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\DocumentService\SpanMappingHelper.cs (2)
17document.Project.Solution.Services.GetService<ISourceGeneratedDocumentSpanMappingService>() is { } sourceGeneratedSpanMappingService) 28document.Project.Solution.Services.GetService<ISourceGeneratedDocumentSpanMappingService>() is { } sourceGeneratedSpanMappingService)
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); 514=> Solution.CompilationState.TryGetCompilation(this.Id, out compilation); 525=> Solution.CompilationState.GetCompilationAsync(State, cancellationToken); 532=> Solution.CompilationState.HasSuccessfullyLoadedAsync(State, cancellationToken); 562=> Solution.CompilationState.GetDependentVersionAsync(this.Id, cancellationToken); 569=> Solution.CompilationState.GetDependentSemanticVersionAsync(this.Id, cancellationToken); 582=> this.Solution.WithProjectAssemblyName(this.Id, assemblyName).GetRequiredProject(Id); 588=> this.Solution.WithProjectDefaultNamespace(this.Id, defaultNamespace).GetRequiredProject(Id); 591=> Solution.WithProjectOutputFilePath(Id, path).GetRequiredProject(Id); 594=> Solution.WithProjectOutputRefFilePath(Id, path).GetRequiredProject(Id); 597=> Solution.WithProjectCompilationOutputInfo(Id, info).GetRequiredProject(Id); 603=> this.Solution.WithProjectCompilationOptions(this.Id, options).GetRequiredProject(Id); 609=> this.Solution.WithProjectParseOptions(this.Id, options).GetRequiredProject(Id); 616=> this.Solution.AddProjectReference(this.Id, projectReference).GetRequiredProject(Id); 623=> this.Solution.AddProjectReferences(this.Id, projectReferences).GetRequiredProject(Id); 629=> this.Solution.RemoveProjectReference(this.Id, projectReference).GetRequiredProject(Id); 636=> this.Solution.WithProjectReferences(this.Id, projectReferences).GetRequiredProject(Id); 643=> this.Solution.AddMetadataReference(this.Id, metadataReference).GetRequiredProject(Id); 650=> this.Solution.AddMetadataReferences(this.Id, metadataReferences).GetRequiredProject(Id); 656=> this.Solution.RemoveMetadataReference(this.Id, metadataReference).GetRequiredProject(Id); 663=> this.Solution.WithProjectMetadataReferences(this.Id, metadataReferences).GetRequiredProject(Id); 670=> this.Solution.AddAnalyzerReference(this.Id, analyzerReference).GetRequiredProject(Id); 677=> this.Solution.AddAnalyzerReferences(this.Id, analyzerReferences).GetRequiredProject(Id); 683=> this.Solution.RemoveAnalyzerReference(this.Id, analyzerReference).GetRequiredProject(Id); 690=> this.Solution.WithProjectAnalyzerReferences(this.Id, analyzerReferencs).GetRequiredProject(Id); 697=> Solution.WithProjectAttributes(attributes).GetRequiredProject(Id); 708return this.Solution.AddDocument(id, name, syntaxRoot, folders, filePath, preservationMode: PreservationMode.PreserveIdentity).GetDocument(id)!; 717return this.Solution.AddDocument(id, name, text, folders, filePath).GetDocument(id)!; 726return this.Solution.AddDocument(id, name, text, folders, filePath).GetDocument(id)!; 735return this.Solution.AddAdditionalDocument(id, name, text, folders, filePath).GetAdditionalDocument(id)!; 744return this.Solution.AddAdditionalDocument(id, name, text, folders, filePath).GetAdditionalDocument(id)!; 753return this.Solution.AddAnalyzerConfigDocument(id, name, text, folders, filePath).GetAnalyzerConfigDocument(id)!; 763return this.Solution.RemoveDocument(documentId).GetRequiredProject(Id); 773return this.Solution.RemoveDocuments(documentIds).GetRequiredProject(this.Id); 782=> this.Solution.RemoveAdditionalDocument(documentId).GetRequiredProject(Id); 791return this.Solution.RemoveAdditionalDocuments(documentIds).GetRequiredProject(this.Id); 800=> this.Solution.RemoveAnalyzerConfigDocument(documentId).GetRequiredProject(Id); 809return this.Solution.RemoveAnalyzerConfigDocuments(documentIds).GetRequiredProject(this.Id); 831=> Solution.FallbackAnalyzerOptions.GetValueOrDefault(Language, StructuredAnalyzerConfigOptions.Empty);
Workspace\Solution\SolutionCompilationState.cs (1)
1851if (!projectWithCachedGeneratorState.Solution.CompilationState.TryGetCompilationTracker(projectWithCachedGeneratorState.Id, out var tracker) ||
Workspace\Workspace.cs (2)
862oldSolution.RemoveProject(projectId).AddProject(reloadedProjectInfo).GetRequiredProject(projectId)).Solution; 1519solution = project.Solution;
Workspace\Workspace_Editor.cs (4)
873newSolution = document.WithText(this.GetOpenDocumentText(oldSolution, docId)).Project.Solution; 882var oldSolution = oldProject.Solution; 883var newSolution = reloadedProject.Solution; 891newSolution = document.WithText(this.GetOpenDocumentText(oldSolution, docId)).Project.Solution;
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (15)
NetCoreTests.cs (2)
199Assert.Equal(projectRefFilePath, project.Solution.GetProject(projectRefId).FilePath); 541Assert.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()); 2900var noEncodingSolution = noEncodingDoc.Project.Solution; 2929workspace.TryApplyChanges(project.AddAnalyzerReference(aref).Solution); 2934workspace.TryApplyChanges(workspace.CurrentSolution.GetProject(project.Id).RemoveAnalyzerReference(aref).Solution); 2955workspace.TryApplyChanges(workspace.CurrentSolution.GetProject(project.Id).RemoveProjectReference(pref).Solution); 2962workspace.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 (112)
FindReferencesTests.cs (5)
194var references = await SymbolFinder.FindReferencesAsync(symbol, prj.Solution); 199references = await SymbolFinder.FindReferencesAsync(symbol, prj.Solution); 232var references = await SymbolFinder.FindReferencesAsync(symbol, prj.Solution); 302var references = await SymbolFinder.FindReferencesAsync(symbol, prj.Solution); 307references = await SymbolFinder.FindReferencesAsync(symbol, prj.Solution);
Formatter\FormatterTests.cs (1)
78document = document.Project.Solution.WithOptions(solutionOptions).GetRequiredDocument(document.Id);
SolutionTests\SolutionTests.cs (42)
2817.Project.Solution; 3727var doc2 = doc.Project.Solution.WithDocumentSyntaxRoot(doc.Id, newRoot, PreservationMode.PreserveValue).GetDocument(doc.Id); 3730var observed2 = GetObservedSyntaxTreeRootAsync(doc2.Project.Solution, did); 4178var solution = project.Solution.WithDocumentText(documentToFreezeOriginal.Id, SourceText.From("class DocumentToFreeze { void M() { /*no top level change*/ } }")); 4223var solution = project.Solution.WithDocumentText(documentToFreezeOriginal.Id, SourceText.From("class DocumentToFreeze { void M() { } public void NewMethod() { } }")); 4288var frozenSolution = document.WithFrozenPartialSemantics(CancellationToken.None).Project.Solution; 4400var solution = workspace.CurrentSolution.AddProject("TestProject", "TestProject", LanguageNames.CSharp).Solution; 4459currentSolution = document1.Project.Solution; 4463currentSolution = document2.Project.Solution; 4485var frozenDoc2 = frozenDoc1.Project.Solution.GetRequiredDocument(document2.Id); 4500var frozenDoc1 = frozenDoc2.Project.Solution.GetRequiredDocument(document1.Id); 5306.AddProject("CS2", "CS2", LanguageNames.CSharp).Solution 5307.AddProject("NC1", "NC1", NoCompilationConstants.LanguageName).Solution; 5446var s2 = s1.AddProject("P1", "A1", LanguageNames.VisualBasic).Solution; 5485var newDoc = doc.Project.Solution.WithDocumentSyntaxRoot(doc.Id, newRoot).GetDocument(doc.Id); 5517static (sourceText, document) => document.Project.Solution.WithDocumentText(document.Id, sourceText, PreservationMode.PreserveIdentity), 5592.AddAdditionalDocument("File.cs", text: "", filePath: FilePath).Project.Solution; 5611.AddDocument("File.cs", "", filePath: "File.cs").Project.Solution 5613.AddDocument("file.cs", "", filePath: "file.cs").Project.Solution; 5628var frozenSolution = project.Solution.WithFrozenPartialCompilations(CancellationToken.None); 5647var frozenSolution = project.Solution.WithFrozenPartialCompilations(CancellationToken.None); 5661var project2 = project1.Solution.AddProject("CSharpProject2", "CSharpProject2", LanguageNames.CSharp); 5662project1 = project2.Solution.GetProject(project1.Id).AddDocument("Doc1", SourceText.From("class Doc1 { }")).Project; 5663project2 = project1.Solution.GetProject(project2.Id).AddDocument("Doc2", SourceText.From("class Doc2 { }")).Project; 5664project1 = project2.Solution.GetProject(project1.Id); 5669var frozenSolution = project1.Solution.WithFrozenPartialCompilations(CancellationToken.None); 5689var project2 = project1.Solution.AddProject("CSharpProject2", "CSharpProject2", LanguageNames.CSharp); 5690project1 = project2.Solution.GetProject(project1.Id).AddDocument("Doc1", SourceText.From("class Doc1 { }")).Project; 5691project2 = project1.Solution.GetProject(project2.Id).AddDocument("Doc2", SourceText.From("class Doc2 { }")).Project; 5694project1 = project2.Solution.GetProject(project1.Id); 5699var frozenSolution = project1.Solution.WithFrozenPartialCompilations(CancellationToken.None); 5719var project2 = project1.Solution.AddProject("CSharpProject2", "CSharpProject2", LanguageNames.CSharp); 5720project1 = project2.Solution.GetProject(project1.Id).AddDocument("Doc1", SourceText.From("class Doc1 { }")).Project; 5721project2 = project1.Solution.GetProject(project2.Id).AddDocument("Doc2", SourceText.From("class Doc2 { }")).Project; 5724project1 = project2.Solution.GetProject(project1.Id); 5729var frozenSolution = project1.Solution.WithFrozenPartialCompilations(CancellationToken.None); 5759var frozenSolution = project1.Solution.WithFrozenPartialCompilations(CancellationToken.None); 5797? project1.Solution.WithFrozenPartialCompilations(CancellationToken.None) 5798: project1.Solution; 5832var frozenSolution = project.Solution.WithFrozenPartialCompilations(CancellationToken.None); 5859var project2 = project1.Solution 5866_ => project2.Solution,
SolutionTests\SolutionWithSourceGeneratorTests.cs (44)
187var generatorDriver = project.Solution.CompilationState.GetTestAccessor().GetGeneratorDriver(project)!; 207generatorDriver = project.Solution.CompilationState.GetTestAccessor().GetGeneratorDriver(project)!; 231generatorDriver = project.Solution.CompilationState.GetTestAccessor().GetGeneratorDriver(project)!; 261project = project.Solution.WithDocumentText(documentId, SourceText.From("// Changed Source File")).Projects.Single(); 304project = project.Solution.WithAdditionalDocumentText(additionalDocumentId, SourceText.From("Hello, everyone!")).Projects.Single(); 309project = project.Solution.WithAdditionalDocumentText(additionalDocumentId, SourceText.From("Good evening, everyone!")).Projects.Single(); 371projectBeforeChange.Solution.WithAdditionalDocumentText( 408return project.Solution; 419.AddAdditionalDocument("Test.txt", "Hello, world!").Project.Solution; 590Assert.True(workspace.SetCurrentSolution(_ => project.Solution, WorkspaceChangeKind.SolutionChanged)); 599Assert.NotSame(workspace.CurrentSolution, generatedDocument.Project.Solution); 614Assert.True(workspace.SetCurrentSolution(_ => project.Solution, WorkspaceChangeKind.SolutionChanged)); 622Assert.Same(workspace.CurrentSolution, generatedDocument!.Project.Solution); 634Assert.True(workspace.SetCurrentSolution(_ => originalAdditionalFile.Project.Solution, WorkspaceChangeKind.SolutionChanged)); 659.AddAnalyzerReference(analyzerReference).Solution; 663new ProjectReference(projectIdWithGenerator)).Solution; 677var projectWithReference = generatedDocument.Project.Solution.Projects.Single(p => p.Id != projectIdWithGenerator); 692Assert.True(workspace.SetCurrentSolution(_ => project.Solution, WorkspaceChangeKind.SolutionChanged)); 721Assert.True(workspace.SetCurrentSolution(_ => project.Solution, WorkspaceChangeKind.SolutionChanged)); 812var originalDocument2 = AddEmptyProject(originalDocument1.Project.Solution, name: "Project2") 816var frozenSolution = originalDocument2.WithFrozenPartialSemantics(CancellationToken.None).Project.Solution; 851project = project.Solution.AddDocument(documentInfo).Projects.Single() 885var frozenWithSingleDocument = project.Solution.WithFrozenSourceGeneratedDocument( 902var solution = AddEmptyProject(workspace.CurrentSolution).AddAnalyzerReference(analyzerReference).Solution; 905solution = project2.Solution; 932var frozenSolution = project.Solution.WithFrozenSourceGeneratedDocument( 934Assert.Same(project.Solution, frozenSolution.Project.Solution); 948var checksum0 = await project0.Solution.SolutionState.GetChecksumAsync(CancellationToken.None); 951var checksum1 = await project1.Solution.SolutionState.GetChecksumAsync(CancellationToken.None); 957var checksum2 = await project2.Solution.SolutionState.GetChecksumAsync(CancellationToken.None); 967var checksum3 = await project3.Solution.SolutionState.GetChecksumAsync(CancellationToken.None); 996var solution = project.Solution.WithDocumentTexts( 1216var solution = sourceGeneratedDocument1.WithText(SourceText.From("// Change doc 1")).Project.Solution; 1223solution = sourceGeneratedDocument2!.WithText(SourceText.From("// Change doc 2")).Project.Solution; 1273var frozenWithSingleDocument = project.Solution.WithFrozenSourceGeneratedDocument( 1310var frozenWithSingleDocument = project.Solution.WithFrozenSourceGeneratedDocument( 1335var changes = new SolutionChanges(newSolution, project.Solution); 1341var frozenWithSingleDocument = project.Solution.WithFrozenSourceGeneratedDocument( 1347return frozenWithSingleDocument.Project.Solution; 1371var changes = new SolutionChanges(newSolution, project.Solution); 1376var frozenWithSingleDocument = project.Solution.WithFrozenSourceGeneratedDocument( 1382return frozenWithSingleDocument.Project.Solution; 1465Assert.True(workspace.TryApplyChanges(project1.Solution));
SolutionTests\TryApplyChangesTests.cs (7)
80Assert.True(workspace.TryApplyChanges(project.WithCompilationOptions(project.CompilationOptions!.WithMainTypeName("Test")).Solution)); 93Assert.True(workspace.TryApplyChanges(project.WithCompilationOptions(project.CompilationOptions!.WithMainTypeName("Test")).Solution)); 107() => workspace.TryApplyChanges(project.WithCompilationOptions(project.CompilationOptions!.WithMainTypeName("WrongThing")).Solution)); 125project.ParseOptions!.WithFeatures([KeyValuePair.Create("Feature", "")])).Solution)); 140project.WithParseOptions(project.ParseOptions!.WithFeatures([KeyValuePair.Create("Feature", "ExpectedValue")])).Solution)); 155project.WithParseOptions(project.ParseOptions!.WithFeatures([KeyValuePair.Create("Feature", "WrongThing")])).Solution)); 167Assert.True(workspace.TryApplyChanges(project.AddAnalyzerConfigDocument(".editorconfig", SourceText.From("")).Project.Solution));
SymbolKeyTests.cs (2)
863workspace.TryApplyChanges(document.WithText(updated).Project.Solution); 910workspace.TryApplyChanges(document.WithText(updated).Project.Solution);
WorkspaceTests\AdhocWorkspaceTests.cs (6)
432Assert.True(ws.TryApplyChanges(changedDoc.Project.Solution)); 465Assert.True(ws.TryApplyChanges(changedDoc.Project.Solution)); 499Assert.True(ws.TryApplyChanges(changedDoc.Project.Solution)); 530Assert.True(ws.TryApplyChanges(changedDoc.Project.Solution)); 560Assert.True(ws.TryApplyChanges(changedDoc.Project.Solution)); 602var vbProj = csProj.Solution.AddProject("VbProj", "VbProj", LanguageNames.VisualBasic)
WorkspaceTests\WorkspaceTests.cs (5)
30Assert.Throws<NotSupportedException>(() => ws.TryApplyChanges(changedDoc.Project.Solution)).Message); 46Assert.Throws<NotSupportedException>(() => ws.TryApplyChanges(changedDoc.Project.Solution)).Message); 64Assert.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; 115var newSolution = await Renamer.RenameSymbolAsync(document.Project.Solution, typeSymbol, renameOptions, newName, cancellationToken).ConfigureAwait(false);
Microsoft.VisualStudio.LanguageServices (76)
CallHierarchy\CallHierarchyCommandHandler.cs (1)
98var notificationService = document.Project.Solution.Services.GetRequiredService<INotificationService>();
CallHierarchy\CallHierarchyItem.cs (1)
41_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();
ChangeSignature\AddParameterDialogViewModel.cs (1)
25_notificationService = document.Project.Solution.Services.GetService<INotificationService>();
ChangeSignature\ChangeSignatureDialogViewModel.cs (1)
62_notificationService = document.Project.Solution.Services.GetRequiredService<INotificationService>();
CodeCleanup\AbstractCodeCleanUpFixer.cs (3)
100project.Solution, [project], context.EnabledFixIds, progress, cancellationToken), 130return newDocument.Project.Solution; 164return newDoc.Project.Solution;
DebuggerIntelliSense\AbstractDebuggerIntelliSenseContext.cs (1)
131var solution = document.Project.Solution;
ExtractClass\VisualStudioExtractClassOptionsService.cs (1)
50var solution = document.Project.Solution;
ExtractInterface\VisualStudioExtractInterfaceOptionsService.cs (1)
46var solution = document.Project.Solution;
FindReferences\Entries\AbstractDocumentSpanEntry.cs (2)
53var documentNavigationService = document.Project.Solution.Services.GetRequiredService<IDocumentNavigationService>(); 57document.Project.Solution.Workspace,
FindReferences\Entries\DocumentSpanEntry.cs (3)
153var controlService = _excerptResult.Document.Project.Solution.Services.GetRequiredService<IContentControlService>(); 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)
416this.ProjectFolders = _projectManagementService.GetFolders(this.SelectedProject.Id, this.SelectedProject.Solution.Workspace); 685var dependencyGraph = document.Project.Solution.GetProjectDependencyGraph(); 697projectListing.AddRange(document.Project.Solution.Projects 735this.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)
88var oldLinkedDocument = oldDocument.Project.Solution.GetDocument(linkedDocumentId);
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 (2)
101var service = document.Project.Solution.Services.GetRequiredService<IValueTrackingService>(); 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)
53var solution = project.Solution; 165var editorWorkspace = openedDocument.Project.Solution.Workspace; 185var definitionItem = symbol.ToNonClassifiedDefinitionItem(project.Solution, includeHiddenLocations: true);
Workspace\VisualStudioWorkspaceUtilities.cs (1)
20return TryGetVsHierarchyAndItemId(document?.Project.Solution.Workspace, document?.State, out hierarchy, out itemID);
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)
48symbolInfo.Symbol, document.Project.Solution,
Preview\PreviewChangesTests.vb (5)
48forkedDocument.Project.Solution, 96Dim newSolution = forkedDocument.Project.Solution 143forkedDocument.Project.Solution, 191Dim newSolution = forkedDocument.Project.Solution 280Dim updatedSolution = document1.Project.Solution _
PullMemberUp\PullMemberUpViewModelTest.vb (1)
256Dim baseTypeTree = BaseTypeTreeNodeViewModel.CreateBaseTypeTree(glyphService:=Nothing, workspaceDoc.Project.Solution, memberSymbol.ContainingType, CancellationToken.None)
Venus\DocumentService_IntegrationTests.vb (4)
200Assert.True(workspace.TryApplyChanges(newDocument.Project.Solution)) 207Assert.Throws(Of NotSupportedException)(Sub() workspace.TryApplyChanges(newDocument.Project.Solution)) 272Dim testWorkspace = DirectCast(document.Project.Solution.Workspace, EditorTestWorkspace) 310Dim 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)
72Await 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 (20)
AbstractExposeMemberForTesting`1.cs (3)
115return document.Project.Solution; 163return document.Project.Solution; 167return document.WithSyntaxRoot(syntaxRoot.ReplaceNode(testAccessorTypeDeclaration, newTypeDeclaration)).Project.Solution;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\FixAllContextHelper.cs (1)
72var projectsToFix = project.Solution.Projects
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\ForkingSyntaxEditorBasedCodeFixProvider.cs (1)
71var solutionServices = document.Project.Solution.Services;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\SyntaxEditorBasedCodeFixProvider.cs (1)
84var 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)
85var 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);
Roslyn.Diagnostics.CSharp.Analyzers (5)
CSharpAvoidOptSuffixForNullableEnableCodeCodeFixProvider.cs (2)
69document.Project.Solution, variableSymbol, newName, document.Project.Solution.Options, cancellationToken).ConfigureAwait(false);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (1)
75var newContext = context with { Solution = newDocument.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;
Roslyn.VisualStudio.Next.UnitTests (75)
Remote\RemoteHostClientServiceFactoryTests.cs (1)
52var newSolution = document.Project.Solution.WithDocumentText(document.Id, newText, PreservationMode.PreserveIdentity);
Remote\SnapshotSerializationTests.cs (14)
53var project2 = document1.Project.Solution.AddProject("Project2", "Project2.dll", LanguageNames.VisualBasic); 56solution = document2.Project.Solution.GetRequiredProject(project1.Id) 60.AddAdditionalDocument("Additional", SourceText.From("hello"), ["test"], @".\Add").Project.Solution; 121using var scope = await validator.AssetStorage.StoreAssetsAsync(project.Solution, CancellationToken.None); 143using var snapshot = await validator.AssetStorage.StoreAssetsAsync(project.Solution, CancellationToken.None); 144await validator.VerifySolutionStateSerializationAsync(project.Solution, snapshot.SolutionChecksum); 157using var scope = await validator.AssetStorage.StoreAssetsAsync(document.Project.Solution, CancellationToken.None); 177using var scope = await validator.AssetStorage.StoreAssetsAsync(document.Project.Solution, CancellationToken.None); 178await validator.VerifySolutionStateSerializationAsync(document.Project.Solution, scope.SolutionChecksum); 491using var snapshot = await validator.AssetStorage.StoreAssetsAsync(project.Solution, CancellationToken.None); 511using var snapshot = await validator.AssetStorage.StoreAssetsAsync(project.Solution, CancellationToken.None); 524using var snapshot = await validator.AssetStorage.StoreAssetsAsync(project.Solution, CancellationToken.None); 533var serializer = document.Project.Solution.Services.GetService<ISerializerService>(); 586.Solution;
Services\ServiceHubServicesTests.cs (30)
238var solution = workspace.CurrentSolution.AddProject("unknown", "unknown", NoCompilationConstants.LanguageName).Solution; 457Assert.True(localWorkspace.SetCurrentSolution(_ => tempDoc.Project.Solution, WorkspaceChangeKind.SolutionChanged)); 779Assert.True(workspace.SetCurrentSolution(_ => tempDoc.Project.Solution, WorkspaceChangeKind.SolutionChanged)); 917Assert.True(workspace.SetCurrentSolution(_ => tempDoc.Project.Solution, WorkspaceChangeKind.SolutionChanged)); 926Assert.True(workspace.SetCurrentSolution(_ => tempDoc.Project.Solution, WorkspaceChangeKind.SolutionChanged)); 968Assert.True(workspace.SetCurrentSolution(_ => tempDoc.Project.Solution, WorkspaceChangeKind.SolutionChanged)); 977Assert.True(workspace.SetCurrentSolution(_ => tempDoc.Project.Solution, WorkspaceChangeKind.SolutionChanged)); 1009Assert.True(workspace.SetCurrentSolution(_ => tempDoc.Project.Solution, WorkspaceChangeKind.SolutionChanged)); 1018Assert.True(workspace.SetCurrentSolution(_ => tempDoc.Project.Solution, WorkspaceChangeKind.SolutionChanged)); 1052Assert.True(workspace.SetCurrentSolution(_ => tempDoc.Project.Solution, WorkspaceChangeKind.SolutionChanged)); 1061Assert.True(workspace.SetCurrentSolution(_ => tempDoc.Project.Solution, WorkspaceChangeKind.SolutionChanged)); 1104Assert.True(workspace.SetCurrentSolution(_ => tempDoc.Project.Solution, WorkspaceChangeKind.SolutionChanged)); 1114Assert.True(workspace.SetCurrentSolution(_ => tempDoc.Project.Solution, WorkspaceChangeKind.SolutionChanged)); 1157Assert.True(workspace.SetCurrentSolution(_ => tempDoc.Project.Solution, WorkspaceChangeKind.SolutionChanged)); 1167Assert.True(workspace.SetCurrentSolution(_ => tempDoc.Project.Solution, WorkspaceChangeKind.SolutionChanged)); 1210Assert.True(workspace.SetCurrentSolution(_ => tempDoc.Project.Solution, WorkspaceChangeKind.SolutionChanged)); 1220Assert.True(workspace.SetCurrentSolution(_ => tempDoc.Project.Solution, WorkspaceChangeKind.SolutionChanged)); 1255Assert.True(workspace.SetCurrentSolution(_ => tempDoc.Project.Solution, WorkspaceChangeKind.SolutionChanged)); 1265Assert.True(workspace.SetCurrentSolution(_ => tempDoc.Project.Solution, WorkspaceChangeKind.SolutionChanged)); 1300Assert.True(workspace.SetCurrentSolution(_ => tempDoc.Project.Solution, WorkspaceChangeKind.SolutionChanged)); 1309Assert.True(workspace.SetCurrentSolution(_ => tempDoc.Project.Solution, WorkspaceChangeKind.SolutionChanged)); 1343Assert.True(workspace.SetCurrentSolution(_ => tempDoc.Project.Solution, WorkspaceChangeKind.SolutionChanged)); 1352Assert.True(workspace.SetCurrentSolution(_ => tempDoc.Project.Solution, WorkspaceChangeKind.SolutionChanged)); 1548Assert.True(workspace.SetCurrentSolution(_ => tempDoc.Project.Solution, WorkspaceChangeKind.SolutionChanged)); 1551Assert.True(workspace.SetCurrentSolution(_ => noCompilationProject.Solution, WorkspaceChangeKind.SolutionChanged)); 1715return document.WithText(GetNewText(document, csAddition, vbAddition)).Project.Solution; 1832solution = project.Solution; 1837solution = current.AddDocument($"Document{i}", SourceText.From(documents[i])).Project.Solution; 1843solution = current.AddAdditionalDocument($"AdditionalDocument{i}", SourceText.From(additionalDocuments[i])).Project.Solution; 1849solution = 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; 300s = s.AddProject("newProject", "newProject", LanguageNames.CSharp).Solution; 313return document.Project.Solution; 503.Solution; 514var frozenSolution1 = solution.WithFrozenSourceGeneratedDocument(documentIdentity, DateTime.Now, frozenText1).Project.Solution; 523var frozenSolution2 = solution.WithFrozenSourceGeneratedDocument(documentIdentity, DateTime.Now, frozenText2).Project.Solution; 544solution = project2.Solution; 585solution = project2.Solution; 625var project3 = project2.Solution.AddProject("P3", "P3", LanguageNames.CSharp); 627solution = project3.Solution.AddProjectReference(project3.Id, new(project3.Solution.Projects.Single(p => p.Name == "P2").Id)); 658var project3 = project2.Solution.AddProject("P3", "P3", LanguageNames.CSharp); 660solution = project3.Solution.AddProjectReference(project3.Id, new(project3.Solution.Projects.Single(p => p.Name == "P2").Id)); 699var project3 = project2.Solution.AddProject("P3", "P3", LanguageNames.CSharp); 701solution = project3.Solution.AddProjectReference(project3.Id, new(project2.Id)) 739var project3 = project2.Solution.AddProject("P3", "P3", LanguageNames.CSharp); 741solution = project3.Solution.AddProjectReference(project3.Id, new(project2.Id)) 780solution = project2.Solution; 813solution = project2.Solution; 826solution = solution.GetProject(project1.Id).AddDocument("X.cs", SourceText.From("// X")).Project.Solution; 827solution = solution.GetProject(project2.Id).AddDocument("Y.vb", SourceText.From("' Y")).Project.Solution; 868solution = project2.Solution; 881solution = solution.GetProject(project1.Id).AddDocument("X.cs", SourceText.From("// X")).Project.Solution; 882solution = solution.GetProject(project2.Id).AddDocument("Y.cs", SourceText.From("// Y")).Project.Solution; 883solution = solution.GetProject(project1.Id).AddProjectReference(new ProjectReference(project2.Id)).Solution; 917solution = project1.Solution; 937solution = project2.Solution;
Text.Analyzers (17)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\FixAllContextHelper.cs (1)
72var projectsToFix = project.Solution.Projects
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\ForkingSyntaxEditorBasedCodeFixProvider.cs (1)
71var solutionServices = document.Project.Solution.Services;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\SyntaxEditorBasedCodeFixProvider.cs (1)
84var 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)
85var 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);