1 write to Project
Microsoft.CodeAnalysis.Workspaces (1)
Workspace\Solution\TextDocument.cs (1)
30this.Project = project;
1568 references to Project
AnalyzerRunner (5)
CodeRefactoringRunner.cs (5)
77var syntaxKinds = _syntaxKinds[document.Project.Language]; 86foreach (var refactoringProvider in _refactorings[document.Project.Language]) 95document.Project.Solution, CodeAnalysisProgress.None, cancellationToken).ConfigureAwait(false); 103var changes = applyChangesOperation.ChangedSolution.GetChanges(document.Project.Solution); 105if (projectChanges.Length != 1 || projectChanges[0].ProjectId != document.Project.Id)
IdeBenchmarks (3)
FormatterBenchmarks.cs (2)
49var options = workspace.GlobalOptions.GetSyntaxFormattingOptions(document.Project.Services); 62var options = workspace.GlobalOptions.GetSyntaxFormattingOptions(document.Project.Services);
RegexClassifierBenchmarks.cs (1)
84var extensionManager = document.Project.Solution.Services.GetService<IExtensionManager>();
Microsoft.Analyzers.Extra (6)
CallAnalysis\Fixers\LegacyLoggingFixer.cs (6)
105var details = new FixDetails(method, invocationOp, invocationDoc.Project.DefaultNamespace, invocationDoc.Project.Documents); 313proj = proj.AddDocument(details.TargetFilename, text).Project; 470var solEditor = new SolutionEditor(doc.Project.Solution); 545(sol, targetClass, targetDoc) = await GetOrMakeTargetClassAsync(invocationDoc.Project, details, cancellationToken).ConfigureAwait(false); 580var solEditor = new SolutionEditor(targetDoc.Project.Solution);
Microsoft.Analyzers.Extra.Tests (3)
Resources\RoslynTestUtils.cs (3)
71return proj.AddDocument(name, text).Project; 498project = document.Project; 529var diagnostics = await GetProjectDiagnosticsAsync(document.Project, cancellationToken).ConfigureAwait(false);
Microsoft.Analyzers.Local.Tests (3)
Resources\RoslynTestUtils.cs (3)
71return proj.AddDocument(name, text).Project; 499project = document.Project; 530var diagnostics = await GetProjectDiagnosticsAsync(document.Project, cancellationToken).ConfigureAwait(false);
Microsoft.AspNetCore.Analyzer.Testing (2)
CodeFixRunner.cs (1)
36var updatedProject = updatedSolution.GetProject(document.Project.Id);
DiagnosticVerifier.cs (1)
76projects.Add(document.Project);
Microsoft.AspNetCore.Components.Analyzers.Tests (3)
Helpers\CodeFixVerifier.Helper.cs (1)
82root = Formatter.Format(root, Formatter.Annotation, simplifiedDoc.Project.Solution.Workspace);
Helpers\DiagnosticVerifier.Helper.cs (1)
56projects.Add(document.Project);
Verifiers\CodeFixVerifier.cs (1)
109document = document.WithSyntaxRoot(Formatter.Format(document.GetSyntaxRootAsync().Result, Formatter.Annotation, document.Project.Solution.Workspace));
Microsoft.AspNetCore.Components.SdkAnalyzers.Tests (3)
Helpers\CodeFixVerifier.Helper.cs (1)
82root = Formatter.Format(root, Formatter.Annotation, simplifiedDoc.Project.Solution.Workspace);
Helpers\DiagnosticVerifier.Helper.cs (1)
56projects.Add(document.Project);
Verifiers\CodeFixVerifier.cs (1)
109document = document.WithSyntaxRoot(Formatter.Format(document.GetSyntaxRootAsync().Result, Formatter.Annotation, document.Project.Solution.Workspace));
Microsoft.AspNetCore.Http.Extensions.Tests (11)
RequestDelegateGenerator\CompileTimeCreationTests.cs (10)
56project = project.AddDocument("TestMapActions.cs", SourceText.From(source, Encoding.UTF8)).Project; 57project = project.AddDocument("OtherTestMapActions.cs", SourceText.From(otherSource, Encoding.UTF8)).Project; 82project = project.AddDocument("TestMapActions.cs", SourceText.From(source, Encoding.UTF8)).Project; 83project = project.AddDocument("OtherTestMapActions.cs", SourceText.From(otherSource, Encoding.UTF8)).Project; 165project = project.AddDocument("TestMapActions.cs", SourceText.From(source, Encoding.UTF8), filePath: Path.Combine(currentDirectory, "TestMapActions.cs")).Project; 232project = project.AddDocument("TestMapActions.cs", SourceText.From(source, Encoding.UTF8)).Project; 286project = project.AddDocument("TestMapActions.cs", SourceText.From(source, Encoding.UTF8)).Project; 333project = project.AddDocument("TestMapActions.cs", SourceText.From(source, Encoding.UTF8)).Project; 669project = project.AddDocument("TestMapActions.cs", SourceText.From(source, Encoding.UTF8)).Project; 726project = project.AddDocument("TestMapActions.cs", SourceText.From(source, Encoding.UTF8)).Project;
RequestDelegateGenerator\RequestDelegateCreationTestBase.cs (1)
306var project = _baseProject.AddDocument("TestMapActions.cs", SourceText.From(source, Encoding.UTF8)).Project;
Microsoft.AspNetCore.Http.Microbenchmarks (2)
RequestDelegateGeneratorBenchmarks.cs (1)
32project = project.AddDocument("TestMapActions.cs", SourceText.From(source, Encoding.UTF8)).Project;
src\Http\Http.Extensions\test\RequestDelegateGenerator\RequestDelegateCreationTestBase.cs (1)
306var project = _baseProject.AddDocument("TestMapActions.cs", SourceText.From(source, Encoding.UTF8)).Project;
Microsoft.CodeAnalysis.CodeStyle.Fixes (79)
src\Analyzers\Core\CodeFixes\AddObsoleteAttribute\AbstractAddObsoleteAttributeCodeFixProvider.cs (1)
60var compilation = await document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false);
src\Analyzers\Core\CodeFixes\AddParameter\AddParameterService.cs (2)
90var solution = invocationDocument.Project.Solution; 219method, invocationDocument.Project.Solution, cancellationToken).ConfigureAwait(false);
src\Analyzers\Core\CodeFixes\AnalyzerOptionsProviders.cs (2)
17var analyzerOptions = document.Project.AnalyzerOptions; 20return new AnalyzerOptionsProvider(configOptions, document.Project.Language);
src\Analyzers\Core\CodeFixes\ConvertToAsync\AbstractConvertToAsyncCodeFixProvider.cs (1)
72var otherDocument = document.Project.Solution.GetDocument(syntaxTree);
src\Analyzers\Core\CodeFixes\FileHeaders\AbstractFileHeaderCodeFixProvider.cs (1)
65!document.Project.AnalyzerOptions.AnalyzerConfigOptionsProvider.GetOptions(tree).TryGetEditorConfigOption(CodeStyleOptions2.FileHeaderTemplate, out fileHeaderTemplate))
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.State.cs (2)
454document.Project.Solution, 500document.Project.Solution,
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\GenerateDefaultConstructorsCodeAction.cs (1)
42_document.Project.Solution,
src\Analyzers\Core\CodeFixes\GenerateEnumMember\AbstractGenerateEnumMemberService.CodeAction.cs (2)
26var languageServices = _document.Project.Solution.Workspace.Services.GetExtendedLanguageServices(_state.TypeToGenerateIn.Language); 36_document.Project.Solution,
src\Analyzers\Core\CodeFixes\GenerateMember\AbstractGenerateMemberCodeFixProvider.cs (1)
34if (context.Document.Project.IsSubmission)
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.CodeAction.cs (3)
67var syntaxFactory = _document.Project.Solution.Services.GetLanguageServices(_state.TypeToGenerateIn.Language).GetService<SyntaxGenerator>(); 75_document.Project.Solution, 91_document.Project.Solution,
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.cs (1)
57var semanticFacts = document.Project.Solution.Workspace.Services.GetExtendedLanguageServices(state.TypeToGenerateIn.Language).GetService<ISemanticFactsService>();
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.cs (2)
47var canGenerateMember = CodeGenerator.CanAdd(document.Project.Solution, state.TypeToGenerateIn, cancellationToken); 208var compilation = await document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false);
src\Analyzers\Core\CodeFixes\ImplementAbstractClass\ImplementAbstractClassData.cs (1)
60if (!CodeGenerator.CanAdd(document.Project.Solution, classType, cancellationToken))
src\Analyzers\Core\CodeFixes\ImplementInterface\AbstractImplementInterfaceCodeFixProvider.cs (2)
128var compilation = await document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false); 130var supportsImplicitImplementationOfNonPublicInterfaceMembers = syntaxFacts.SupportsImplicitImplementationOfNonPublicInterfaceMembers(document.Project.ParseOptions!);
src\Analyzers\Core\CodeFixes\ImplementInterface\AbstractImplementInterfaceService.cs (2)
110var supportsImplementingLessAccessibleMember = syntaxFacts.SupportsImplicitImplementationOfNonPublicInterfaceMembers(document.Project.ParseOptions!); 116generateInvisibly: generator.ShouldGenerateInvisibleMember(document.Project.ParseOptions!, interfaceMember, interfaceMember.Name, supportsImplementingLessAccessibleMember),
src\Analyzers\Core\CodeFixes\ImplementInterface\AbstractImplementInterfaceService.State.cs (1)
55if (!CodeGenerator.CanAdd(document.Project.Solution, classOrStructType, cancellationToken))
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator.cs (2)
81var compilation = await this.Document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false); 96this.Document.Project.Solution,
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator_DisposePattern.cs (2)
50var compilation = await document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false); 243var compilation = await document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false);
src\Analyzers\Core\CodeFixes\ImplementType\ImplementTypeOptions.cs (1)
80return configOptions.GetImplementTypeOptions(document.Project.Language);
src\Analyzers\Core\CodeFixes\MakeMethodAsynchronous\AbstractMakeMethodAsynchronousCodeFixProvider.cs (2)
164var solution = document.Project.Solution; 198return newDocument.Project.Solution;
src\Analyzers\Core\CodeFixes\MakeMethodSynchronous\AbstractMakeMethodSynchronousCodeFixProvider.cs (6)
77var solution = document.Project.Solution; 99var compilation = await document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false); 110var newSolution = newDocument.Project.Solution; 133methodSymbol, document.Project.Solution, cancellationToken).ConfigureAwait(false); 146document.Project.Solution, referencedSymbol.Locations.ToImmutableArray(), cancellationToken).ConfigureAwait(false); 151return document.Project.Solution;
src\Analyzers\Core\CodeFixes\MatchFolderAndNamespace\AbstractChangeNamespaceToMatchFolderCodeFixProvider.cs (4)
27var service = context.Document.Project.Solution.Services.GetRequiredService<ISupportedChangesService>(); 54var targetFolders = PathMetadataUtilities.BuildFoldersFromNamespace(targetNamespace, document.Project.DefaultNamespace); 63var newSolution = await renameActionSet.UpdateSolutionAsync(documentWithInvalidFolders.Project.Solution, cancellationToken).ConfigureAwait(false); 64Debug.Assert(newSolution != document.Project.Solution);
src\Analyzers\Core\CodeFixes\NamingStyle\NamingStyleCodeFixProvider.cs (1)
107document.Project.Solution, symbol, new SymbolRenameOptions(), fixedName,
src\Analyzers\Core\CodeFixes\RemoveAsyncModifier\AbstractRemoveAsyncModifierCodeFixProvider.cs (2)
33var compilation = await document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false); 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); 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)
43var project = context.Document.Project;
src\Analyzers\Core\CodeFixes\UseConditionalExpression\AbstractUseConditionalExpressionCodeFixProvider.cs (1)
56var nestedEditor = new SyntaxEditor(root, document.Project.Solution.Services);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeCleanup\CodeCleanupOptionsProviders.cs (1)
30return configOptions.GetCodeCleanupOptions(document.Project.GetExtendedLanguageServices().LanguageServices, document.AllowImportsInHiddenRegions());
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\ForkingSyntaxEditorBasedCodeFixProvider.cs (1)
73var solutionServices = document.Project.Solution.Services;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\SyntaxEditorBasedCodeFixProvider.cs (1)
75var editor = new SyntaxEditor(root, document.Project.Solution.Services);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationOptionsProviders.cs (3)
38return configOptions.GetCodeGenerationOptions(document.Project.GetExtendedLanguageServices().LanguageServices); 43Contract.ThrowIfNull(document.Project.ParseOptions); 47return service.GetInfo(context, options, document.Project.ParseOptions);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (6)
33=> document?.Project?.GetLanguageService<TLanguageService>(); 36=> document.Project.GetRequiredLanguageService<TLanguageService>(); 98var workspace = document.Project.Solution.Workspace; 163var semanticModelService = document.Project.Solution.Services.GetRequiredService<ISemanticModelReuseWorkspaceService>(); 219var solution = document.Project.Solution; 234return document.Project.AnalyzerOptions.AnalyzerConfigOptionsProvider.GetOptions(syntaxTree).GetOptionsReader();
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\Formatting\LineFormattingOptionsProviders.cs (1)
20return configOptions.GetLineFormattingOptions(document.Project.Language);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\GeneratedCodeRecognition\AbstractGeneratedCodeRecognitionService.cs (1)
34return syntaxTree.IsGeneratedCode(document.Project.AnalyzerOptions, syntaxFacts, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\InitializeParameter\AbstractInitializerParameterService.cs (4)
108return document.Project.Solution; 124var editor = new SyntaxEditor(root, document.Project.Solution.Services); 128return newDocument.Project.Solution; 131return document.Project.Solution;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.cs (1)
84var editor = new SyntaxEditor(root, document.Project.Solution.Services);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (1)
91var findReferencesResult = await SymbolFinder.FindReferencesAsync(LocalSymbol, document.Project.Solution, cancellationToken).ConfigureAwait(false);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\NamingStyles\NamingStylePreferencesProviders.cs (1)
18return configOptions.GetOption(NamingStyleOptions.NamingPreferences, document.Project.Language);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Options\MemberDisplayOptions.cs (1)
53return configOptions.GetMemberDisplayOptions(document.Project.Language);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (1)
199rewriter.Initialize(document.Project.ParseOptions, options, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\ParsedDocument.cs (1)
39return new ParsedDocument(document.Id, text, root, document.Project.GetExtendedLanguageServices());
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\SyntacticDocument.cs (1)
25public Project Project => Document.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\FixIncorrectConstraint\CSharpFixIncorrectConstraintCodeFixProvider.cs (1)
81var compilation = await document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false);
src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateDeconstructMethodCodeFixProvider.cs (1)
44if (context.Document.Project.IsSubmission)
src\Analyzers\CSharp\CodeFixes\InlineDeclaration\CSharpInlineDeclarationCodeFixProvider.cs (1)
105var editor = new SyntaxEditor(currentRoot, document.Project.Solution.Services);
src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\MakeLocalFunctionStaticCodeFixHelper.cs (3)
35var syntaxEditor = new SyntaxEditor(root, document.Project.Solution.Services); 54localFunctionSymbol, document.Project.Solution, documentImmutableSet, cancellationToken).ConfigureAwait(false); 126capture, document.Project.Solution, documentImmutableSet, cancellationToken).ConfigureAwait(false);
src\Analyzers\CSharp\CodeFixes\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementCodeFixProvider.cs (1)
49var editor = new SyntaxEditor(root, document.Project.Solution.Services);
src\Analyzers\CSharp\CodeFixes\RemoveConfusingSuppression\CSharpRemoveConfusingSuppressionCodeFixProvider.cs (1)
63var editor = new SyntaxEditor(root, document.Project.Solution.Services);
src\Analyzers\CSharp\CodeFixes\UpdateProjectToAllowUnsafe\CSharpUpdateProjectToAllowUnsafeCodeFixProvider.cs (1)
35_ => Task.FromResult(AllowUnsafeOnProject(context.Document.Project))), context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpUseCollectionExpressionForArrayCodeFixProvider.cs (1)
42var 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)
65var editor = new SyntaxEditor(root, document.Project.Solution.Services);
src\Analyzers\CSharp\CodeFixes\UseLocalFunction\CSharpUseLocalFunctionCodeFixProvider.cs (1)
109document.Project.Solution.Services, currentRoot,
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (2)
102var solutionEditor = new SolutionEditor(document.Project.Solution); 118var solution = document.Project.Solution;
src\Analyzers\CSharp\CodeFixes\UseSystemThreadingLock\CSharpUseSystemThreadingLockCodeFixProvider.cs (3)
67var solutionEditor = new SolutionEditor(document.Project.Solution); 82var solution = document.Project.Solution; 123.Where(loc => loc.Document.Project == document.Project)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpReplaceDiscardDeclarationsWithAssignmentsService.cs (1)
44var editor = new SyntaxEditor(memberDeclaration, document.Project.Solution.Services);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (1)
40var project = document.Project;
Microsoft.CodeAnalysis.CSharp.EditorFeatures (15)
ConvertNamespace\ConvertNamespaceCommandHandler.cs (2)
144var formattingOptions = subjectBuffer.GetSyntaxFormattingOptions(_editorOptionsService, document.Project.GetFallbackAnalyzerOptions(), document.Project.Services, explicitFormat: false);
EventHookup\EventHookupCommandHandler_TabKeyCommand.cs (3)
148var 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 (4)
84var options = textBuffer.GetSyntaxFormattingOptions(_editorOptionsService, document.Project.GetFallbackAnalyzerOptions(), parsedDocument.LanguageServices, explicitFormat: true); 89return Task.FromResult(Formatter.GetFormattedTextChanges(parsedDocument.Root, [formattingSpan], document.Project.Solution.Services, options, cancellationToken).ToImmutableArray()); 95var options = textBuffer.GetSyntaxFormattingOptions(_editorOptionsService, document.Project.GetFallbackAnalyzerOptions(), parsedDocument.LanguageServices, explicitFormat: true); 110var indentationOptions = textBuffer.GetIndentationOptions(_editorOptionsService, document.Project.GetFallbackAnalyzerOptions(), parsedDocument.LanguageServices, explicitFormat: false);
RawStringLiteral\RawStringLiteralCommandHandler_Return.cs (1)
165var project = document.Project;
SplitStringLiteral\SplitStringLiteralCommandHandler.cs (1)
83var indentationOptions = subjectBuffer.GetIndentationOptions(_editorOptionsService, document.Project.GetFallbackAnalyzerOptions(), parsedDocument.LanguageServices, explicitFormat: false);
StringCopyPaste\StringCopyPasteCommandHandler.cs (2)
190parsedDocumentBeforePaste, subjectBuffer, snapshotBeforePaste.AsText(), stringExpressionBeforePaste, documentBeforePaste.Project.GetFallbackAnalyzerOptions(), cancellationToken); 216var copyPasteService = documentBeforePaste.Project.Solution.Services.GetRequiredService<IStringCopyPasteService>();
StringCopyPaste\StringCopyPasteCommandHandler_CutCopy.cs (1)
58var copyPasteService = document.Project.Solution.Services.GetService<IStringCopyPasteService>();
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (24)
CodeActions\ApplyChangesOperationTests.cs (1)
36var codeAction = new TestCodeAction(_changeSolution(context.Document.Project.Solution));
CodeActions\MoveType\MoveTypeTests.MoveScope.cs (2)
928Assert.NotEqual(documentToModify.Project.Solution, modifiedSolution); 932Assert.Equal(documentToModify.Project.Solution, modifiedSolution);
CodeActions\PreviewExceptionTests.cs (1)
114extensionManager = document.Project.Solution.Services.GetService<IExtensionManager>() as EditorLayerExtensionManager.ExtensionManager;
CodeActions\PreviewTests.cs (5)
70var solution = _oldDocument.Project.Solution; 73solution = solution.AddDocument(DocumentId.CreateNewId(_oldDocument.Project.Id, AddedDocumentName), AddedDocumentName, AddedDocumentText); 76var removedReference = _oldDocument.Project.MetadataReferences[_oldDocument.Project.MetadataReferences.Count - 1]; 78solution = solution.RemoveMetadataReference(_oldDocument.Project.Id, removedReference);
Completion\CompletionProviders\AbstractCSharpCompletionProviderTests.cs (1)
185var service = GetCompletionService(document.Project);
Completion\CompletionProviders\ObjectInitializerCompletionProviderTests.cs (2)
693var service = GetCompletionService(document.Project); 1353var service = GetCompletionService(document.Project);
Completion\CompletionProviders\SuggestionModeCompletionProviderTests.cs (1)
1531var service = GetCompletionService(document.Project);
Completion\CompletionServiceTests.cs (2)
62var provider = service.GetProvider(item, document.Project); 208.AddDocument("Document1.cs", sourceMarkup, filePath: "Document1.cs").Project;
ExtractMethod\ExtractMethodBase.cs (1)
127CodeGenerationOptions = CodeGenerationOptionsProviders.GetDefault(document.Project.Services),
Formatting\CodeCleanupTests.cs (1)
805project = project.AddAnalyzerConfigDocument(".editorconfig", SourceText.From(editorconfigText), filePath: @"z:\\.editorconfig").Project;
Workspaces\WorkspaceTests_EditorFeatures.cs (7)
579var newVersionX = await doc1Z.Project.GetDependentSemanticVersionAsync(); 651var compilation2Z = await partialDoc2Z.Project.GetCompilationAsync(); 672var compilation2Z = await doc2Z.Project.GetCompilationAsync(); 1124Assert.NotEqual(oldVersion, await doc.Project.GetSemanticVersionAsync()); 1157Assert.NotEqual(oldVersion, await doc.Project.GetSemanticVersionAsync()); 1310workspace.TryApplyChanges(doc.Project.Solution); 1338workspace.TryApplyChanges(doc.Project.Solution);
Microsoft.CodeAnalysis.CSharp.Features (48)
AddDebuggerDisplay\CSharpAddDebuggerDisplayCodeRefactoringProvider.cs (1)
25=> document.Project.ParseOptions!.LanguageVersion().HasConstantInterpolatedStrings();
AddImport\CSharpAddImportFeatureService.cs (1)
399var compilation = await document.Project.GetCompilationAsync(cancellationToken).ConfigureAwait(false);
ChangeSignature\CSharpChangeSignatureService.cs (2)
787return GetPermutedDocCommentTrivia(node, permutedParamNodes, document.Project.Services, lineFormattingOptions); 873convertedType = SymbolFinder.FindSourceDefinition(convertedType, document.Project.Solution, cancellationToken)
CodeRefactorings\SyncNamespace\CSharpChangeNamespaceService.cs (2)
44if (document.Project.Solution.WorkspaceKind == WorkspaceKind.MiscellaneousFiles 70document.Project.Solution, allDocumentIds, containerSpan, cancellationToken).ConfigureAwait(false);
CodeRefactorings\UseExplicitOrImplicitType\AbstractUseTypeCodeRefactoringProvider.cs (1)
121var editor = new SyntaxEditor(root, document.Project.Solution.Services);
Completion\CompletionProviders\ExternAliasCompletionProvider.cs (1)
67var compilation = await document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false);
Completion\CompletionProviders\NamedParameterCompletionProvider.cs (1)
102var languageVersion = document.Project.ParseOptions!.LanguageVersion();
Completion\CompletionProviders\SnippetCompletionProvider.cs (3)
83var solution = document.Project.Solution; 143completionContext, document.Project.Solution.Services, semanticModel, isPreProcessorContext: true); 159completionContext, document.Project.Solution.Services, semanticModel, isPreProcessorContext: false);
ConvertPrimaryToRegularConstructor\ConvertPrimaryToRegularConstructorCodeRefactoringProvider.cs (2)
71var compilation = await document.Project.GetCompilationAsync(cancellationToken).ConfigureAwait(false); 92var solution = document.Project.Solution;
ConvertProgram\ConvertProgramTransform_ProgramMain.cs (1)
34var compilation = await document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false);
DecompiledSource\CSharpDecompiledSourceService.cs (1)
73var compilation = await document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false);
EncapsulateField\CSharpEncapsulateFieldService.cs (1)
107document.Project.Solution,
Formatting\CSharpAccessibilityModifiersNewDocumentFormattingProvider.cs (1)
42var editor = new SyntaxEditor(root, document.Project.Solution.Services);
InitializeParameter\CSharpInitializeMemberFromPrimaryConstructorParameterCodeRefactoringProvider_Update.cs (2)
41var currentSolution = document.WithSyntaxRoot(trackedRoot).Project.Solution; 80var project = document.Project;
NavigationBar\CSharpNavigationBarItemService.cs (1)
53return GetMembersInTypes(document.Project.Solution, tree, typesInFile, cancellationToken);
QuickInfo\CSharpDiagnosticAnalyzerQuickInfoProvider.cs (2)
134var hostAnalyzers = document.Project.Solution.SolutionState.Analyzers; 135var groupedDiagnostics = hostAnalyzers.GetDiagnosticDescriptorsPerReference(_diagnosticAnalyzerInfoCache, document.Project).Values;
ReverseForStatement\CSharpReverseForStatementCodeRefactoringProvider.cs (1)
272var editor = new SyntaxEditor(root, document.Project.Solution.Services);
SignatureHelp\InvocationExpressionSignatureHelpProvider.cs (1)
154var structuralTypeDisplayService = document.Project.Services.GetRequiredService<IStructuralTypeDisplayService>();
SignatureHelp\ObjectCreationExpressionSignatureHelpProvider.cs (2)
97var structuralTypeDisplayService = document.Project.Services.GetRequiredService<IStructuralTypeDisplayService>(); 127var structuralTypeDisplayService = document.Project.Services.GetRequiredService<IStructuralTypeDisplayService>();
Snippets\AbstractCSharpAutoPropertySnippetProvider.cs (1)
44var compilation = await document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false);
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (1)
91var solutionEditor = new SolutionEditor(document.Project.Solution);
src\Analyzers\CSharp\CodeFixes\FixIncorrectConstraint\CSharpFixIncorrectConstraintCodeFixProvider.cs (1)
81var compilation = await document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false);
src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateDeconstructMethodCodeFixProvider.cs (1)
44if (context.Document.Project.IsSubmission)
src\Analyzers\CSharp\CodeFixes\InlineDeclaration\CSharpInlineDeclarationCodeFixProvider.cs (1)
105var editor = new SyntaxEditor(currentRoot, document.Project.Solution.Services);
src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\MakeLocalFunctionStaticCodeFixHelper.cs (3)
35var syntaxEditor = new SyntaxEditor(root, document.Project.Solution.Services); 54localFunctionSymbol, document.Project.Solution, documentImmutableSet, cancellationToken).ConfigureAwait(false); 126capture, document.Project.Solution, documentImmutableSet, cancellationToken).ConfigureAwait(false);
src\Analyzers\CSharp\CodeFixes\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementCodeFixProvider.cs (1)
49var editor = new SyntaxEditor(root, document.Project.Solution.Services);
src\Analyzers\CSharp\CodeFixes\RemoveConfusingSuppression\CSharpRemoveConfusingSuppressionCodeFixProvider.cs (1)
63var editor = new SyntaxEditor(root, document.Project.Solution.Services);
src\Analyzers\CSharp\CodeFixes\UpdateProjectToAllowUnsafe\CSharpUpdateProjectToAllowUnsafeCodeFixProvider.cs (1)
35_ => Task.FromResult(AllowUnsafeOnProject(context.Document.Project))), context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpUseCollectionExpressionForArrayCodeFixProvider.cs (1)
42var 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)
65var editor = new SyntaxEditor(root, document.Project.Solution.Services);
src\Analyzers\CSharp\CodeFixes\UseLocalFunction\CSharpUseLocalFunctionCodeFixProvider.cs (1)
109document.Project.Solution.Services, currentRoot,
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (2)
102var solutionEditor = new SolutionEditor(document.Project.Solution); 118var solution = document.Project.Solution;
src\Analyzers\CSharp\CodeFixes\UseSystemThreadingLock\CSharpUseSystemThreadingLockCodeFixProvider.cs (3)
67var solutionEditor = new SolutionEditor(document.Project.Solution); 82var solution = document.Project.Solution; 123.Where(loc => loc.Document.Project == document.Project)
UseAutoProperty\CSharpUseAutoPropertyCodeFixProvider.cs (1)
91var project = propertyDocument.Project;
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (2)
EditAndContinue\CSharpEditAndContinueAnalyzerTests.cs (2)
45AddDocument("test.cs", SourceText.From(source, Encoding.UTF8), filePath: Path.Combine(TempRoot.Root, "test.cs")).Project.Solution; 464AddDocument("test.cs", root, filePath: Path.Combine(TempRoot.Root, "test.cs")).Project.Solution;
Microsoft.CodeAnalysis.CSharp.Workspaces (3)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (1)
456foreach (var generatedDocument in await document.Project.GetSourceGeneratedDocumentsAsync(cancellationToken).ConfigureAwait(false))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpReplaceDiscardDeclarationsWithAssignmentsService.cs (1)
44var editor = new SyntaxEditor(memberDeclaration, document.Project.Solution.Services);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (1)
40var project = document.Project;
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (2)
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 (110)
AddImports\AbstractAddImportsPasteCommandHandler.cs (2)
137var indicatorFactory = document.Project.Solution.Services.GetRequiredService<IBackgroundWorkIndicatorFactory>(); 166document.Project.Solution.Workspace.TryApplyChanges(updatedDocument.Project.Solution);
AutomaticCompletion\AbstractAutomaticLineEnderCommandHandler.cs (2)
135ModifySelectedNode(args, parsedDocument, selectedNode, addBrace, caretPosition, document.Project.GetFallbackAnalyzerOptions(), cancellationToken); 146var formattingOptions = args.SubjectBuffer.GetSyntaxFormattingOptions(EditorOptionsService, document.Project.GetFallbackAnalyzerOptions(), parsedDocument.LanguageServices, explicitFormat: false);
AutomaticCompletion\BraceCompletionSessionProvider.BraceCompletionSession.cs (3)
102var context = GetBraceCompletionContext(parsedDocument, document.Project.GetFallbackAnalyzerOptions()); 121var indentationOptions = SubjectBuffer.GetIndentationOptions(_editorOptionsService, document.Project.GetFallbackAnalyzerOptions(), contextAfterStart.Document.LanguageServices, explicitFormat: false); 393context = GetBraceCompletionContext(ParsedDocument.CreateSynchronously(document, cancellationToken), document.Project.GetFallbackAnalyzerOptions());
ChangeSignature\AbstractChangeSignatureCommandHandler.cs (1)
92HandleResult(result, document.Project.Solution, workspace, context);
Classification\CopyPasteAndPrintingClassificationBufferTaggerProvider.Tagger.cs (1)
149var options = _globalOptions.GetClassificationOptions(document.Project.Language);
Classification\Syntactic\SyntacticClassificationTaggerProvider.TagComputer.cs (1)
481if (_lineCache.TryUseCache(lastProcessedDocument.Id, lastProcessedDocument.Project.ParseOptions, span, classifiedSpans))
CodeDefinitionWindow\DefinitionContextTracker.cs (4)
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); 185var declarationFile = await _metadataAsSourceFileService.GetGeneratedFileAsync(workspace, document.Project, symbol, signaturesOnly: false, options: options, cancellationToken: cancellationToken).ConfigureAwait(false);
CommentSelection\AbstractCommentSelectionBase.cs (3)
152var formattingOptions = subjectBuffer.GetSyntaxFormattingOptions(_editorOptionsService, document.Project.GetFallbackAnalyzerOptions(), document.Project.Services, explicitFormat: false); 154var formattedChanges = Formatter.GetFormattedTextChanges(newRoot, formattingSpans, document.Project.Solution.Services, formattingOptions, rules: default, cancellationToken);
CommentSelection\AbstractToggleBlockCommentBase.cs (1)
77m[LanguageNameString] = document.Project.Language;
CommentSelection\ToggleLineCommentCommandHandler.cs (1)
63m[LanguageNameString] = document.Project.Language;
DocumentationComments\AbstractDocumentationCommentCommandHandler.cs (2)
89var options = subjectBuffer.GetDocumentationCommentOptions(_editorOptionsService, document.Project.Services); 324var options = subjectBuffer.GetDocumentationCommentOptions(_editorOptionsService, document.Project.Services);
EditAndContinue\ActiveStatementTrackingService.cs (2)
170var compileTimeSolution = _compileTimeSolutionProvider.GetCompileTimeSolution(designTimeDocument.Project.Solution); 354var solution = document.Project.Solution;
EditAndContinue\PdbMatchingSourceTextProvider.cs (1)
86var oldSolutionVersion = oldDocument.Project.Solution.WorkspaceVersion;
EncapsulateField\AbstractEncapsulateFieldCommandHandler.cs (2)
67var workspace = initialDocument.Project.Solution.Workspace; 107var solution = document.Project.Solution;
Extensibility\NavigationBar\AbstractEditorNavigationBarItemService.cs (1)
48var workspace = document.Project.Solution.Workspace;
ExternalAccess\IntelliCode\IntentProcessor.cs (3)
46var languageName = currentDocument.Project.Language; 93newSolution = await newSolution.WithMergedLinkedFileChangesAsync(originalDocument.Project.Solution, cancellationToken: cancellationToken).ConfigureAwait(false); 99var docChanges = await GetTextChangesForDocumentAsync(newSolution, currentDocument.Project.Solution, changedDocumentId, cancellationToken).ConfigureAwait(false);
ExternalAccess\UnitTestGenerator\Api\UnitTestGeneratorAddMissingImportsFeatureServiceAccessor.cs (3)
26var service = document.Project.GetRequiredLanguageService<IAddMissingImportsFeatureService>(); 36var service = document.Project.GetRequiredLanguageService<IAddMissingImportsFeatureService>(); 45var service = document.Project.GetRequiredLanguageService<IAddMissingImportsFeatureService>();
ExternalAccess\VSTypeScript\VSTypeScriptNavigationBarItemService.cs (1)
59var workspace = document.Project.Solution.Workspace;
ExtractInterface\AbstractExtractInterfaceCommandHandler.cs (1)
79if (!document.Project.Solution.Workspace.TryApplyChanges(result.UpdatedSolution))
ExtractMethod\ExtractMethodCommandHandler.cs (2)
116var indicatorFactory = document.Project.Solution.Services.GetRequiredService<IBackgroundWorkIndicatorFactory>(); 219var notificationService = document.Project.Solution.Services.GetService<INotificationService>();
FindReferences\FindReferencesCommandHandler.cs (2)
134IncludeContainingTypeAndMemberColumns = document.Project.SupportsCompilation, 135IncludeKindColumn = document.Project.Language != LanguageNames.FSharp
Formatting\FormatCommandHandler.cs (1)
85var ruleFactory = document.Project.Solution.Services.GetRequiredService<IHostDependentFormattingRuleFactoryService>();
Formatting\FormatCommandHandler.Paste.cs (2)
62if (!_globalOptions.GetOption(FormattingOptionsStorage.FormatOnPaste, document.Project.Language)) 65var solution = document.Project.Solution;
GoToDefinition\AbstractGoToCommandHandler`2.cs (2)
191document.Project.Solution.Workspace, 262var service = document.Project.Solution.Services.GetRequiredService<IWorkspaceStatusService>();
GoToDefinition\GoToDefinitionCommandHandler.cs (2)
107var indicatorFactory = document.Project.Solution.Services.GetRequiredService<IBackgroundWorkIndicatorFactory>(); 145var notificationService = document.Project.Solution.Services.GetRequiredService<INotificationService>();
InlineRename\AbstractEditorInlineRenameService.SymbolRenameInfo.cs (3)
135var solution = this.Document.Project.Solution; 157this.Document.Project.Solution.CanApplyChange(ApplyChangesKind.ChangeDocumentInfo)) 167var symbolSourceDocument = this.Document.Project.Solution.GetDocument(RenameSymbol.Locations.Single().SourceTree);
InlineRename\InlineRenameService.cs (2)
108document.Project.Solution.Workspace, 128var workspace = document.Project.Solution.Workspace;
InlineRename\InlineRenameSession.cs (1)
187_baseSolution = TriggerDocument.Project.Solution;
InlineRename\InlineRenameSession.OpenTextBufferManager.cs (3)
573var textDiffService = oldDocument.Project.Solution.Services.GetService<IDocumentTextDifferencingService>(); 591var textDiffService = preMergeDocument.Project.Solution.Services.GetService<IDocumentTextDifferencingService>(); 592var contentType = preMergeDocument.Project.Services.GetService<IContentTypeLanguageService>().GetDefaultContentType();
IntelliSense\AsyncCompletion\CommitManager.cs (2)
143var options = _globalOptions.GetCompletionOptions(document.Project.Language); 243var provider = completionService.GetProvider(roslynItem, document.Project);
IntelliSense\AsyncCompletion\CompletionSource.cs (13)
116var options = _editorOptionsService.GlobalOptions.GetCompletionOptions(document.Project.Language); 162return TryInvokeSnippetCompletion(triggerLocation.Snapshot.TextBuffer, triggerLocation.Position, sourceText, document.Project.Services, completionService.GetRules(options)); 169document.Project, document.Project.Services, sourceText, triggerLocation.Position, roslynTrigger, options, document.Project.Solution.Options, _roles); 253var showCompletionItemFilters = _editorOptionsService.GlobalOptions.GetOption(CompletionViewOptionsStorage.ShowCompletionItemFilters, document.Project.Language); 254var options = _editorOptionsService.GlobalOptions.GetCompletionOptions(document.Project.Language) with 352var options = _editorOptionsService.GlobalOptions.GetCompletionOptions(document.Project.Language) with 394document, triggerLocation, options, document.Project.Solution.Options, roslynTrigger, _roles, cancellationToken).ConfigureAwait(false); 396var filterSet = new FilterSet(document.Project.Language is LanguageNames.CSharp or LanguageNames.VisualBasic); 475var completionOptions = _editorOptionsService.GlobalOptions.GetCompletionOptions(document.Project.Language); 476var displayOptions = _editorOptionsService.GlobalOptions.GetSymbolDescriptionOptions(document.Project.Language); 536var supportedPlatforms = SymbolCompletionItem.GetSupportedPlatforms(roslynItem, document.Project.Solution);
IntelliSense\AsyncCompletion\ItemManager.CompletionListUpdater.cs (3)
97_completionRules = _completionService?.GetRules(globalOptions.GetCompletionOptions(_document.Project.Language)) ?? CompletionRules.Default; 108&& globalOptions.GetOption(CompletionViewOptionsStorage.HighlightMatchingPortionsOfCompletionListItems, _document.Project.Language); 110_showCompletionItemFilters = globalOptions.GetOption(CompletionViewOptionsStorage.ShowCompletionItemFilters, _document.Project.Language);
IntelliSense\QuickInfo\QuickInfoSourceProvider.QuickInfoSource.cs (2)
78var options = _editorOptionsService.GlobalOptions.GetSymbolDescriptionOptions(document.Project.Language); 84var classificationOptions = _editorOptionsService.GlobalOptions.GetClassificationOptions(document.Project.Language);
Intents\DeleteParameterIntentProvider.cs (1)
62var changedDocuments = changeSignatureResult.UpdatedSolution.GetChangedDocuments(priorDocument.Project.Solution).ToImmutableArray();
Navigation\AbstractDefinitionLocationService.cs (1)
32var solution = document.Project.Solution;
NavigationBar\NavigationBarController.cs (4)
249d.Project.Name, 250d.Project.GetGlyph(), 251workspace: d.Project.Solution.Workspace, 253language: d.Project.Language))
Preview\AbstractPreviewFactoryService.cs (9)
258document.Name, document.Project.Name); 289using var rightWorkspace = new ReferenceCountedDisposable<PreviewWorkspace>(new PreviewWorkspace(document.Project.Solution)); 330document.Name, document.Project.Name); 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)); 799oldDocument.Project.Services.GetRequiredService<IContentTypeLanguageService>().GetDefaultContentType());
RenameTracking\RenameTrackingCancellationCommandHandler.cs (1)
43RenameTrackingDismisser.DismissVisibleRenameTracking(document.Project.Solution.Workspace, document.Id);
RenameTracking\RenameTrackingTaggerProvider.RenameTrackingCodeAction.cs (2)
71if (!_globalOptions.GetOption(RenameTrackingOptionsStorage.RenameTrackingPreview, _document.Project.Language) || 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.TrackingSession.cs (2)
224var sourceSymbol = SymbolFinder.FindSourceDefinition(symbol, document.Project.Solution, _cancellationToken) ?? symbol; 238var sourceSymbol = SymbolFinder.FindSourceDefinition(symbol, document.Project.Solution, _cancellationToken) ?? symbol;
Shared\Extensions\ITextSnapshotExtensions.cs (2)
42var options = textBuffer.GetSyntaxFormattingOptions(editorOptionsService, document.Project.GetFallbackAnalyzerOptions(), document.Project.Services, explicitFormat: false);
SmartIndent\SmartIndent.cs (2)
45var indentationOptions = line.Snapshot.TextBuffer.GetIndentationOptions(_editorOptionsService, document.Project.GetFallbackAnalyzerOptions(), document.Project.Services, explicitFormat: false);
SpellCheck\RoslynSpellCheckFixerProvider.cs (1)
109var workspace = document.Project.Solution.Workspace;
SplitComment\SplitCommentCommandHandler.cs (1)
65if (!_globalOptions.GetOption(SplitCommentOptionsStorage.Enabled, document.Project.Language))
Structure\AbstractStructureTaggerProvider.cs (6)
67if (!GlobalOptions.GetOption(OutliningOptionsStorage.Outlining, openDocument.Project.Language)) 70var options = BlockStructureOptionsStorage.GetBlockStructureOptions(GlobalOptions, openDocument.Project); 74if (openDocument.Project.Solution.Workspace is MetadataAsSourceWorkspace masWorkspace && 83var collapseRegions = GlobalOptions.GetOption(BlockStructureOptionsStorage.CollapseRegionsWhenFirstOpened, openDocument.Project.Language); 84var collapseImports = GlobalOptions.GetOption(BlockStructureOptionsStorage.CollapseImportsWhenFirstOpened, openDocument.Project.Language); 91if (ContainsRegionOrImport(subjectBuffer.CurrentSnapshot, collapseRegions, collapseImports, openDocument.Project.Language))
TextDiffing\EditorTextDifferencingService.cs (1)
35var diffService = _differenceSelectorService.GetTextDifferencingService(oldDocument.Project.Services.GetService<IContentTypeLanguageService>().GetDefaultContentType())
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (20)
ChangeSignature\AddedParameterOrExistingIndex.cs (1)
66var type = document.Project.Language switch
Completion\AbstractCompletionProviderTests.cs (15)
191var completionService = GetCompletionService(document.Project); 374return await GetCompletionListAsync(GetCompletionService(currentDocument.Project), currentDocument, position, RoslynCompletion.CompletionTrigger.Invoke, options).ConfigureAwait(false); 612var service = GetCompletionService(document.Project); 619if (service.GetProvider(firstItem, document.Project) is ICustomCommitCompletionProvider customCommitCompletionProvider) 659document.Project.Solution.Workspace.TryApplyChanges(newDoc.Project.Solution); 736var service = GetCompletionService(document.Project); 965var completionService = GetCompletionService(document.Project); 1019var completionService = GetCompletionService(document.Project); 1049var completionService = GetCompletionService(document.Project); 1278var service = GetCompletionService(document.Project); 1286var isTextualTriggerCharacterResult = service.ShouldTriggerCompletion(document.Project, document.Project.Services, text, position + 1, trigger, options, document.Project.Solution.Options, GetRoles(document)); 1326var service = GetCompletionService(document.Project);
Diagnostics\GenerateType\GenerateTypeTestState.cs (2)
67return (TestGenerateTypeOptionsService)InvocationDocument.Project.Solution.Services.GetRequiredService<IGenerateTypeOptionsService>(); 75return (TestProjectManagementService)InvocationDocument.Project.Solution.Services.GetService<IProjectManagementService>();
ExtractInterface\ExtractInterfaceTestState.cs (1)
73return (TestExtractInterfaceOptionsService)ExtractFromDocument.Project.Solution.Services.GetService<IExtractInterfaceOptionsService>();
Formatting\AbstractNewDocumentFormattingServiceTests.cs (1)
31var languageServices = document.Project.Services;
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (50)
CodeFixes\CodeFixServiceTests.cs (9)
406extensionManager = (EditorLayerExtensionManager.ExtensionManager)document.Project.Solution.Services.GetRequiredService<IExtensionManager>(); 892var solution = await codeAction.GetChangedSolutionInternalAsync(txtDocument.Project.Solution, CodeAnalysisProgress.None); 950return document.Project.Solution.WithAdditionalDocumentText(document.Id, newText); 1050await diagnosticIncrementalAnalyzer.ForceAnalyzeProjectAsync(sourceDocument.Project, CancellationToken.None); 1070var appliedChanges = workspace.TryApplyChanges(sourceDocument.Project.Solution); 1081sourceDocument.Project.Solution, sourceDocument.Project.Id, sourceDocument.Id, diagnosticIds: null, shouldIncludeAnalyzer: null, getDocuments: null, 1145var cachedDiagnostics = await diagnosticIncrementalAnalyzer.GetCachedDiagnosticsAsync(sourceDocument.Project.Solution, sourceDocument.Project.Id, sourceDocument.Id,
CodeGeneration\CodeGenerationTests.cs (1)
868this.Service = Document.Project.Services.GetService<ICodeGenerationService>();
CodeRefactorings\CodeRefactoringServiceTest.cs (7)
108var extensionManager = (EditorLayerExtensionManager.ExtensionManager)document.Project.Solution.Services.GetRequiredService<IExtensionManager>(); 167.AddAdditionalDocument("test.txt", "", filePath: "test.txt").Project 168.AddAdditionalDocument("test.log", "", filePath: "test.log").Project; 206.AddAnalyzerConfigDocument(".editorconfig", SourceText.From(""), filePath: "c:\\.editorconfig").Project 207.AddAnalyzerConfigDocument(".globalconfig", SourceText.From("is_global = true"), filePath: "c:\\.globalconfig").Project; 248return document.Project.Solution.WithAdditionalDocumentText(document.Id, newText); 249return document.Project.Solution.WithAnalyzerConfigDocumentText(document.Id, newText);
Diagnostics\DiagnosticAnalyzerServiceTests.cs (7)
173project = project.AddAnalyzerConfigDocument(".editorconfig", filePath: "z:\\.editorconfig", text: SourceText.From(editorconfigText)).Project; 177var applied = workspace.TryApplyChanges(document.Project.Solution); 192var diagnostics = await analyzer.ForceAnalyzeProjectAsync(document.Project, CancellationToken.None); 230var diagnostics = await analyzer.ForceAnalyzeProjectAsync(document.Project, CancellationToken.None); 362filePath: "z:\\.editorconfig").Project; 441project = project.AddAdditionalDocument(name: "dummy2.txt", text: "Additional File2 Text", filePath: "dummy2.txt").Project; 741project = project.AddAdditionalDocument("additional.txt", additionalText).Project;
Diagnostics\DiagnosticDataTests.cs (14)
122projectId: document.Project.Id, 126language: document.Project.Language); 141.Project.AddAdditionalDocument("AdditionalDocument.txt", "First line in file", filePath: "AdditionalDocument.txt"); 142var document = additionalDocument.Project.Documents.Single(); 155projectId: document.Project.Id, 160language: document.Project.Language); 162var diagnostic = await diagnosticData.ToDiagnosticAsync(document.Project, CancellationToken.None); 228secondDocument = firstDocument.Project.Solution.AddProject("TestProject2", "TestProject2", LanguageNames.CSharp) 233secondDocument = firstDocument.Project.AddDocument("test2.cs", "class C2 { }", filePath: "test2.cs"); 236firstDocument = secondDocument.Project.Solution.GetRequiredDocument(firstDocument.Id); 249projectId: firstDocument.Project.Id, 254language: firstDocument.Project.Language); 256var diagnostic = await diagnosticData.ToDiagnosticAsync(firstDocument.Project, CancellationToken.None); 260firstDocument = firstDocument.Project.Solution
LinkedFiles\LinkedFileDiffMergingEditorTests.cs (3)
103var linkedDocument = document.Project.Solution.Projects.Single(p => p != document.Project).Documents.Single(); 107var newSolution = document.Project.Solution
MetadataAsSource\AbstractMetadataAsSourceTests.cs (2)
87metadataProject = newDoc.Project; 111var generatedCompilation = await generatedDocument.Project.GetCompilationAsync();
MetadataAsSource\MetadataAsSourceTests.cs (2)
1916Assert.Equal("mscorlib", openedDocument.Project.AssemblyName); 1917Assert.Equal("mscorlib", openedDocument.Project.Name);
Preview\PreviewWorkspaceTests.cs (3)
74.AddDocument("document", "").Project.Solution; 80var changedSolution = previewWorkspace.CurrentSolution.Projects.First().Documents.First().WithText(SourceText.From(text)).Project.Solution; 102Assert.True(previewWorkspace.TryApplyChanges(document.Project.Solution));
TextEditor\OpenDocumentTests.cs (2)
64Assert.Same(workspace.CurrentSolution, newDocumentWithChanges.Project.Solution); 70Assert.NotSame(workspace.CurrentSolution, originalDocumentWithChanges.Project.Solution);
Microsoft.CodeAnalysis.EditorFeatures.Wpf (14)
InlineDiagnostics\AbstractDiagnosticsTaggerProvider.SingleDiagnosticKindPullTaggerProvider.cs (1)
106var project = document.Project;
InlineHints\InlineHintsTagger.cs (1)
125var colorHints = _taggerProvider.EditorOptionsService.GlobalOptions.GetOption(InlineHintsViewOptionsStorage.ColorHints, document.Project.Language);
LineSeparators\LineSeparatorTaggerProvider.cs (1)
83if (!GlobalOptions.GetOption(LineSeparatorsOptionsStorage.LineSeparator, document.Project.Language))
NavigableSymbols\NavigableSymbolService.NavigableSymbolSource.cs (1)
49var indicatorFactory = document.Project.Solution.Services.GetRequiredService<IBackgroundWorkIndicatorFactory>();
Peek\PeekableItemSource.cs (3)
75var services = document.Project.Solution.Services; 87navigableItems, document.Project, _peekResultFactory, cancellationToken).ConfigureAwait(false)) 113mappingResult ??= new SymbolMappingResult(document.Project, symbol);
QuickInfo\ContentControlService.cs (1)
70var workspace = new PreviewWorkspace(document.Project.Solution);
QuickInfo\Extensions.cs (2)
36var contentTypeService = document.Project.Services.GetService<IContentTypeLanguageService>(); 39var cloneServices = document.Project.Solution.Services.ExportProvider.GetExports<ITextBufferCloneService>();
SignatureHelp\Controller.cs (1)
134_providers = document.Project.Solution.Services.SelectMatchingExtensionValues(
StringIndentation\StringIndentationTaggerProvider.cs (1)
78if (!GlobalOptions.GetOption(StringIndentationOptionsStorage.StringIdentation, document.Project.Language))
Suggestions\SuggestedActionsSource_Async.cs (1)
211var workspace = document.Project.Solution.Workspace;
Suggestions\SuggestedActionWithNestedFlavors.cs (1)
52originalDocument.Project.Solution,
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (7)
CodeFixes\CodeFixServiceTests.vb (2)
226Contract.ThrowIfFalse(context.Document.Project.Language = LanguageNames.CSharp) 251Contract.ThrowIfFalse(context.Document.Project.Language = LanguageNames.CSharp)
Diagnostics\AbstractCrossLanguageUserDiagnosticTest.vb (1)
119Utilities.AssertEx.TokensAreEqual(expected, actual, updatedDocument.Project.Language)
Diagnostics\AdditionalFileDiagnosticsTests.vb (1)
113Dim project = context.Document.Project
FindReferences\FindReferencesTests.vb (2)
388Function(g) GetFilePathAndProjectLabel(document.Project.Solution, g.Key), 479Return $"{document.Project.Name}: {document.FilePath}"
KeywordHighlighting\AbstractKeywordHighlightingTests.vb (1)
28globalOptions.SetGlobalOption(KeywordHighlightingOptionsStorage.KeywordHighlighting, document.Project.Language, optionIsEnabled)
Microsoft.CodeAnalysis.ExternalAccess.AspNetCore (1)
Internal\EmbeddedLanguages\AspNetCoreEmbeddedLanguageDocumentHighlighter.cs (1)
37var highlighters = AspNetCoreDocumentHighlighterExtensionProvider.GetExtensions(document.Project);
Microsoft.CodeAnalysis.ExternalAccess.FSharp (8)
Internal\Diagnostics\FSharpDocumentDiagnosticAnalyzer.cs (2)
75var analyzer = document.Project.Services.GetService<FSharpDocumentDiagnosticAnalyzerService>(); 86var analyzer = document.Project.Services.GetService<FSharpDocumentDiagnosticAnalyzerService>();
Internal\Diagnostics\FSharpSimplifyNameDiagnosticAnalyzer.cs (1)
59var analyzer = document.Project.Services.GetService<FSharpSimplifyNameDiagnosticAnalyzerService>();
Internal\Diagnostics\FSharpUnusedDeclarationsAnalyzer.cs (1)
61var analyzer = document.Project.Services.GetService<FSharpUnusedDeclarationsDiagnosticAnalyzerService>();
Internal\Diagnostics\FSharpUnusedOpensDiagnosticAnalyzer.cs (1)
54var analyzer = document.Project.Services.GetService<FSharpUnusedOpensDiagnosticAnalyzerService>();
Internal\Editor\FSharpNavigationBarItemService.cs (1)
69var workspace = document.Project.Solution.Workspace;
Internal\Editor\FSharpSmartIndentProvider.cs (2)
88var indentStyle = _provider._globalOptions.GetOption(IndentationOptionsStorage.SmartIndent, document.Project.Language); 95result = _provider._service.GetDesiredIndentation(document.Project.LanguageServices, text, document.Id, document.FilePath, line.LineNumber, fsharpOptions);
Microsoft.CodeAnalysis.ExternalAccess.OmniSharp (6)
Completion\OmniSharpCompletionService.cs (4)
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);
Formatting\OmniSharpSyntaxFormattingOptionsWrapper.cs (1)
37optionsWithFallback.GetSyntaxFormattingOptions(document.Project.Services));
GoToDefinition\OmniSharpFindDefinitionService.cs (1)
25document.Project.Solution,
Microsoft.CodeAnalysis.ExternalAccess.Razor (25)
Cohost\Handlers\CodeActions.cs (2)
25var solution = document.Project.Solution; 46var solution = document.Project.Solution;
Cohost\Handlers\Completion.cs (3)
41var globalOptions = document.Project.Solution.Services.ExportProvider.GetService<IGlobalOptionService>(); 63var globalOptions = document.Project.Solution.Services.ExportProvider.GetService<IGlobalOptionService>(); 79var xmlSnippetParser = document.Project.Solution.Services.ExportProvider.GetService<XmlSnippetParser>();
Cohost\Handlers\Diagnostics.cs (3)
20var globalOptionsService = document.Project.Solution.Services.ExportProvider.GetService<IGlobalOptionService>(); 21var diagnosticAnalyzerService = document.Project.Solution.Services.ExportProvider.GetService<IDiagnosticAnalyzerService>(); 25var project = document.Project;
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 (2)
20document.Project.Solution.Services, document.Project, semanticModel, textSpan, options.UnderlyingObject, cancellationToken);
RazorCSharpFormattingInteractionService.cs (2)
41Contract.ThrowIfFalse(document.Project.Language is LanguageNames.CSharp); 50var formattingOptions = GetFormattingOptions(document.Project.Solution.Services, indentationOptions);
RazorSpanMappingServiceWrapper.cs (1)
36var diffService = newDocument.Project.Solution.Services.GetRequiredService<IDocumentTextDifferencingService>();
Microsoft.CodeAnalysis.ExternalAccess.Xaml (2)
External\ConversionHelpers.cs (1)
28var language = document.Project.Language;
Internal\XamlDiagnosticSourceProvider.cs (1)
31document.Project.GetAdditionalDocument(document.Id) != null)
Microsoft.CodeAnalysis.Features (366)
AddConstructorParametersFromMembers\AddConstructorParametersFromMembersCodeRefactoringProvider.AddConstructorParametersCodeAction.cs (3)
50var services = _document.Project.Solution.Services; 66var constructorDocument = _document.Project.GetDocument(syntaxTree); 69return Task.FromResult<Solution?>(constructorDocument.WithSyntaxRoot(newRoot).Project.Solution);
AddConstructorParametersFromMembers\AddConstructorParametersFromMembersCodeRefactoringProvider.cs (1)
186priorDocument.Project.Solution, CodeAnalysisProgress.None, postProcessChanges: true, cancellationToken).ConfigureAwait(false);
AddConstructorParametersFromMembers\AddConstructorParametersFromMembersCodeRefactoringProvider.State.cs (1)
104var compilation = await document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false);
AddDebuggerDisplay\AbstractAddDebuggerDisplayCodeRefactoringProvider.cs (1)
118var editor = new SyntaxEditor(syntaxRoot, document.Project.Solution.Services);
AddImport\AbstractAddImportCodeFixProvider.cs (2)
59var services = document.Project.Solution.Services; 67var packageSources = installerService?.IsEnabled(document.Project.Id) == true
AddImport\AbstractAddImportFeatureService.cs (5)
69var client = await RemoteHostClient.TryGetClientAsync(document.Project, cancellationToken).ConfigureAwait(false); 73document.Project.Solution, 144var project = document.Project; 542var client = await RemoteHostClient.TryGetClientAsync(document.Project, cancellationToken).ConfigureAwait(false); 546document.Project.Solution,
AddImport\AddImportOptions.cs (1)
34return configOptions.GetAddImportOptions(document.Project.Services, searchOptions, document.AllowImportsInHiddenRegions());
AddImport\CodeActions\AssemblyReferenceCodeAction.cs (1)
41var newProject = newDocument.Project;
AddImport\CodeActions\InstallPackageAndAddImportCodeAction.cs (2)
59this.OriginalDocument.Project.Solution, cancellationToken).ConfigureAwait(false)); 75return updatedDocument.Project.Solution;
AddImport\CodeActions\ProjectSymbolReferenceCodeAction.cs (2)
38=> fixData.ProjectReferenceToAdd != null && fixData.ProjectReferenceToAdd != originalDocument.Project.Id; 52return Task.FromResult<CodeActionOperation?>(new AddProjectReferenceCodeActionOperation(OriginalDocument.Project.Id, FixData.ProjectReferenceToAdd, applyOperation));
AddImport\CodeActions\SymbolReference.SymbolReferenceCodeAction.cs (2)
57var updatedProject = await UpdateProjectAsync(updatedDocument.Project, isPreview, cancellationToken).ConfigureAwait(false); 58return updatedProject ?? new ApplyChangesOperation(updatedDocument.Project.Solution);
AddImport\References\ProjectSymbolReference.cs (4)
36return document.Project.Id == _project.Id 51=> document.Project.Id != _project.Id; 60if (document.Project.Id == _project.Id) 92var project = document.Project;
AddImport\SymbolReferenceFinder.cs (1)
96=> DoAsync(new AllSymbolsProjectSearchScope(_owner, _document.Project, exact), cancellationToken);
AddImport\SymbolReferenceFinder_PackageAssemblySearch.cs (1)
134var project = _document.Project;
AddMissingReference\AbstractAddMissingReferenceCodeFixProvider.cs (2)
51context.Document.Project, identity, context.CancellationToken).ConfigureAwait(false); 61var compilation = await context.Document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false);
AddPackage\AbstractAddPackageCodeFixProvider.cs (2)
34var workspaceServices = document.Project.Solution.Services; 38!installerService.IsEnabled(document.Project.Id))
AddPackage\InstallPackageDirectlyCodeActionOperation.cs (1)
52_document.Project.Solution, packageName, versionOpt).ToList();
BraceMatching\AbstractEmbeddedLanguageBraceMatcher.cs (1)
46var result = braceMatcher.Value.FindBraces(document.Project, semanticModel, token, position, options, cancellationToken);
BraceMatching\BraceMatchingService.cs (1)
34var matchers = _braceMatchers.Where(b => b.Metadata.Language == document.Project.Language);
ChangeSignature\AbstractChangeSignatureService.cs (2)
110symbol = SymbolFinder.FindSourceDefinition(symbol, document.Project.Solution, cancellationToken) ?? symbol; 161var solution = document.Project.Solution;
CodeFixes\Configuration\ConfigurationUpdater.cs (2)
270var solution = editorConfigDocument.Project.Solution; 314currentSolution = addedAnalyzerConfigDocument.Project.Solution;
CodeFixes\Configuration\ConfigureCodeStyle\ConfigureCodeStyleOptionCodeFixProvider.cs (1)
57=> Task.FromResult(GetConfigurations(document.Project, diagnostics));
CodeFixes\Configuration\ConfigureSeverity\ConfigureSeverityLevelCodeFixProvider.cs (1)
48=> Task.FromResult(GetConfigurations(document.Project, diagnostics, cancellationToken));
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.AbstractGlobalSuppressMessageCodeAction.cs (1)
37new ApplyChangesOperation(changedSuppressionDocument.Project.Solution),
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.cs (1)
168document, document.Project, diagnostics, suppressionTargetInfo, skipSuppressMessage, skipUnsuppress, cancellationToken).ConfigureAwait(false);
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.GlobalSuppressMessageFixAllCodeAction.cs (2)
73var currentSolution = triggerDocument.Project.Solution; 74foreach (var grouping in diagnosticsByDocument.GroupBy(d => d.Key.Project))
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaWarningCodeAction.cs (1)
87=> Formatter.Format(node, _document.Project.Solution.Services, _options, cancellationToken);
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction_Attribute.cs (1)
72return editor.GetChangedDocument().Project.Solution;
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction_Pragma.cs (1)
221=> Formatter.Format(node, _document.Project.Solution.Services, _options, cancellationToken);
CodeFixes\Suppression\WrapperCodeFixProvider.cs (1)
35var suppressionFixes = await SuppressionFixProvider.GetFixesAsync(context.Document.Project, projectDiagnostics, context.CancellationToken).ConfigureAwait(false);
CodeLens\CodeLensReferencesService.cs (1)
256return !string.IsNullOrEmpty(fullName) ? new ReferenceMethodDescriptor(fullName, document.FilePath, document.Project.OutputFilePath) : null;
CodeRefactorings\AddMissingImports\AbstractAddMissingImportsFeatureService.cs (8)
62var solution = document.Project.Solution; 77var usableFixes = unambiguousFixes.WhereAsArray(fixData => DoesNotAddReference(fixData, document.Project.Id)); 100var solution = document.Project.Solution; 127var newProject = document.Project; 174var services = document.Project.Solution.Services; 224document.Project.Solution, progressTracker, cancellationToken).ConfigureAwait(false); 228newSolution = document.Project.Solution; 244var projectChanges = newDocument.Project.GetChanges(document.Project);
CodeRefactorings\CodeRefactoringService.cs (3)
66if (LanguageToProvidersMap.TryGetValue(document.Project.Language, out var lazyProviders)) 76if (document.Project.Solution.WorkspaceKind == WorkspaceKind.Interactive) 213var extensionManager = textDocument.Project.Solution.Services.GetRequiredService<IExtensionManager>();
CodeRefactorings\MoveType\AbstractMoveTypeService.cs (2)
58return document.Project.Solution; 71return modifiedSolution ?? document.Project.Solution;
CodeRefactorings\MoveType\AbstractMoveTypeService.MoveTypeEditor.cs (3)
64var solutionWithNewDocument = documentWithMovedType.Project.Solution; 118var projectToBeUpdated = document.Project; 248return updatedDocument.Project.Solution;
CodeRefactorings\MoveType\AbstractMoveTypeService.MoveTypeNamespaceScopeEditor.cs (1)
86return changedDocument.Project.Solution;
CodeRefactorings\SyncNamespace\AbstractChangeNamespaceService.cs (5)
134var solution = document.Project.Solution; 194var solution = document.Project.Solution; 347var solution = document.Project.Solution; 553symbol, document.Project.Solution, progress, documents: null, 840var compilation = await document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false);
CodeRefactorings\SyncNamespace\AbstractSyncNamespaceCodeRefactoringProvider.MoveFileCodeAction.cs (3)
40var solution = _state.Document.Project.Solution; 41var newDocumentId = DocumentId.CreateNewId(document.Project.Id, document.Name); 67var projectRootFolder = FolderInfo.CreateFolderHierarchyForProject(document.Project);
CodeRefactorings\SyncNamespace\AbstractSyncNamespaceCodeRefactoringProvider.State.cs (2)
157var projectRoot = PathUtilities.GetDirectoryName(document.Project.FilePath); 171var solution = document.Project.Solution;
Common\AbstractProjectExtensionProvider.cs (1)
82var extensions = GetExtensions(document.Project);
Completion\CommonCompletionProvider.cs (1)
79var snippetService = document.Project.Services.GetService<ISnippetInfoService>();
Completion\CompletionOptions.cs (1)
79var solution = document.Project.Solution;
Completion\CompletionProvider.cs (2)
58=> ShouldTriggerCompletion(document.Project.Services, await document.GetValueTextAsync(cancellationToken).ConfigureAwait(false), caretPosition, trigger, options, document.Project.Solution.Options);
Completion\CompletionService.cs (4)
211var provider = GetProvider(item, document.Project); 215var extensionManager = document.Project.Solution.Services.GetRequiredService<IExtensionManager>(); 244var provider = GetProvider(item, document.Project); 247var extensionManager = document.Project.Solution.Services.GetRequiredService<IExtensionManager>();
Completion\CompletionService_GetCompletions.cs (7)
48var passThroughOptions = options ?? document.Project.Solution.Options; 78var providers = _providerManager.GetFilteredProviders(document.Project, roles, trigger, options); 137if (ShouldTriggerCompletion(document.Project, document.Project.Services, text, caretPosition, trigger, options, passThroughOptions, roles)) 139var triggeredProviders = providers.Where(p => p.ShouldTriggerCompletion(document.Project.Services, text, caretPosition, trigger, options, passThroughOptions)).ToImmutableArrayOrEmpty(); 155var extensionManager = document.Project.Solution.Services.GetRequiredService<IExtensionManager>(); 329var extensionManager = document.Project.Solution.Services.GetRequiredService<IExtensionManager>();
Completion\Providers\AbstractAggregateEmbeddedLanguageCompletionProvider.cs (1)
92foreach (var language in GetLanguageProviders(context.Document.Project.Services))
Completion\Providers\AbstractInternalsVisibleToCompletionProvider.cs (4)
135var currentProject = context.Document.Project; 137foreach (var project in context.Document.Project.Solution.Projects) 179var project = completionContext.Document.Project; 272var project = document.Project.Solution.GetRequiredProject(projectId);
Completion\Providers\AbstractMemberInsertingCompletionProvider.cs (1)
159document.Project.Solution,
Completion\Providers\AbstractPreprocessorCompletionProvider.cs (1)
22var solution = originatingDocument.Project.Solution;
Completion\Providers\AbstractRecommendationServiceBasedCompletionProvider.cs (2)
218var relatedDocumentIds = document.Project.Solution.GetRelatedDocumentIds(document.Id); 233var relatedDocument = document.Project.Solution.GetRequiredDocument(documentId);
Completion\Providers\AbstractSymbolCompletionProvider.cs (2)
214supportedPlatformData = new SupportedPlatformData(completionContext.Document.Project.Solution, invalidProjects, totalProjects); 360var solution = document.Project.Solution;
Completion\Providers\ImportCompletionProvider\AbstractExtensionMethodImportCompletionProvider.cs (1)
32_ = ExtensionMethodImportCompletionHelper.WarmUpCacheAsync(document.Project, CancellationToken.None);
Completion\Providers\ImportCompletionProvider\AbstractImportCompletionProvider.cs (1)
216document.Project.Solution.Services.GetRequiredService<IDocumentSupportsFeatureService>().SupportsRefactorings(document);
Completion\Providers\ImportCompletionProvider\AbstractTypeImportCompletionProvider.cs (1)
30typeImportCompletionService.QueueCacheWarmUpTask(document.Project);
Completion\Providers\ImportCompletionProvider\ExtensionMethodImportCompletionHelper.cs (2)
60var project = document.Project; 125var compilation = await document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false);
Completion\Providers\ImportCompletionProvider\ExtensionMethodImportCompletionHelper.SymbolComputer.cs (8)
57_cacheService = GetCacheService(document.Project); 92source: GetAllRelevantPeReferences(_originatingDocument.Project), 99source: GetAllRelevantProjects(_originatingDocument.Project), 137GetCacheService(_originatingDocument.Project).WorkQueue.AddWork(_originatingDocument.Project); 179var compilation = project == _originatingDocument.Project 188if (project == _originatingDocument.Project) 208_originatingDocument.Project.Solution, peReference, checksum: null, cancellationToken).ConfigureAwait(false);
Completion\Providers\ImportCompletionProvider\ImportCompletionItem.cs (2)
139var compilation = await document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false); 147document.Project.Solution.Services,
Completion\Providers\ImportCompletionProvider\ImportCompletionProviderHelpers.cs (1)
39var compilation = await document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false);
Completion\Providers\Scripting\AbstractDirectivePathCompletionProvider.cs (1)
167if (document.Project.CompilationOptions?.MetadataReferenceResolver is RuntimeMetadataReferenceResolver resolver)
Completion\Providers\Scripting\AbstractReferenceDirectiveCompletionProvider.cs (1)
51var resolver = context.Document.Project.CompilationOptions.MetadataReferenceResolver as RuntimeMetadataReferenceResolver;
Completion\Providers\SymbolCompletionItem.cs (7)
139var compilation = await document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false); 150var linkedDoc = document.Project.Solution.GetRequiredDocument(id); 201var supportedPlatforms = GetSupportedPlatforms(item, document.Project.Solution); 205var services = document.Project.Solution.Services; 216return document.Project.Solution.GetRequiredDocument(contextId); 361var supportedPlatforms = GetSupportedPlatforms(item, document.Project.Solution); 365return await CommonCompletionUtilities.CreateDescriptionAsync(document.Project.Solution.Services, semanticModel, position, symbols, options, supportedPlatforms, cancellationToken).ConfigureAwait(false);
ConvertAutoPropertyToFullProperty\AbstractConvertAutoPropertyToFullPropertyCodeRefactoringProvider.cs (1)
81var editor = new SyntaxEditor(root, document.Project.Solution.Services);
ConvertForEachToFor\AbstractConvertForEachToForCodeRefactoringProvider.cs (1)
419var services = document.Project.Solution.Services;
ConvertLinq\ConvertForEachToLinqQuery\AbstractConvertForEachToLinqQueryProvider.cs (1)
151var editor = new SyntaxEditor(converter.ForEachInfo.SemanticModel.SyntaxTree.GetRoot(cancellationToken), document.Project.Solution.Services);
ConvertTupleToStruct\AbstractConvertTupleToStructCodeRefactoringProvider.cs (7)
193var hostServices = document.Project.Solution.Services 194.GetLanguageServices(document.Project.Language).HostLanguageServices; 223var solution = document.Project.Solution; 428document.Project, tupleType, cancellationToken).ConfigureAwait(false), 430document.Project, tupleType, cancellationToken).ConfigureAwait(false), 524var solution = startingDocument.Project.Solution; 586var currentSolution = startingDocument.Project.Solution;
DesignerAttribute\DesignerAttributeDiscoveryService.cs (2)
396if (RemoteSupportedLanguages.IsSupported(activeDocument?.Project.Language)) 401activeDocument.Project,
DocumentHighlighting\AbstractDocumentHighlightsService.cs (8)
39var solution = document.Project.Solution; 41var client = await RemoteHostClient.TryGetClientAsync(document.Project, cancellationToken).ConfigureAwait(false); 47document.Project, 73var solution = document.Project.Solution; 126symbol, document.Project.Solution, progress, 166var solution = startingDocument.Project.Solution; 184if (currentDocument.Project.Language == startingDocument.Project.Language)
DocumentSpanExtensions.cs (1)
16var solution = documentSpan.Document.Project.Solution;
EditAndContinue\CommittedSolution.cs (3)
209if (committedDocument == null && !solution.ContainsProject(document.Project.Id)) 474var compilationOutputs = _debuggingSession.GetCompilationOutputs(document.Project); 475using var debugInfoReaderProvider = GetMethodDebugInfoReader(compilationOutputs, document.Project.Name);
EditAndContinue\DebuggingSession.cs (3)
419var project = document.Project; 788if (_isDisposed || !EditSession.InBreakState || !mappedDocument.State.SupportsEditAndContinue() || !mappedDocument.Project.SupportsEditAndContinue()) 795var newProject = mappedDocument.Project;
EditAndContinue\EditAndContinueDocumentAnalysesCache.cs (3)
79var oldProject = oldDocument?.Project ?? oldSolution.GetRequiredProject(newDocument.Project.Id); 131var analyzer = newDocument.Project.Services.GetRequiredService<IEditAndContinueAnalyzer>();
EditAndContinue\Remote\RemoteDebuggingSessionProxy.cs (2)
177if (!RemoteSupportedLanguages.IsSupported(document.Project.Language)) 189document.Project.Solution,
EmbeddedLanguages\Classification\AbstractEmbeddedLanguageClassificationService.cs (1)
41var project = document.Project;
EncapsulateField\AbstractEncapsulateFieldService.cs (7)
117var solution = document.Project.Solution; 145var currentSolution = document.Project.Solution; 181var solution = document.Project.Solution; 221document, document.Project.Solution, field, generatedProperty, cancellationToken).ConfigureAwait(false); 226return documentWithProperty.Project.Solution; 235var projectId = document.Project.Id; 252var compilation = await document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false);
ExternalAccess\UnitTesting\SolutionCrawler\AbstractUnitTestingDocumentDifferenceService.cs (1)
21var syntaxFactsService = newDocument.Project.Services.GetService<ISyntaxFactsService>();
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.cs (3)
472await EnqueueDocumentWorkItemAsync(newDocument.Project, newDocument.Id, newDocument, UnitTestingInvocationReasons.DocumentChanged).ConfigureAwait(false); 479await EnqueueDocumentWorkItemAsync(newDocument.Project, newDocument.Id, newDocument, differenceResult.ChangeType, differenceResult.ChangedMember).ConfigureAwait(false); 584pool.Object.Add(document.Project.Language);
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingSemanticChangeProcessor.cs (2)
139EnqueueFullProjectDependency(document.Project, assembly); 176var solution = thisDocument.Project.Solution;
ExternalAccess\VSTypeScript\VSTypeScriptDocumentDiagnosticAnalyzer.cs (2)
20var analyzer = document.Project.Services.GetRequiredService<VSTypeScriptDiagnosticAnalyzerLanguageService>().Implementation; 31var analyzer = document.Project.Services.GetRequiredService<VSTypeScriptDiagnosticAnalyzerLanguageService>().Implementation;
ExternalAccess\VSTypeScript\VSTypeScriptNavigateToSearchService.cs (1)
65foreach (var group in priorityDocuments.GroupBy(d => d.Project))
ExtractClass\AbstractExtractClassRefactoringProvider.cs (1)
31var solution = context.Document.Project.Solution;
ExtractInterface\AbstractExtractInterfaceService.cs (6)
140var solution = refactoringResult.DocumentToExtractFrom.Project.Solution; 154var containingNamespaceDisplay = GetContainingNamespaceDisplay(refactoringResult.TypeToExtractFrom, refactoringResult.DocumentToExtractFrom.Project.CompilationOptions!); 190refactoringResult.DocumentToExtractFrom.Project.Id, 268var notificationService = document.Project.Solution.Services.GetRequiredService<INotificationService>(); 271var service = document.Project.Solution.Services.GetRequiredService<IExtractInterfaceOptionsService>(); 280document.Project.Language,
ExtractMethod\MethodExtractor.CodeGenerator.cs (1)
151document.Project.ParseOptions);
ExtractMethod\MethodExtractor.cs (2)
134if (!codeGenService.CanAddTo(destination, document.Project.Solution, cancellationToken)) 161var services = document.Project.Solution.Services;
FindUsages\AbstractFindUsagesService.ProgressAdapter.cs (1)
38var options = await classificationOptions.GetOptionsAsync(document.Project.Services, cancellationToken).ConfigureAwait(false);
FindUsages\AbstractFindUsagesService_FindReferences.cs (2)
31document.Project.Solution, definitionTrackingContext.GetDefinitions(), cancellationToken).ConfigureAwait(false); 222var solution = document.Project.Solution;
FindUsages\DefinitionItemFactory.cs (1)
302var options = await optionsProvider.GetOptionsAsync(document.Project.Services, cancellationToken).ConfigureAwait(false);
FindUsages\FindUsagesHelpers.cs (1)
43var mappingService = document.Project.Solution.Services.GetService<ISymbolMappingService>();
FullyQualify\AbstractFullyQualifyService.cs (3)
43var client = await RemoteHostClient.TryGetClientAsync(document.Project, cancellationToken).ConfigureAwait(false); 47document.Project, 63var project = document.Project;
GenerateComparisonOperators\GenerateComparisonOperatorsCodeRefactoringProvider.cs (1)
152document.Project.Solution,
GenerateConstructors\AbstractGenerateConstructorsCodeRefactoringProvider.cs (1)
112priorDocument.Project.Solution, codeAction, progressTracker, cancellationToken).ConfigureAwait(false);
GenerateEqualsAndGetHashCodeFromMembers\AbstractGenerateEqualsAndGetHashCodeService.cs (3)
42var compilation = await document.Project.GetCompilationAsync(cancellationToken).ConfigureAwait(false); 64var compilation = await document.Project.GetCompilationAsync(cancellationToken).ConfigureAwait(false); 121var compilation = await document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false);
GenerateEqualsAndGetHashCodeFromMembers\GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider.cs (2)
268var value = globalOptions.GetGenerateEqualsAndGetHashCodeFromMembersImplementIEquatable(document.Project.Language); 282var value = globalOptions.GetGenerateEqualsAndGetHashCodeFromMembersGenerateOperators(document.Project.Language);
GenerateOverrides\GenerateOverridesWithDialogCodeAction.cs (2)
40var services = _document.Project.Solution.Services; 74_document.Project.Solution,
GenerateType\AbstractGenerateTypeService.CodeAction.cs (4)
102var generateTypeOptionsService = _document.Project.Solution.Services.GetRequiredService<IGenerateTypeOptionsService>(); 103var notificationService = _document.Project.Solution.Services.GetService<INotificationService>(); 104var projectManagementService = _document.Project.Solution.Services.GetService<IProjectManagementService>(); 107var isPublicOnlyAccessibility = IsPublicOnlyAccessibility(_state, _document.Project);
GenerateType\AbstractGenerateTypeService.Editor.cs (1)
312if (newDocument.Project.Language == _semanticDocument.Document.Project.Language)
GoToDefinition\AbstractGoToDefinitionSymbolService.cs (2)
25var project = document.Project; 26var services = document.Project.Solution.Services;
InheritanceMargin\AbstractInheritanceMarginService.cs (1)
36var solution = document.Project.Solution;
InheritanceMargin\AbstractInheritanceMarginService_Helpers.cs (9)
55project = document.Project; 88var mappingService = document.Project.Solution.Services.GetRequiredService<ISymbolMappingService>(); 122return (document.Project, SymbolAndLineNumberArray.Empty); 137var remapped = remappedProject != document.Project; 215var projectState = document.Project.State; 217var languageGlyph = document.Project.Language switch 221_ => throw ExceptionUtilities.UnexpectedValue(document.Project.Language), 247var destinationDocument = document.Project.Solution.GetDocument(groupSyntaxTree); 565? definition.SourceSpans[0].Document.Project.State
InitializeParameter\AbstractAddParameterCheckCodeRefactoringProvider.cs (2)
362var editor = new SyntaxEditor(root, document.Project.Solution.Services); 517var compilation = await document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false);
InitializeParameter\AbstractInitializeMemberFromParameterCodeRefactoringProviderMemberCreation.cs (6)
377var currentSolution = document.WithSyntaxRoot(trackedRoot).Project.Solution; 435var solutionWithAssignmentAdded = documentWithMemberAdded.Project.Solution; 448var compilation = await finalSolution.GetRequiredProject(documentWithMemberAdded.Project.Id).GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false); 480var services = document.Project.Solution.Services; 526var compilation = await documentWithMemberAdded.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false); 621var compilation = await document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false);
InlineMethod\AbstractInlineMethodRefactoringProvider.cs (1)
337var 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)
38local, document.Project.Solution, options, cancellationToken).ConfigureAwait(false);
IntroduceParameter\AbstractIntroduceParameterCodeRefactoringProvider.cs (5)
241var modifiedSolution = originalDocument.Project.Solution; 246source: methodCallSites.GroupBy(kvp => kvp.Key.Project), 276methodSymbol, document.Project.Solution, progress, 295if (refLocation.Document.Project.Language == document.Project.Language)
InvertConditional\AbstractInvertConditionalCodeRefactoringProvider.cs (1)
49var editor = new SyntaxEditor(root, document.Project.Solution.Services);
MetadataAsSource\AbstractMetadataAsSourceService.cs (1)
35document.Project.Solution,
MetadataAsSource\MetadataAsSourceHelpers.cs (1)
74await generatedDocument.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false),
MetadataAsSource\SymbolMappingServiceFactory.cs (1)
34if (document.Project.Solution.WorkspaceKind is not WorkspaceKind.MetadataAsSource)
MoveToNamespace\AbstractMoveToNamespaceService.cs (2)
211var originalSolution = document.Project.Solution; 292var compilation = await document.Project.GetCompilationAsync(cancellationToken).ConfigureAwait(false);
NameTupleElement\AbstractNameTupleElementCodeRefactoringProvider.cs (1)
43if (document.Project.Solution.WorkspaceKind == WorkspaceKind.MiscellaneousFiles)
NavigateTo\AbstractNavigateToSearchService.CachedDocumentSearch.cs (1)
74Debug.Assert(priorityDocuments.All(d => projects.Contains(d.Project)));
NavigateTo\AbstractNavigateToSearchService.InProcess.cs (1)
58var linkedDocument = document.Project.Solution.GetRequiredDocument(linkedDocumentId);
NavigateTo\AbstractNavigateToSearchService.NormalSearch.cs (6)
27var solution = document.Project.Solution; 30var client = await RemoteHostClient.TryGetClientAsync(document.Project, cancellationToken).ConfigureAwait(false); 36document.Project, 82Debug.Assert(priorityDocuments.All(d => projects.Contains(d.Project))); 123using var _ = GetPooledHashSet(priorityDocuments.Select(d => d.Project), out var highPriProjects); 138using var _1 = GetPooledHashSet(priorityDocuments.Where(d => project == d.Project), out var highPriDocs);
NavigateTo\NavigateToSearcher.cs (9)
188var project = _activeDocument.Project; 205var activeProject = _activeDocument.Project; 293processedProjects.Add(_activeDocument.Project); 294result.Add([_activeDocument.Project]); 301if (processedProjects.Add(doc.Project)) 302buffer.Add(doc.Project); 332if (_activeDocument?.Project != null && projectsSet.Contains(_activeDocument.Project)) 337if (projectsSet.Contains(doc.Project))
NavigateTo\RoslynNavigateToItem.cs (2)
143var firstProject = itemDocument.Project; 172return itemDocument.Project.Name;
Navigation\INavigableItem.cs (2)
55NavigableProject.FromProject(document.Project), 61document.Project.Solution.TryGetWorkspace());
NavigationBar\AbstractNavigationBarItemService.cs (2)
23var client = await RemoteHostClient.TryGetClientAsync(document.Project, cancellationToken).ConfigureAwait(false); 30document.Project,
PullMemberUp\MembersPuller.cs (4)
95var solution = document.Project.Solution; 97var codeGenerationService = document.Project.Services.GetRequiredService<ICodeGenerationService>(); 270var solution = document.Project.Solution; 272var codeGenerationService = document.Project.Services.GetRequiredService<ICodeGenerationService>();
RelatedDocuments\AbstractRelatedDocumentsService.cs (3)
42var project = document.Project; 51document.Project, 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 (3)
175semanticModel, triggerToken.SpanStart, document.Project.Solution.Services, cancellationToken: cancellationToken).ConfigureAwait(false); 221var solution = document.Project.Solution; 231if (document.Project.IsSubmission)
ReplaceMethodWithProperty\ReplaceMethodWithPropertyCodeRefactoringProvider.cs (3)
161var project = document.Project; 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\SemanticSearchUtilities.cs (1)
79=> GetQueryDocumentId(document.Project.Solution) == document.Id;
Shared\Extensions\DocumentExtensions.cs (2)
66values = await getItemsWorker(document.Project.Solution.GetRequiredDocument(linkedDocumentId)).ConfigureAwait(false); 83var solution = document.Project.Solution;
Shared\Utilities\ExtractTypeHelpers.cs (1)
127return Formatter.Format(syntaxGenerator.SyntaxGeneratorInternal.TypeParameterList(typeParameterNames), document.Project.Solution.Services, formattingOptions, cancellationToken).ToString();
SignatureHelp\AbstractSignatureHelpProvider.cs (4)
257var totalProjects = relatedDocuments.Select(d => d.Project.Id).Concat(document.Project.Id); 288invalidProjectsForCurrentSymbol.Add(relatedDocument.Project.Id); 292var platformData = new SupportedPlatformData(document.Project.Solution, invalidProjectsForCurrentSymbol, totalProjects);
SignatureHelp\SignatureHelpService.cs (2)
49GetProviders(document.Project.Language), 67var extensionManager = document.Project.Solution.Services.GetRequiredService<IExtensionManager>();
Snippets\AbstractSnippetService.cs (1)
42EnsureSnippetsLoaded(context.Document.Project.Language);
Snippets\SnippetProviders\AbstractConsoleSnippetProvider.cs (1)
81var compilation = await document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false);
SolutionCrawler\AbstractDocumentDifferenceService.cs (1)
22var syntaxFactsService = newDocument.Project.Services.GetService<ISyntaxFactsService>();
SpellCheck\AbstractSpellCheckCodeFixProvider.cs (1)
128var passThroughOptions = document.Project.Solution.Options;
src\Analyzers\Core\CodeFixes\AddObsoleteAttribute\AbstractAddObsoleteAttributeCodeFixProvider.cs (1)
60var compilation = await document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false);
src\Analyzers\Core\CodeFixes\AddParameter\AddParameterService.cs (2)
90var solution = invocationDocument.Project.Solution; 219method, invocationDocument.Project.Solution, cancellationToken).ConfigureAwait(false);
src\Analyzers\Core\CodeFixes\AnalyzerOptionsProviders.cs (2)
17var analyzerOptions = document.Project.AnalyzerOptions; 20return new AnalyzerOptionsProvider(configOptions, document.Project.Language);
src\Analyzers\Core\CodeFixes\ConvertToAsync\AbstractConvertToAsyncCodeFixProvider.cs (1)
72var otherDocument = document.Project.Solution.GetDocument(syntaxTree);
src\Analyzers\Core\CodeFixes\FileHeaders\AbstractFileHeaderCodeFixProvider.cs (1)
65!document.Project.AnalyzerOptions.AnalyzerConfigOptionsProvider.GetOptions(tree).TryGetEditorConfigOption(CodeStyleOptions2.FileHeaderTemplate, out fileHeaderTemplate))
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.State.cs (2)
454document.Project.Solution, 500document.Project.Solution,
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\GenerateDefaultConstructorsCodeAction.cs (1)
42_document.Project.Solution,
src\Analyzers\Core\CodeFixes\GenerateEnumMember\AbstractGenerateEnumMemberService.CodeAction.cs (2)
26var languageServices = _document.Project.Solution.Workspace.Services.GetExtendedLanguageServices(_state.TypeToGenerateIn.Language); 36_document.Project.Solution,
src\Analyzers\Core\CodeFixes\GenerateMember\AbstractGenerateMemberCodeFixProvider.cs (1)
34if (context.Document.Project.IsSubmission)
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.CodeAction.cs (3)
67var syntaxFactory = _document.Project.Solution.Services.GetLanguageServices(_state.TypeToGenerateIn.Language).GetService<SyntaxGenerator>(); 75_document.Project.Solution, 91_document.Project.Solution,
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.cs (1)
57var semanticFacts = document.Project.Solution.Workspace.Services.GetExtendedLanguageServices(state.TypeToGenerateIn.Language).GetService<ISemanticFactsService>();
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.cs (2)
47var canGenerateMember = CodeGenerator.CanAdd(document.Project.Solution, state.TypeToGenerateIn, cancellationToken); 208var compilation = await document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false);
src\Analyzers\Core\CodeFixes\ImplementAbstractClass\ImplementAbstractClassData.cs (1)
60if (!CodeGenerator.CanAdd(document.Project.Solution, classType, cancellationToken))
src\Analyzers\Core\CodeFixes\ImplementInterface\AbstractImplementInterfaceCodeFixProvider.cs (2)
128var compilation = await document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false); 130var supportsImplicitImplementationOfNonPublicInterfaceMembers = syntaxFacts.SupportsImplicitImplementationOfNonPublicInterfaceMembers(document.Project.ParseOptions!);
src\Analyzers\Core\CodeFixes\ImplementInterface\AbstractImplementInterfaceService.cs (2)
110var supportsImplementingLessAccessibleMember = syntaxFacts.SupportsImplicitImplementationOfNonPublicInterfaceMembers(document.Project.ParseOptions!); 116generateInvisibly: generator.ShouldGenerateInvisibleMember(document.Project.ParseOptions!, interfaceMember, interfaceMember.Name, supportsImplementingLessAccessibleMember),
src\Analyzers\Core\CodeFixes\ImplementInterface\AbstractImplementInterfaceService.State.cs (1)
55if (!CodeGenerator.CanAdd(document.Project.Solution, classOrStructType, cancellationToken))
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator.cs (2)
81var compilation = await this.Document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false); 96this.Document.Project.Solution,
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator_DisposePattern.cs (2)
50var compilation = await document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false); 243var compilation = await document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false);
src\Analyzers\Core\CodeFixes\ImplementType\ImplementTypeOptions.cs (1)
80return configOptions.GetImplementTypeOptions(document.Project.Language);
src\Analyzers\Core\CodeFixes\MakeMethodAsynchronous\AbstractMakeMethodAsynchronousCodeFixProvider.cs (2)
164var solution = document.Project.Solution; 198return newDocument.Project.Solution;
src\Analyzers\Core\CodeFixes\MakeMethodSynchronous\AbstractMakeMethodSynchronousCodeFixProvider.cs (4)
77var solution = document.Project.Solution; 99var compilation = await document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false); 110var newSolution = newDocument.Project.Solution; 151return document.Project.Solution;
src\Analyzers\Core\CodeFixes\MatchFolderAndNamespace\AbstractChangeNamespaceToMatchFolderCodeFixProvider.cs (4)
27var service = context.Document.Project.Solution.Services.GetRequiredService<ISupportedChangesService>(); 54var targetFolders = PathMetadataUtilities.BuildFoldersFromNamespace(targetNamespace, document.Project.DefaultNamespace); 63var newSolution = await renameActionSet.UpdateSolutionAsync(documentWithInvalidFolders.Project.Solution, cancellationToken).ConfigureAwait(false); 64Debug.Assert(newSolution != document.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 (2)
33var compilation = await document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false); 67var solutionServices = document.Project.Solution.Services;
src\Analyzers\Core\CodeFixes\RemoveUnusedParametersAndValues\AbstractRemoveUnusedValuesCodeFixProvider.cs (2)
303var editor = new SyntaxEditor(root, document.Project.Solution.Services); 924var referencedSymbols = await SymbolFinder.FindReferencesAsync(local, document.Project.Solution, cancellationToken).ConfigureAwait(false);
src\Analyzers\Core\CodeFixes\UnsealClass\AbstractUnsealClassCodeFixProvider.cs (2)
43type, document.Project.Solution, cancellationToken); 50c => UnsealDeclarationsAsync(document.Project.Solution, definition.DeclaringSyntaxReferences, c),
src\Analyzers\Core\CodeFixes\UpgradeProject\AbstractUpgradeProjectCodeFixProvider.cs (1)
43var project = context.Document.Project;
src\Analyzers\Core\CodeFixes\UseConditionalExpression\AbstractUseConditionalExpressionCodeFixProvider.cs (1)
56var nestedEditor = new SyntaxEditor(root, document.Project.Solution.Services);
SymbolMapping\SymbolMappingServiceFactory.cs (3)
26var compilation = await document.Project.GetCompilationAsync(cancellationToken).ConfigureAwait(false); 30return new SymbolMappingResult(document.Project, symbol); 37=> Task.FromResult(new SymbolMappingResult(document.Project, symbol));
SymbolSearch\SymbolSearchOptions.cs (1)
57return configOptions.GetSymbolSearchOptions(document.Project.Language);
SyncNamespaces\AbstractSyncNamespacesService.cs (1)
170var projectDiagnostics = await GetProjectDiagnosticsAsync(document.Project, cancellationToken).ConfigureAwait(false);
TaskList\AbstractTaskListService.cs (2)
33var client = await RemoteHostClient.TryGetClientAsync(document.Project, cancellationToken).ConfigureAwait(false); 37document.Project,
UseAutoProperty\AbstractUseAutoPropertyCodeFixProvider.cs (2)
66var solution = context.Document.Project.Solution; 362return Formatter.Format(newRoot, SpecializedFormattingAnnotation, document.Project.Solution.Services, options, formattingRules, cancellationToken);
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 (2)
33var client = await RemoteHostClient.TryGetClientAsync(document.Project, cancellationToken).ConfigureAwait(false); 36var solution = document.Project.Solution;
Workspace\CompileTimeSolutionProvider.cs (2)
188var designTimeProjectDirectoryName = PathUtilities.GetDirectoryName(designTimeDocument.Project.FilePath)!; 192var sourceGeneratedDocuments = await compileTimeSolution.GetRequiredProject(designTimeDocument.Project.Id).GetSourceGeneratedDocumentsAsync(cancellationToken).ConfigureAwait(false);
Microsoft.CodeAnalysis.Features.Test.Utilities (7)
Diagnostics\TestDiagnosticAnalyzerDriver.cs (2)
81=> GetDiagnosticsAsync(document.Project, document, filterSpan, getDocumentDiagnostics: true, getProjectDiagnostics: true); 99=> GetDiagnosticsAsync(document.Project, document, span, getDocumentDiagnostics: true, getProjectDiagnostics: false);
EditAndContinue\EditAndContinueTestVerifier.cs (1)
453oldProject = oldProject.AddDocument(name, oldRoot, filePath: oldPath).Project;
EditAndContinue\EditAndContinueWorkspaceTestBase.cs (2)
140solution = document.Project.Solution; 144return document.Project.Solution;
Snippets\AbstractSnippetProviderTests.cs (2)
44var editorConfigDoc = document.Project.AddAnalyzerConfigDocument(".editorconfig", SourceText.From(editorconfig), filePath: "/.editorconfig"); 45document = editorConfigDoc.Project.GetDocument(document.Id)!;
Microsoft.CodeAnalysis.Features.UnitTests (12)
EditAndContinue\ActiveStatementsMapTests.cs (3)
118.AddDocument("doc", SourceText.From(source, Encoding.UTF8), filePath: "a.cs").Project.Solution; 173.AddDocument("doc", SourceText.From(source, Encoding.UTF8), filePath: "a.cs").Project.Solution; 224.AddDocument("doc", SourceText.From(source, Encoding.UTF8), filePath: "a.cs").Project.Solution;
EditAndContinue\EditAndContinueWorkspaceServiceTests.cs (4)
236solution = document.Project.Solution; 447Assert.True(designTimeOnlyDocument2.Project.SupportsEditAndContinue()); 572var project = document1.Project; 888AssertEx.Equal([$"{document2.FilePath}: (5,0)-(5,32): Error ENC2016: {string.Format(FeaturesResources.EditAndContinueDisallowedByProject, document2.Project.Name, "*message*")}"], InspectDiagnostics(emitDiagnostics));
EditAndContinue\EmitSolutionUpdateResultsTests.cs (5)
75var solution = document.Project.Solution; 89document.Project.Id, 105document.Project.Id, 122document.Project.Id, 129var rudeEdits = ImmutableArray.Create(new ProjectDiagnostics(document.Project.Id,
Microsoft.CodeAnalysis.LanguageServer (4)
Testing\RunTestsHandler.cs (4)
123var workingDirectory = Path.GetDirectoryName(document.Project.FilePath); 124Contract.ThrowIfNull(workingDirectory, $"Unable to get working directory for project {document.Project.Name}"); 126var projectFileName = Path.GetFileName(document.Project.FilePath); 127Contract.ThrowIfNull(projectFileName, $"Unable to get project file name for project {document.Project.Name}");
Microsoft.CodeAnalysis.LanguageServer.Protocol (117)
Extensions\Extensions.cs (6)
53Contract.ThrowIfNull(document.Project.FilePath); 55var projectDirectoryName = Path.GetDirectoryName(document.Project.FilePath); 153return FindItemInProjectContext(documents, documentIdentifier, projectIdGetter: (item) => item.Project.Id, defaultGetter: () => 158var solution = documents.First().Project.Solution; 222switch (document.Project.Language) 233throw new ArgumentException(string.Format("Document project language {0} is not valid", document.Project.Language));
Extensions\ProtocolConversions.cs (1)
861=> GetDocumentationMarkupContent(tags, document.Project.Language, featureSupportsMarkdown);
ExternalAccess\Razor\FormatNewFileHandler.cs (1)
67var project = document.Project;
ExternalAccess\Razor\SimplifyMethodHandler.cs (1)
68var simplificationService = originalDocument.Project.Services.GetRequiredService<ISimplificationService>();
Features\CodeCleanup\AbstractCodeCleanupService.cs (3)
188var fixAllService = document.Project.Solution.Services.GetRequiredService<IFixAllGetFixesService>(); 250var solutionChanges = updatedDocument.Project.Solution.GetChanges(currentDocument.Project.Solution);
Features\CodeFixes\CodeFixService.cs (17)
225if (document.Project.Solution.WorkspaceKind != WorkspaceKind.Interactive && includeSuppressionFixes) 347var fixAllService = document.Project.Solution.Services.GetRequiredService<IFixAllGetFixesService>(); 360var workspaceFixersMap = GetFixerPerLanguageMap(document.Project.Solution.Services); 364if (!_lazyWorkspaceFixersMap.TryGetValue(document.Project.Language, out var lazyFixerMap)) 386var fixersPriorityByLanguageMap = GetFixerPriorityPerLanguageMap(document.Project.Solution.Services); 390return _lazyFixerPriorityMap.TryGetValue(document.Project.Language, out fixersPriorityMap); 453var isInteractive = document.Project.Solution.WorkspaceKind == WorkspaceKind.Interactive; 496var extensionManager = document.Project.Solution.Services.GetService<IExtensionManager>(); 530m[TelemetryLogging.KeyLanguageName] = document.Project.Language; 645fixes.Add(new CodeFix(document.Project, action, applicableDiagnostics)); 706if (!_configurationProvidersMap.TryGetValue(document.Project.Language, out var lazyConfigurationProviders) || 747.ToDiagnosticsAsync(textDocument.Project, cancellationToken).ConfigureAwait(false); 755var extensionManager = textDocument.Project.Solution.Services.GetRequiredService<IExtensionManager>(); 785document.Project, 960return document.Project.Solution.WorkspaceKind == WorkspaceKind.Interactive 962: _projectFixersMap.GetValue(document.Project.AnalyzerReferences, _ => ComputeProjectFixers(document)); 967var extensionManager = document.Project.Solution.Services.GetService<IExtensionManager>();
Features\CodeFixes\CodeFixService.FixAllDiagnosticProvider.cs (3)
46var solution = document.Project.Solution; 49return await diagnostics.ToDiagnosticsAsync(document.Project, cancellationToken).ConfigureAwait(false); 59return await diagnostics.ToDiagnosticsAsync(document.Project, cancellationToken).ConfigureAwait(false);
Features\Diagnostics\DiagnosticAnalyzerService.cs (1)
90var analyzer = CreateIncrementalAnalyzer(document.Project.Solution.Workspace);
Features\Diagnostics\DocumentAnalysisExecutor.cs (5)
102var generatorDiagnostics = await GetSourceGeneratorDiagnosticsAsync(textDocument.Project, cancellationToken).ConfigureAwait(false); 139var isEnabled = await textDocument.Project.HasSuccessfullyLoadedAsync(cancellationToken).ConfigureAwait(false); 172var diags = await diagnostics.ToDiagnosticsAsync(textDocument.Project, cancellationToken).ConfigureAwait(false); 401var diagnosticSpanMappingService = textDocument.Project.Solution.Services.GetService<IWorkspaceVenusSpanMappingService>(); 411var diagnostic = await diagnosticData.ToDiagnosticAsync(textDocument.Project, cancellationToken).ConfigureAwait(false);
Features\Diagnostics\DocumentAnalysisExecutor_Helpers.cs (3)
266await VerifyDiagnosticLocationsAsync(diagnostics, document.Project, cancellationToken).ConfigureAwait(false); 424return targetTextDocument.Project.GetDocument(diagnostic.Location.SourceTree) == targetTextDocument; 430var documentIds = targetTextDocument.Project.Solution.GetDocumentIdsWithFilePath(lineSpan.Path);
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.ProjectState.cs (8)
122Contract.ThrowIfFalse(lastResult.ProjectId == document.Project.Id); 129var version = await GetDiagnosticVersionAsync(document.Project, cancellationToken).ConfigureAwait(false); 143var builder = new Builder(document.Project, lastResult.Version); 260var project = document.Project; 330var project = document.Project; 360Contract.ThrowIfFalse(document == null || document.Project == project); 369var project = document.Project; 420Contract.ThrowIfFalse(document == null || document.Project == project);
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.StateSet.cs (3)
107if (!TryGetProjectState(document.Project.Id, out var projectState) || 136var projectState = GetOrCreateProjectState(document.Project.Id); 152if (TryGetProjectState(document.Project.Id, out var projectState))
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs (5)
89.GetOrCreateStateSetsAsync(document.Project, cancellationToken) 92.Where(s => DocumentAnalysisExecutor.IsAnalyzerEnabledForProject(s.Analyzer, document.Project, owner.GlobalOptions)) 102var compilationWithAnalyzers = await GetOrCreateCompilationWithAnalyzersAsync(document.Project, stateSets, includeSuppressedDiagnostics, owner.AnalyzerService.CrashOnAnalyzerException, cancellationToken).ConfigureAwait(false); 333var version = await GetDiagnosticVersionAsync(_document.Project, cancellationToken).ConfigureAwait(false); 384var version = await GetDiagnosticVersionAsync(_document.Project, cancellationToken).ConfigureAwait(false);
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer_IncrementalAnalyzer.cs (1)
65var stateSets = _stateManager.GetStateSets(document.Project);
Features\EditAndContinue\EditAndContinueDiagnosticSource_OpenDocument.cs (1)
27var designTimeSolution = designTimeDocument.Project.Solution;
Features\Options\IndentationOptionsStorage.cs (2)
20AutoFormattingOptions = globalOptions.GetAutoFormattingOptions(document.Project.Language), 21IndentStyle = globalOptions.GetOption(SmartIndent, document.Project.Language)
Features\UnifiedSuggestions\UnifiedSuggestedActionsSource.cs (3)
43var originalSolution = document.Project.Solution; 511var originalSolution = document.Project.Solution; 600var originalSolution = document.Project.Solution;
Handler\Breakpoints\ValidateBreakableRangeHandler.cs (1)
37var breakpointService = document.Project.Services.GetRequiredService<IBreakpointResolutionService>();
Handler\CodeActions\CodeActionFixAllResolveHandler.cs (1)
61var operations = await fixAllCodeAction.GetOperationsAsync(document.Project.Solution, CodeAnalysisProgress.None, cancellationToken).ConfigureAwait(false);
Handler\CodeActions\CodeActionHelpers.cs (2)
393document.Project.Solution.Workspace, codeFixService, document, textSpan, 398document.Project.Solution.Workspace, codeRefactoringService, document, textSpan, priority: null,
Handler\CodeActions\CodeActionResolveHandler.cs (1)
77var solution = document.Project.Solution;
Handler\CodeActions\CodeActionResolveHelper.cs (1)
233else if (newTextDoc.Project.FilePath != null)
Handler\CodeLens\CodeLensHandler.cs (2)
48var referencesCodeLensEnabled = _globalOptionService.GetOption(LspOptionsStorage.LspEnableReferencesCodeLens, document.Project.Language); 49var testsCodeLensEnabled = _globalOptionService.GetOption(LspOptionsStorage.LspEnableTestsCodeLens, document.Project.Language);
Handler\CodeLens\CodeLensResolveHandler.cs (2)
67var codeLensReferencesService = document.Project.Solution.Services.GetRequiredService<ICodeLensReferencesService>(); 68var referenceCount = await codeLensReferencesService.GetReferenceCountAsync(document.Project.Solution, document.Id, memberToResolve.Node, maxSearchResults: 99, cancellationToken).ConfigureAwait(false);
Handler\Completion\CompletionHandler.cs (3)
80var completionOptions = globalOptions.GetCompletionOptionsForLsp(document.Project.Language, capabilityHelper); 89var project = document.Project; 176var completionList = await completionService.GetCompletionsAsync(document, position, completionOptions, document.Project.Solution.Options, completionTrigger, cancellationToken: cancellationToken).ConfigureAwait(false);
Handler\Completion\CompletionResolveHandler.cs (3)
100var completionOptions = globalOptions.GetCompletionOptions(document.Project.Language); 101var symbolDescriptionOptions = globalOptions.GetSymbolDescriptionOptions(document.Project.Language); 102var completionService = document.Project.Services.GetRequiredService<CompletionService>();
Handler\Definitions\AbstractGoToDefinitionHandler.cs (3)
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); 86var declarationFile = await metadataAsSourceFileService.GetGeneratedFileAsync(workspace, document.Project, symbol, signaturesOnly: false, options: options, cancellationToken: cancellationToken).ConfigureAwait(false);
Handler\Diagnostics\Public\PublicDocumentNonLocalDiagnosticSourceProvider.cs (1)
36globalOptions.GetBackgroundAnalysisScope(textDocument.Project.Language) == BackgroundAnalysisScope.FullSolution)
Handler\FoldingRanges\FoldingRangesHandler.cs (1)
53var options = globalOptions.GetBlockStructureOptions(document.Project) with
Handler\Formatting\AbstractFormatDocumentHandlerBase.cs (1)
42var services = document.Project.Solution.Services;
Handler\Formatting\FormatDocumentOnTypeHandler.cs (2)
54var formattingService = document.Project.Services.GetRequiredService<ISyntaxFormattingService>(); 66AutoFormattingOptions = _globalOptions.GetAutoFormattingOptions(document.Project.Language)
Handler\Highlights\DocumentHighlightHandler.cs (1)
93var options = globalOptions.GetHighlightingOptions(document.Project.Language);
Handler\Hover\HoverHandler.cs (2)
80var options = globalOptions.GetSymbolDescriptionOptions(document.Project.Language); 141var language = document.Project.Language;
Handler\InlayHint\InlayHintHandler.cs (1)
45var options = _optionsService.GetInlineHintsOptions(document.Project.Language);
Handler\InlayHint\InlayHintResolveHandler.cs (1)
36var options = globalOptions.GetInlineHintsOptions(document.Project.Language);
Handler\InlineCompletions\InlineCompletionsHandler.cs (3)
121var snippetInfoService = document.Project.GetRequiredLanguageService<ISnippetInfoService>(); 130var syntaxFactsService = document.Project.GetRequiredLanguageService<ISyntaxFactsService>(); 193var formattingChanges = Formatter.GetFormattedTextChanges(root, spanToFormat, originalDocument.Project.Solution.Services, formattingOptions, cancellationToken: cancellationToken)
Handler\InlineCompletions\XmlSnippetParser.ParsedXmlSnippet.cs (1)
46var snippetFunctionService = documentWithSnippet.Project.GetRequiredLanguageService<SnippetFunctionService>();
Handler\OnAutoInsert\OnAutoInsertHandler.cs (5)
53var onAutoInsertEnabled = _globalOptions.GetOption(LspOptionsStorage.LspEnableAutoInsert, document.Project.Language); 57var servicesForDocument = _braceCompletionServices.Where(s => s.Metadata.Language == document.Project.Language).SelectAsArray(s => s.Value); 81var docCommentOptions = globalOptions.GetDocumentationCommentOptions(formattingOptions.LineFormatting, document.Project.Language); 99AutoFormattingOptions = globalOptions.GetAutoFormattingOptions(document.Project.Language) 244var fallbackOptions = document.Project.GetFallbackAnalyzerOptions();
Handler\References\FindUsagesLSPContext.cs (2)
265_workspace, _document.Project, symbol, signaturesOnly: true, options: options, cancellationToken: cancellationToken).ConfigureAwait(false); 300var options = _globalOptions.GetClassificationOptions(document.Project.Language);
Handler\Rename\RenameHandler.cs (1)
36var oldSolution = document.Project.Solution;
Handler\SemanticTokens\SemanticTokensHelpers.cs (1)
40var project = contextDocument.Project;
Handler\SourceGenerators\SourceGeneratedDocumentCache.cs (4)
23var executionVersion = state.Document.Project.Solution.GetSourceGeneratorExecutionVersion(state.Document.Project.Id); 24var dependentVersion = await state.Document.Project.GetDependentVersionAsync(cancellationToken).ConfigureAwait(false); 45var unfrozenDocument = await state.Document.Project.Solution.WithoutFrozenSourceGeneratedDocuments().GetDocumentAsync(state.Document.Id, includeSourceGenerated: true, cancellationToken).ConfigureAwait(false);
Handler\SourceGenerators\SourceGeneratedDocumentGetTextHandler.cs (1)
62var newResult = await cache.GetOrComputeNewDataAsync(previousPullResults, projectOrDocument, document.Project, new SourceGeneratedDocumentGetTextState(document), cancellationToken).ConfigureAwait(false);
Handler\SpellCheck\AbstractSpellCheckingHandler.cs (1)
106document.Project,
Handler\SpellCheck\SpellCheckPullCache.cs (1)
23var project = state.Document.Project;
Handler\Symbols\DocumentSymbolsHandler.cs (1)
55var navBarService = document.Project.Services.GetRequiredService<INavigationBarItemService>();
Workspaces\LspWorkspaceManager.cs (3)
291var workspaceKind = document.Project.Solution.WorkspaceKind; 304return (workspace, document.Project.Solution, document); 514_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 (10)
Diagnostics\PullDiagnosticTests.cs (3)
513Id = ProtocolConversions.ProjectIdToProjectContextId(document.Project.Id), 514Label = document.Project.Name 1292language: (project ?? document!.Project).Language);
Miscellaneous\LspMiscellaneousFilesWorkspaceTests.cs (2)
242Assert.Equal(LanguageNames.CSharp, miscDoc.Project.Language); 286Assert.Equal(LanguageNames.CSharp, miscDoc.Project.Language);
UriTests.cs (1)
342return Task.FromResult(new ResolvedDocumentInfo(context.Workspace!.Kind!, context.GetRequiredDocument().Project.Language));
Workspaces\LspWorkspaceManagerTests.cs (4)
709Assert.Same(testLspServer.TestWorkspace.CurrentSolution, sourceGeneratedDocument.Project.Solution); 726Assert.NotSame(testLspServer.TestWorkspace.CurrentSolution, sourceGeneratedDocument.Project.Solution); 742Assert.Same(testLspServer.TestWorkspace.CurrentSolution, sourceGeneratedDocument.Project.Solution); 750Assert.NotSame(testLspServer.TestWorkspace.CurrentSolution, sourceGeneratedDocument.Project.Solution);
Microsoft.CodeAnalysis.Remote.ServiceHub (8)
Host\RemoteWorkspace.SolutionCreator.cs (6)
562TextDocumentKind.Document => document.Project.Solution.WithDocumentTextLoader(document.Id, loader, mode).GetRequiredDocument(document.Id), 563TextDocumentKind.AnalyzerConfigDocument => document.Project.Solution.WithAnalyzerConfigDocumentTextLoader(document.Id, loader, mode).GetRequiredAnalyzerConfigDocument(document.Id), 564TextDocumentKind.AdditionalDocument => document.Project.Solution.WithAdditionalDocumentTextLoader(document.Id, loader, mode).GetRequiredAdditionalDocument(document.Id), 569return document.Project; 588document = document.Project.Solution.WithDocumentFolders(document.Id, newDocumentInfo.Folders).GetDocument(document.Id)!; 595document = document.Project.Solution.WithDocumentSourceCodeKind(document.Id, newDocumentInfo.SourceCodeKind).GetDocument(document.Id)!;
Services\SemanticClassification\RemoteSemanticClassificationService.Caching.cs (1)
125var solution = document.Project.Solution;
Services\SemanticClassification\RemoteSemanticClassificationService.cs (1)
39solution = document.Project.Solution;
Microsoft.CodeAnalysis.TestAnalyzerReference (2)
NonSourceFileRefactoring.cs (2)
30return document.Project.Solution.WithAdditionalDocumentText(document.Id, newText); 31return document.Project.Solution.WithAnalyzerConfigDocumentText(document.Id, newText);
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (3)
src\Analyzers\VisualBasic\CodeFixes\RemoveUnnecessaryCast\VisualBasicRemoveUnnecessaryCastCodeFixProvider.vb (2)
102Dim innerEditor = New SyntaxEditor(root, document.Project.Solution.Services) 136Dim editor = New SyntaxEditor(root, document.Project.Solution.Services)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\InitializeParameter\VisualBasicInitializeParameterService.vb (1)
55Return Task.FromResult(document.Project.Solution)
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures (13)
EndConstructGeneration\EndConstructCommandHandler.vb (2)
161Dim options = buffer.GetCodeCleanupOptions(_editorOptionsService, document.Project.GetFallbackAnalyzerOptions(), document.Project.Services, explicitFormat:=False, allowImportsInHiddenRegions:=document.AllowImportsInHiddenRegions())
LineCommit\CommitBufferManager.vb (1)
307Dim project = document.Project
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 (8)
115Dim compilation = Await document.Project.GetCompilationAsync(cancellationToken).ConfigureAwait(False) 146document.Project.Solution, 159Dim compilation = Await document.Project.GetCompilationAsync(cancellationToken).ConfigureAwait(False) 201document.Project.Solution, 214Dim compilation = Await document.Project.GetCompilationAsync(cancellationToken).ConfigureAwait(False) 245document.Project.Solution, 258Dim compilation = Await document.Project.GetCompilationAsync(cancellationToken).ConfigureAwait(False) 272document.Project.Solution,
Microsoft.CodeAnalysis.VisualBasic.Features (27)
AddImport\VisualBasicAddImportFeatureService.vb (1)
297Dim compilation = Await document.Project.GetCompilationAsync(cancellationToken).ConfigureAwait(False)
ChangeSignature\VisualBasicChangeSignatureService.vb (3)
630Return GetPermutedDocCommentTrivia(node, permutedParamNodes, document.Project.Services, lineFormattingOption) 705convertedType = If(SymbolFinder.FindSourceDefinition(convertedType, document.Project.Solution, cancellationToken), convertedType) 724nodeType = If(SymbolFinder.FindSourceDefinition(nodeType, document.Project.Solution, cancellationToken), nodeType)
CodeFixes\GenerateEvent\GenerateEventCodeFixProvider.vb (13)
108Dim sourceDefinition = SymbolFinder.FindSourceDefinition(targetType, document.Project.Solution, cancellationToken) 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(SymbolFinder.FindSourceDefinition(semanticModel.GetSymbolInfo(node.Left, cancellationToken).Symbol, document.Project.Solution, cancellationToken), 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(SymbolFinder.FindSourceDefinition(withEventsProperty.Type, document.Project.Solution, cancellationToken), INamedTypeSymbol) 354targetType = TryCast(SymbolFinder.FindSourceDefinition(targetType, document.Project.Solution, cancellationToken), INamedTypeSymbol) 379Dim codeGenService = document.Project.Solution.Services.GetLanguageServices(originalTargetType.Language).GetService(Of ICodeGenerationService) 406document.Project.Solution, originalTargetType, generatedEvent, codeGenService)
CodeFixes\OverloadBase\OverloadBaseCodeFixProvider.AddKeywordAction.vb (1)
75Dim services = document.Project.Solution.Services
CodeRefactorings\InlineTemporary\VisualBasicInlineTemporaryCodeRefactoringProvider.vb (2)
33If document.Project.Solution.WorkspaceKind = WorkspaceKind.MiscellaneousFiles Then 185Return Simplifier.Expand(DirectCast(n, StatementSyntax), semanticModel, document.Project.Solution.Services, cancellationToken:=cancellationToken)
Completion\CompletionProviders\NamedParameterCompletionProvider.vb (1)
70Dim languageVersion = DirectCast(document.Project.ParseOptions, VisualBasicParseOptions).LanguageVersion
Debugging\LocationInfoGetter.vb (1)
33Dim compilation = Await document.Project.GetCompilationAsync(cancellationToken).ConfigureAwait(False)
NavigationBar\VisualBasicNavigationBarItemService.vb (1)
55document.Project.Solution, type, position, semanticModel, workspaceSupportsDocumentChanges, symbolDeclarationService, cancellationToken))
SignatureHelp\PredefinedCastExpressionSignatureHelpProvider.vb (1)
27Return SpecializedCollections.SingletonEnumerable(New PredefinedCastExpressionDocumentation(node.Keyword.Kind, Await document.Project.GetCompilationAsync(cancellationToken).ConfigureAwait(False)))
src\Analyzers\VisualBasic\CodeFixes\RemoveUnnecessaryCast\VisualBasicRemoveUnnecessaryCastCodeFixProvider.vb (2)
102Dim innerEditor = New SyntaxEditor(root, document.Project.Solution.Services) 136Dim editor = New SyntaxEditor(root, document.Project.Solution.Services)
UseAutoProperty\VisualBasicUseAutoPropertyCodeFixProvider.vb (1)
60Dim generator = SyntaxGenerator.GetGenerator(propertyDocument.Project)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (4)
CodeCleanup\Providers\NormalizeModifiersOrOperatorsCodeCleanupProvider.vb (1)
37Dim newRoot = Await CleanupAsync(root, spans, options.FormattingOptions, document.Project.Solution.Services, cancellationToken).ConfigureAwait(False)
CodeCleanup\Providers\RemoveUnnecessaryLineContinuationCodeCleanupProvider.vb (2)
34Dim parseOptions = TryCast(document.Project.ParseOptions, VisualBasicParseOptions) 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.VisualBasic.Workspaces.UnitTests (1)
CodeGeneration\AddImportsTests.vb (1)
47Dim doc = extensionAttributeDoc.Project.AddDocument("test.vb", code)
Microsoft.CodeAnalysis.Workspaces (137)
Classification\AbstractClassificationService.cs (5)
75var project = document.Project; 83var workspaceStatusService = document.Project.Solution.Services.GetRequiredService<IWorkspaceStatusService>(); 124document.Project, 191var extensionManager = document.Project.Solution.Services.GetRequiredService<IExtensionManager>(); 205AddSyntacticClassifications(document.Project.Solution.Services, root, textSpans, result, cancellationToken);
Classification\Classifier.cs (2)
35return GetClassifiedSpans(document.Project.Solution.Services, document.Project, semanticModel, textSpan, ClassificationOptions.Default, cancellationToken);
Classification\SemanticClassificationCacheUtilities.cs (1)
16var project = document.Project;
CodeActions\CodeAction.cs (2)
332return changedDocument?.Project.Solution; 354return changedDocument?.Project.Solution;
CodeActions\CodeAction_Cleanup.cs (1)
112document.Project.Solution,
CodeFixes\FixAllOccurrences\BatchFixAllProvider.cs (1)
95if (kvp.Key.Project != fixAllContext.Project)
CodeFixes\FixAllOccurrences\FixAllContext.cs (3)
162document.Project, 232if (this.Project.Language != document.Project.Language) 269if (this.Project.Language != document.Project.Language)
CodeFixes\FixAllOccurrences\FixAllState.cs (1)
77triggerDocument.Project,
CodeFixes\FixAllOccurrences\TextChangeMerger.cs (1)
36_differenceService = document.Project.Solution.Services.GetRequiredService<IDocumentTextDifferencingService>();
CodeFixesAndRefactorings\CommonFixAllState.cs (1)
34Debug.Assert(document == null || document.Project == project);
CodeRefactorings\FixAllOccurences\FixAllState.cs (1)
41: this(fixAllProvider, document ?? throw new ArgumentNullException(nameof(document)), document.Project, selectionSpan, codeRefactoringProvider,
CodeRefactorings\SyntaxEditorBasedCodeRefactoringProvider.cs (1)
71var editor = new SyntaxEditor(root, document.Project.Solution.Services);
Diagnostics\DiagnosticData.cs (6)
176var diagnosticSpanMappingService = document?.Project.Solution.Services.GetService<IWorkspaceVenusSpanMappingService>(); 196var project = document.Project; 250var service = document.Project.GetLanguageService<IDiagnosticPropertiesService>(); 266builder.AddIfNotNull(CreateLocation(document.Project.Solution.GetDocument(location.SourceTree), location)); 270var textDocumentId = document.Project.GetDocumentForExternalLocation(location); 271builder.AddIfNotNull(CreateLocation(document.Project.GetTextDocument(textDocumentId), location));
Diagnostics\DocumentAnalysisScope.cs (1)
59return TextDocument.Project.AnalyzerOptions.AdditionalFiles.First(a => PathUtilities.Comparer.Equals(a.Path, filePath));
Editing\DocumentEditor.cs (1)
19: base(root, document.Project.Solution.Services)
Editing\SymbolEditor.cs (2)
51return new SymbolEditor(document.Project.Solution); 294ChangedSolution = newDoc.Project.Solution;
Editing\SyntaxGenerator.cs (1)
72=> GetGenerator(document.Project);
FindSymbols\FindReferences\Finders\AbstractReferenceFinder.cs (1)
96if (document.Project == project)
FindSymbols\FindReferences\Finders\ConstructorInitializerSymbolReferenceFinder.cs (1)
43else if (document.Project.Language == LanguageNames.VisualBasic && index.ProbablyContainsIdentifier("New"))
FindSymbols\FindReferences\FindReferencesDocumentState.cs (1)
29public Solution Solution => this.Document.Project.Solution;
FindSymbols\FindReferences\FindReferencesSearchEngine_FindReferencesInDocuments.cs (2)
60var projectsToSearch = documents.Select(d => d.Project).Where(p => p.SupportsCompilation).ToImmutableHashSet(); 86if (document.Project != project)
FindSymbols\ReferenceLocationExtensions.cs (1)
21var projectGroups = documentGroups.GroupBy(g => g.Key.Project);
FindSymbols\Shared\AbstractSyntaxIndex_Persistence.cs (2)
147SolutionKey.ToSolutionKey(document.Project.Solution), 148document.Project.State,
FindSymbols\SymbolFinder.cs (1)
132return await FindSymbolAtPositionAsync(semanticModel, position, document.Project.Solution.Services, cancellationToken).ConfigureAwait(false);
FindSymbols\SyntaxTree\SyntaxTreeIndex.cs (6)
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 (6)
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 (6)
35=> GetDefaultFormattingRules(document.Project.Services); 95var services = document.Project.Solution.Services; 116var services = document.Project.Solution.Services; 133var services = document.Project.Solution.Services; 341lineFormattingOptions = optionSet.GetLineFormattingOptions(document.Project.Language); 370return optionSet.GetOrganizeImportsOptions(document.Project.Language);
LanguageServices\FixAllSpanMappingService\AbstractFixAllSpanMappingService.cs (1)
52var documentForLocation = document.Project.GetDocument(syntaxRef.SyntaxTree);
LinkedFileDiffMerging\LinkedFileDiffMergingSession.cs (1)
200oldDocument.Project.Name,
OrganizeImports\OrganizeImportsOptionsProviders.cs (1)
26return configOptions.GetOrganizeImportsOptions(document.Project.Language);
ReassignedVariable\AbstractReassignedVariableService.cs (1)
45var compilation = await document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false);
Recommendations\Recommender.cs (2)
31return languageRecommender.GetRecommendedSymbolsInContext(context, GetOptions(options, document.Project), cancellationToken).NamedSymbols; 54return languageRecommender.GetRecommendedSymbolsInContext(context, GetOptions(options, document.Project), cancellationToken).NamedSymbols;
Remote\RemoteArguments.cs (1)
56: Dehydrate(document.Project.Solution, alias, cancellationToken);
Rename\ConflictEngine\ConflictResolver.cs (2)
202foreach (var implicitReferenceLocationsPerLanguage in implicitReferenceLocations.GroupBy(loc => loc.Document.Project.Language)) 206var renameRewriterService = implicitReferenceLocationsPerLanguage.First().Document.Project.Services.GetRequiredService<IRenameRewriterLanguageService>();
Rename\ConflictEngine\ConflictResolver.Session.cs (3)
358var syntaxFactsService = newDocument.Project.Services.GetRequiredService<ISyntaxFactsService>(); 658var newReferencedSymbols = RenameUtilities.GetSymbolsTouchingPosition(tokenOrNode.Span.Start, newDocumentSemanticModel, newDocument.Project.Solution.Services, _cancellationToken); 717foreach (var language in documentsFromAffectedProjects.Select(d => d.Project.Language).Distinct())
Rename\ConflictEngine\RenamedSpansTracker.cs (1)
217solution = document.Project.Solution;
Rename\Renamer.cs (1)
76=> 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 (3)
48return solution ?? document.Project.Solution; 67if (document.Project.Language == LanguageNames.CSharp) 70var targetNamespace = PathMetadataUtilities.TryBuildNamespaceFromFolders(newFolders, syntaxFacts, document.Project.DefaultNamespace);
Rename\RenameUtilities.cs (1)
306var definitionSymbol = await FindDefinitionSymbolAsync(symbol, document.Project.Solution, cancellationToken).ConfigureAwait(false);
Rename\SymbolicRenameLocations.ReferenceProcessing.cs (1)
335foreach (var documentsGroupedByLanguage in RenameUtilities.GetDocumentsAffectedByRename(originalSymbol, solution, renameLocations).GroupBy(d => d.Project.Language))
Shared\Extensions\DocumentExtensions.cs (1)
26=> document.Project.Solution.WithOptions(options).GetRequiredDocument(document.Id);
Shared\Extensions\SyntaxGeneratorExtensions.cs (5)
53var compilation = await document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false); 59else if (overriddenProperty.IsIndexer() && document.Project.Language == LanguageNames.CSharp) 79if (document.Project.Language == LanguageNames.CSharp 80&& SymbolFinder.FindSourceDefinition(overriddenProperty, document.Project.Solution, cancellationToken) is { Language: LanguageNames.VisualBasic }) 242var compilation = await newDocument.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false);
Simplification\Simplifier.cs (4)
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\CodeCleanup\CodeCleanupOptionsProviders.cs (1)
30return configOptions.GetCodeCleanupOptions(document.Project.GetExtendedLanguageServices().LanguageServices, document.AllowImportsInHiddenRegions());
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\ForkingSyntaxEditorBasedCodeFixProvider.cs (1)
73var solutionServices = document.Project.Solution.Services;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\SyntaxEditorBasedCodeFixProvider.cs (1)
75var editor = new SyntaxEditor(root, document.Project.Solution.Services);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationOptionsProviders.cs (3)
38return configOptions.GetCodeGenerationOptions(document.Project.GetExtendedLanguageServices().LanguageServices); 43Contract.ThrowIfNull(document.Project.ParseOptions); 47return service.GetInfo(context, options, document.Project.ParseOptions);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (5)
33=> document?.Project?.GetLanguageService<TLanguageService>(); 36=> document.Project.GetRequiredLanguageService<TLanguageService>(); 98var workspace = document.Project.Solution.Workspace; 163var semanticModelService = document.Project.Solution.Services.GetRequiredService<ISemanticModelReuseWorkspaceService>(); 219var solution = document.Project.Solution;
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\Formatting\LineFormattingOptionsProviders.cs (1)
20return configOptions.GetLineFormattingOptions(document.Project.Language);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\GeneratedCodeRecognition\AbstractGeneratedCodeRecognitionService.cs (1)
34return syntaxTree.IsGeneratedCode(document.Project.AnalyzerOptions, syntaxFacts, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\InitializeParameter\AbstractInitializerParameterService.cs (4)
108return document.Project.Solution; 124var editor = new SyntaxEditor(root, document.Project.Solution.Services); 128return newDocument.Project.Solution; 131return document.Project.Solution;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.cs (1)
84var editor = new SyntaxEditor(root, document.Project.Solution.Services);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (1)
91var findReferencesResult = await SymbolFinder.FindReferencesAsync(LocalSymbol, document.Project.Solution, cancellationToken).ConfigureAwait(false);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\NamingStyles\NamingStylePreferencesProviders.cs (1)
18return configOptions.GetOption(NamingStyleOptions.NamingPreferences, document.Project.Language);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Options\MemberDisplayOptions.cs (1)
53return configOptions.GetMemberDisplayOptions(document.Project.Language);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (1)
199rewriter.Initialize(document.Project.ParseOptions, options, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\ParsedDocument.cs (2)
39return new ParsedDocument(document.Id, text, root, document.Project.GetExtendedLanguageServices()); 47return new ParsedDocument(document.Id, text, root, document.Project.GetExtendedLanguageServices());
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\SyntacticDocument.cs (1)
25public Project Project => Document.Project;
Workspace\Host\PersistentStorage\DocumentKey.cs (1)
34=> ToDocumentKey(ProjectKey.ToProjectKey(document.Project), document.State);
Workspace\Solution\Document.cs (19)
116var projectVersion = this.Project.Version; 133var projectVersion = this.Project.Version; 155return this.SupportsSyntaxTree && this.Project.SupportsCompilation; 333this.Project.Solution.OnSemanticModelObtained(this.Id, semanticModel); 352var compilation = await this.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false); 386=> this.Project.Solution.WithDocumentSourceCodeKind(this.Id, kind).GetRequiredDocument(Id); 392=> this.Project.Solution.WithDocumentText(this.Id, text, PreservationMode.PreserveIdentity).GetRequiredDocument(Id); 398=> this.Project.Solution.WithDocumentSyntaxRoot(this.Id, root, PreservationMode.PreserveIdentity).GetRequiredDocument(Id); 404=> this.Project.Solution.WithDocumentName(this.Id, name).GetRequiredDocument(Id); 410=> this.Project.Solution.WithDocumentFolders(this.Id, folders).GetRequiredDocument(Id); 416=> this.Project.Solution.WithDocumentFilePath(this.Id, filePath).GetRequiredDocument(Id); 505var filteredDocumentIds = this.Project.Solution.GetRelatedDocumentIds(this.Id); 535if (!forceFreeze && this.Project.TryGetCompilation(out _)) 538var solution = this.Project.Solution; 545this.Project.SupportsCompilation) 547var newSolution = this.Project.Solution.WithFrozenPartialCompilationIncludingSpecificDocument(this.Id, cancellationToken); 574InitializeCachedOptions(Project.Solution.Options); 586return new DocumentOptionSet(options, arg.solutionOptions, arg.self.Project.Language); 596var provider = (ProjectState.ProjectHostAnalyzerConfigOptionsProvider)Project.State.HostAnalyzerOptions.AnalyzerConfigOptionsProvider;
Workspace\Workspace_Editor.cs (2)
872newSolution = document.WithText(this.GetOpenDocumentText(oldSolution, docId)).Project.Solution; 890newSolution = document.WithText(this.GetOpenDocumentText(oldSolution, docId)).Project.Solution;
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (8)
VisualStudioMSBuildWorkspaceTests.cs (8)
344p1 = newDoc.Project; 404Assert.Equal(project.Version, document1.Project.Version); // updating doc should not have changed project version 405var latestDV1 = await document1.Project.GetLatestDocumentVersionAsync(); 415Assert.NotEqual(document1.Project.Version, document2.Project.Version); // project did change, so project versions should be different 416Assert.True(document2.Project.Version.GetTestAccessor().IsNewerThan(document1.Project.Version)); 2911var noEncodingSolution = noEncodingDoc.Project.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 (172)
Formatter\FormatterTests.cs (1)
78document = document.Project.Solution.WithOptions(solutionOptions).GetRequiredDocument(document.Id);
GeneratedCodeRecognitionTests.cs (2)
63"), filePath: @"z:\.editorconfig").Project; 69"), filePath: @"z:\.editorconfig").Project;
SolutionTests\ProjectSemanticVersionTests.cs (34)
24await AssertSemanticVersionChangedAsync(project, project.AddDocument("Hello.cs", "class C { }").Project); 32.AddDocument("Hello.cs", "class C { }").Project; 47document.Project, 48document.WithText(text.Replace(position, length: 0, "public async Task M() { }")).Project); 61document.Project, 62document.WithText(text.Replace(position, length: 0, "int x = 10;")).Project); 75document.Project, 76document.WithText(text.Replace(position, length: 0, "int x = 10")).Project); 89document.Project, 90document.WithText(text.Replace(position, length: 0, " \r\n")).Project); 103document.Project, 104document.WithText(text.Replace(position, length: 0, "public int X = 20;")).Project); 117document.Project, 118document.WithText(text.Replace(span, "100")).Project); 131document.Project, 132document.WithText(text.Replace(position, length: 0, "public const int X = 20;")).Project); 145document.Project, 146document.WithText(text.Replace(span, "100")).Project); 159document.Project, 160document.WithText(text.Replace(position, length: 0, "Public Sub M()\r\nEnd Sub")).Project); 173document.Project, 174document.WithText(text.Replace(position, length: 0, "Dim x As Integer = 10")).Project); 187document.Project, 188document.WithText(text.Replace(position, length: 0, "Optional x As Integer = 10")).Project); 201document.Project, 202document.WithText(text.Replace(position, length: 0, " \r\n")).Project); 215document.Project, 216document.WithText(text.Replace(position, length: 0, "Public X As Integer = 20")).Project); 229document.Project, 230document.WithText(text.Replace(span, "100")).Project); 243document.Project, 244document.WithText(text.Replace(position, length: 0, "Public Const X As Integer = 20")).Project); 257document.Project, 258document.WithText(text.Replace(span, "100")).Project);
SolutionTests\SolutionTests.cs (82)
1662var compilation = await document.Project.GetRequiredCompilationAsync(default); 2651Assert.NotSame(document1.Project, document2.Project); 2790.Project.Solution; 3694var doc2 = doc.Project.Solution.WithDocumentSyntaxRoot(doc.Id, newRoot, PreservationMode.PreserveValue).GetDocument(doc.Id); 3697var observed2 = GetObservedSyntaxTreeRootAsync(doc2.Project.Solution, did); 3924var compilation = await doc.Project.GetCompilationAsync(CancellationToken.None).ConfigureAwait(false); 4074project = project.AddDocument("Extra.cs", SourceText.From("class Extra { }")).Project; 4081var tree = Assert.Single((await frozenDocument.Project.GetCompilationAsync()).SyntaxTrees); 4086await documentToFreeze.Project.GetDependentSemanticVersionAsync(), 4087await frozenDocument.Project.GetDependentSemanticVersionAsync()); 4090await documentToFreeze.Project.GetSemanticVersionAsync(), 4091await frozenDocument.Project.GetSemanticVersionAsync()); 4099project = project.AddDocument("Extra.cs", SourceText.From("class Extra { }")).Project; 4106var tree = Assert.Single((await frozenDocument.Project.GetCompilationAsync()).SyntaxTrees); 4111await documentToFreeze.Project.GetDependentSemanticVersionAsync(), 4112await frozenDocument.Project.GetDependentSemanticVersionAsync()); 4115await documentToFreeze.Project.GetSemanticVersionAsync(), 4116await frozenDocument.Project.GetSemanticVersionAsync()); 4127project = project.AddDocument("Extra.cs", SourceText.From("class Extra { }")).Project; 4130project = documentToFreezeOriginal.Project; 4151await documentToFreezeOriginal.Project.GetDependentSemanticVersionAsync(), 4152await frozenDocument.Project.GetDependentSemanticVersionAsync()); 4155await documentToFreezeChanged.Project.GetDependentSemanticVersionAsync(), 4156await frozenDocument.Project.GetDependentSemanticVersionAsync()); 4159await documentToFreezeOriginal.Project.GetSemanticVersionAsync(), 4160await frozenDocument.Project.GetSemanticVersionAsync()); 4163await documentToFreezeChanged.Project.GetSemanticVersionAsync(), 4164await frozenDocument.Project.GetSemanticVersionAsync()); 4172project = project.AddDocument("Extra.cs", SourceText.From("class Extra { }")).Project; 4175project = documentToFreezeOriginal.Project; 4197await documentToFreezeOriginal.Project.GetDependentSemanticVersionAsync(), 4198await frozenDocument.Project.GetDependentSemanticVersionAsync()); 4201await documentToFreezeChanged.Project.GetDependentSemanticVersionAsync(), 4202await frozenDocument.Project.GetDependentSemanticVersionAsync()); 4205await documentToFreezeOriginal.Project.GetSemanticVersionAsync(), 4206await frozenDocument.Project.GetSemanticVersionAsync()); 4209await documentToFreezeChanged.Project.GetSemanticVersionAsync(), 4210await frozenDocument.Project.GetSemanticVersionAsync()); 4239var frozenSolution = document.WithFrozenPartialSemantics(CancellationToken.None).Project.Solution; 4250.AddDocument("RegularDocument.cs", "// Source File", filePath: "RegularDocument.cs").Project; 4254project = project.AddAdditionalDocument("Test.txt", "").Project; 4260Assert.Empty(frozenDocument.Project.AdditionalDocuments); 4268.AddDocument("RegularDocument.cs", "// Source File", filePath: "RegularDocument.cs").Project 4269.AddDocument("RegularDocument2.cs", "// Source File", filePath: "RegularDocument2.cs").Project; 4274Assert.Single(frozenDocument.Project.Documents); 4275var singleTree = Assert.Single((await frozenDocument.Project.GetCompilationAsync()).SyntaxTrees); 4284.AddDocument("RegularDocument.cs", "// Source File", filePath: "RegularDocument.cs").Project; 4289.AddDocument("RegularDocument.cs", "// Source File", filePath: "RegularDocument.cs").Project; 4297Assert.Equal(2, frozenDocument.Project.Documents.Count()); 4298var frozenCompilation = await frozenDocument.Project.GetCompilationAsync(); 4308.AddDocument("RegularDocument.cs", "// Source File", filePath: null).Project; 4313.AddDocument("RegularDocument2.cs", "// Source File", filePath: null).Project; 4325Assert.Equal(2, frozenDocument.Project.Documents.Count()); 4326var frozenCompilation = await frozenDocument.Project.GetCompilationAsync(); 4339var originalCompilation = await document.Project.GetCompilationAsync(); 4344Assert.Contains(await frozenDocument.GetSyntaxTreeAsync(), (await frozenDocument.Project.GetCompilationAsync()).SyntaxTrees); 4410currentSolution = document1.Project.Solution; 4414currentSolution = document2.Project.Solution; 4416var options = (CSharpParseOptions)document1.Project.ParseOptions; 4417currentSolution = currentSolution.WithProjectParseOptions(document1.Project.Id, options.WithPreprocessorSymbols("X")); 4436var frozenDoc2 = frozenDoc1.Project.Solution.GetRequiredDocument(document2.Id); 4451var frozenDoc1 = frozenDoc2.Project.Solution.GetRequiredDocument(document1.Id); 5439var newDoc = doc.Project.Solution.WithDocumentSyntaxRoot(doc.Id, newRoot).GetDocument(doc.Id); 5471static (sourceText, document) => document.Project.Solution.WithDocumentText(document.Id, sourceText, PreservationMode.PreserveIdentity), 5545.AddDocument("File.cs", "", filePath: FilePath).Project 5546.AddAdditionalDocument("File.cs", text: "", filePath: FilePath).Project.Solution; 5565.AddDocument("File.cs", "", filePath: "File.cs").Project.Solution 5567.AddDocument("file.cs", "", filePath: "file.cs").Project.Solution; 5578project = project.AddDocument("Extra.cs", SourceText.From("class Extra { }")).Project; 5595project = project.AddDocument("Extra.cs", SourceText.From("class Extra { }")).Project; 5616project1 = project2.Solution.GetProject(project1.Id).AddDocument("Doc1", SourceText.From("class Doc1 { }")).Project; 5617project2 = project1.Solution.GetProject(project2.Id).AddDocument("Doc2", SourceText.From("class Doc2 { }")).Project; 5644project1 = project2.Solution.GetProject(project1.Id).AddDocument("Doc1", SourceText.From("class Doc1 { }")).Project; 5645project2 = project1.Solution.GetProject(project2.Id).AddDocument("Doc2", SourceText.From("class Doc2 { }")).Project; 5674project1 = project2.Solution.GetProject(project1.Id).AddDocument("Doc1", SourceText.From("class Doc1 { }")).Project; 5675project2 = project1.Solution.GetProject(project2.Id).AddDocument("Doc2", SourceText.From("class Doc2 { }")).Project; 5706project1 = project1.AddDocument("Doc1", SourceText.From("class Doc1 { }")).Project; 5734project1 = project1.AddDocument("Doc1", SourceText.From("class Doc1 { }")).Project; 5783project = project.AddDocument("Extra.ts", SourceText.From("class Extra { }")).Project; 5806.AddDocument($"Document", SourceText.From("class C { }"), filePath: @"c:\test\Document.cs").Project; 5816.AddDocument($"Document", SourceText.From("class C { }"), filePath: @"c:\test\Document.cs").Project;
SolutionTests\SolutionWithSourceGeneratorTests.cs (39)
62project = project.AddAdditionalDocument("Test.txt", "Hello, world!").Project; 184.AddAdditionalDocument("Test.txt", "Hello, world!").Project 185.AddAdditionalDocument("Test2.txt", "Hello, world!").Project; 230project = project.AddDocument("Source.cs", SourceText.From("")).Project; 256.AddDocument("Hello.cs", "// Source File").Project 257.AddAdditionalDocument("Test.txt", "Hello, world!").Project; 300project = project.AddAdditionalDocument("Test.txt", "Hello, world!").Project; 340.AddDocument("Hello.cs", "// Source File").Project 341.AddAdditionalDocument("Test.txt", "Hello, world!").Project; 347var partialProject = project.Documents.Single().WithFrozenPartialSemantics(forceFreeze, CancellationToken.None).Project; 368.AddAdditionalDocument("Test.txt", "Hello, world!").Project; 408project = project.AddAdditionalDocument("Test.txt", "Hello, world!").Project; 421.AddAdditionalDocument("Test.txt", "Hello, world!").Project.Solution; 446.AddAdditionalDocument("Test.txt", "Hello, world!").Project; 460.AddDocument("RegularDocument.cs", "// Source File", filePath: "RegularDocument.cs").Project 461.AddAdditionalDocument("Test.txt", "Hello, world!").Project; 467project = project.Documents.Single(d => d.Name == "RegularDocument.cs").WithFrozenPartialSemantics(CancellationToken.None).Project; 483.AddDocument("RegularDocument.cs", "// Source File", filePath: "RegularDocument.cs").Project 484.AddAdditionalDocument("Test.txt", "Hello, world!").Project; 489project = project.Documents.Single().WithText(SourceText.From("// Change")).Project; 503.AddDocument("RegularDocument.cs", "// Source File", filePath: "RegularDocument.cs").Project 504.AddAdditionalDocument("Test.txt", "Hello, world!").Project; 530.AddDocument("RegularDocument.cs", "// Source File", filePath: "RegularDocument.cs").Project; 567project = project.Documents.Single().WithText(newText).Project; 601Assert.NotSame(workspace.CurrentSolution, generatedDocument.Project.Solution); 604var compilation = await generatedDocument.Project.GetRequiredCompilationAsync(CancellationToken.None); 624Assert.Same(workspace.CurrentSolution, generatedDocument!.Project.Solution); 636Assert.True(workspace.SetCurrentSolution(_ => originalAdditionalFile.Project.Solution, WorkspaceChangeKind.SolutionChanged)); 638var generatedDocument = Assert.Single(await originalAdditionalFile.Project.GetSourceGeneratedDocumentsAsync()); 651var compilation = await generatedDocument.Project.GetRequiredCompilationAsync(CancellationToken.None); 721.AddDocument("RegularDocument.cs", "// Source File", filePath: "RegularDocument.cs").Project; 752.AddDocument("RegularDocument.cs", "// Source File", filePath: "RegularDocument.cs").Project; 766var compilation = await document.Project.GetRequiredCompilationAsync(CancellationToken.None); 781.AddDocument("RegularDocument.cs", "// Source File", filePath: "RegularDocument.cs").Project; 795var compilation = await document.Project.GetRequiredCompilationAsync(CancellationToken.None); 814var originalDocument2 = AddEmptyProject(originalDocument1.Project.Solution, name: "Project2") 818var frozenSolution = originalDocument2.WithFrozenPartialSemantics(CancellationToken.None).Project.Solution; 890var syntaxTrees = (await frozenWithSingleDocument.Project.GetRequiredCompilationAsync(CancellationToken.None)).SyntaxTrees; 936Assert.Same(project.Solution, frozenSolution.Project.Solution);
SolutionTests\TryApplyChangesTests.cs (1)
166Assert.True(workspace.TryApplyChanges(project.AddAnalyzerConfigDocument(".editorconfig", SourceText.From("")).Project.Solution));
SymbolKeyTests.cs (2)
875workspace.TryApplyChanges(document.WithText(updated).Project.Solution); 922workspace.TryApplyChanges(document.WithText(updated).Project.Solution);
WorkspaceTests\AdhocWorkspaceTests.cs (3)
432Assert.True(ws.TryApplyChanges(changedDoc.Project.Solution)); 499Assert.True(ws.TryApplyChanges(changedDoc.Project.Solution)); 530Assert.True(ws.TryApplyChanges(changedDoc.Project.Solution));
WorkspaceTests\WorkspaceReferenceTests.cs (4)
40var compilation2 = await document.Project.GetCompilationAsync(); 80var compilation2 = await document.Project.GetCompilationAsync(); 120var compilation2 = await document.Project.GetCompilationAsync(); 164var compilation2 = await document.Project.GetCompilationAsync();
WorkspaceTests\WorkspaceTests.cs (4)
30Assert.Throws<NotSupportedException>(() => ws.TryApplyChanges(changedDoc.Project.Solution)).Message); 46Assert.Throws<NotSupportedException>(() => ws.TryApplyChanges(changedDoc.Project.Solution)).Message); 81Assert.Throws<NotSupportedException>(() => ws.TryApplyChanges(changedDoc.Project.Solution)).Message); 97Assert.Throws<NotSupportedException>(() => ws.TryApplyChanges(changedDoc.Project.Solution)).Message);
Microsoft.Gen.ComplianceReports.Unit.Tests (2)
test\Generators\Shared\RoslynTestUtils.cs (2)
95return proj.AddDocument(name, text).Project; 540project = document.Project;
Microsoft.Gen.ContextualOptions.Unit.Tests (2)
test\Generators\Shared\RoslynTestUtils.cs (2)
95return proj.AddDocument(name, text).Project; 540project = document.Project;
Microsoft.Gen.Logging.Unit.Tests (2)
test\Generators\Shared\RoslynTestUtils.cs (2)
95return proj.AddDocument(name, text).Project; 540project = document.Project;
Microsoft.Gen.Metrics.Unit.Tests (2)
test\Generators\Shared\RoslynTestUtils.cs (2)
95return proj.AddDocument(name, text).Project; 540project = document.Project;
Microsoft.Gen.MetricsReports.Unit.Tests (2)
test\Generators\Shared\RoslynTestUtils.cs (2)
95return proj.AddDocument(name, text).Project; 540project = document.Project;
Microsoft.Interop.ComInterfaceGenerator (3)
src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (3)
127bool enableUnsafe = doc.Project.CompilationOptions is CSharpCompilationOptions { AllowUnsafe: false }; 140ct => ApplyActionAndEnableUnsafe(doc.Project.Solution, doc.Id, fix.ApplyFix, ct), 209projectsToAddUnsafe.Add(solutionEditor.OriginalSolution.GetDocument(documentId).Project);
Microsoft.Interop.LibraryImportGenerator (8)
Analyzers\AddDisableRuntimeMarshallingAttributeFixer.cs (2)
39ct => AddDisableRuntimeMarshallingAttributeApplicationToProject(context.Document.Project, ct), 68return editor.GetChangedDocument().Project.Solution;
Analyzers\ConvertToLibraryImportFixer.cs (2)
275methodSymbol, document.Project.Solution, cancellationToken).ConfigureAwait(false); 637AnalyzerConfigOptions options = document.Project.AnalyzerOptions.AnalyzerConfigOptionsProvider.GetOptions(syntaxTree);
Analyzers\CustomMarshallerAttributeFixer.cs (1)
169SymbolEditor editor = SymbolEditor.Create(doc.Project.Solution);
src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (3)
127bool enableUnsafe = doc.Project.CompilationOptions is CSharpCompilationOptions { AllowUnsafe: false }; 140ct => ApplyActionAndEnableUnsafe(doc.Project.Solution, doc.Id, fix.ApplyFix, ct), 209projectsToAddUnsafe.Add(solutionEditor.OriginalSolution.GetDocument(documentId).Project);
Microsoft.ML.CodeAnalyzer.Tests (2)
Code\BestFriendTest.cs (2)
67projectA = projectA.AddDocument("BestFriendAttribute.cs", _sourceAttribute.Value).Project; 68projectA = projectA.AddDocument("BestFriendDeclaration.cs", _sourceDeclaration.Value).Project;
Microsoft.ML.InternalCodeAnalyzer (2)
NameFixProvider.cs (2)
112var originalSolution = document.Project.Solution; 114var newSolution = await Renamer.RenameSymbolAsync(document.Project.Solution, typeSymbol, newName, optionSet, cancellationToken).ConfigureAwait(false);
Microsoft.VisualStudio.LanguageServices (99)
CallHierarchy\CallHierarchyCommandHandler.cs (3)
90semanticModel, caretPosition, document.Project.Solution.Services, cancellationToken).ConfigureAwait(false); 95var mappingService = document.Project.Solution.Services.GetService<ISymbolMappingService>(); 115var notificationService = document.Project.Solution.Services.GetService<INotificationService>();
DebuggerIntelliSense\AbstractDebuggerIntelliSenseContext.cs (2)
135var solution = document.Project.Solution; 188document.Project.GetCompilationAsync(System.Threading.CancellationToken.None);
ExtractClass\VisualStudioExtractClassOptionsService.cs (3)
49var notificationService = document.Project.Solution.Services.GetRequiredService<INotificationService>(); 65var memberToDependentsMap = SymbolDependentsBuilder.FindMemberToDependentsMap(membersInType, document.Project, cancellationToken); 85document.Project.Language,
FindReferences\Contexts\AbstractTableDataSourceFindUsagesContext.cs (2)
479options ??= _globalOptions.GetClassificationOptions(document.Project.Language); 488options ??= _globalOptions.GetClassificationOptions(document.Project.Language);
FindReferences\Entries\DocumentSpanEntry.cs (3)
183var controlService = document.Project.Solution.Services.GetRequiredService<IContentControlService>(); 189var classificationOptions = Presenter._globalOptions.GetClassificationOptions(document.Project.Language); 194var clonedBuffer = excerpt.Value.Content.CreateTextBufferWithRoslynContentType(document.Project.Solution.Workspace);
FindReferences\StreamingFindUsagesPresenter.cs (4)
280var vsWorkspace = document.Project.Solution.Workspace as VisualStudioWorkspace; 282var (projectName, _) = document.Project.State.NameAndFlavor; 283projectName ??= document.Project.Name; 285var guid = vsWorkspace?.GetProjectGuid(document.Project.Id) ?? Guid.Empty;
GenerateType\GenerateTypeDialogViewModel.cs (12)
269if (isRootOfTheProject || this.SelectedProject != _document.Project) 422if (_selectedProject != _document.Project) 511if (_selectedProject == _document.Project) 520_previouslyPopulatedDocumentList.AddRange(_document.Project.Documents 727var dependencyGraph = document.Project.Solution.GetProjectDependencyGraph(); 734new ProjectSelectItem(document.Project) 739projectListing.AddRange(document.Project.Solution.Projects 740.Where(p => p != document.Project && !dependencyGraph.GetProjectsThatThisProjectTransitivelyDependsOn(p.Id).Contains(document.Project.Id)) 750this.SelectedProject = document.Project; 754this.AccessList = document.Project.Language == LanguageNames.CSharp 761this.KindList = document.Project.Language == LanguageNames.CSharp
GenerateType\VisualStudioGenerateTypeOptionsServiceFactory.cs (1)
52document.Project.Language == LanguageNames.CSharp ? ".cs" : ".vb",
Implementation\AbstractEditorFactory.cs (1)
412return project.AddAnalyzerConfigDocument(EditorConfigFileName, text, filePath: editorConfigFile).Project;
Implementation\AbstractVsTextViewFilter.cs (2)
104var languageDebugInfo = document.Project.Services.GetService<ILanguageDebugInfoService>(); 190var options = globalOptions.GetBraceMatchingOptions(document.Project.Language);
Implementation\VisualStudioSupportsFeatureService.cs (1)
97=> SupportsRenameWorker(document.Project.Solution.GetRelatedDocumentIds(document.Id));
InheritanceMargin\InheritanceMarginTaggerProvider.cs (3)
79if (document.Project.Solution.WorkspaceKind == WorkspaceKind.Interactive) 86if (GlobalOptions.GetOption(InheritanceMarginOptionsStorage.ShowInheritanceMargin, document.Project.Language) == false) 89var includeGlobalImports = GlobalOptions.GetOption(InheritanceMarginOptionsStorage.InheritanceMarginIncludeGlobalImports, document.Project.Language);
InheritanceMargin\InheritanceMarginViewMarginProvider.cs (1)
94document.Project.Language);
Interactive\VsResetInteractive.cs (1)
308var compilation = await document.Project.GetCompilationAsync().ConfigureAwait(true);
LanguageService\AbstractCreateServicesOnTextViewConnection.cs (2)
101if (e.Document.Project.Language == _languageName) 102_workQueue.AddWork(e.Document.Project.Id);
LanguageService\AbstractLanguageService`2.cs (2)
159if (openDocument?.Project.Solution.Workspace is MetadataAsSourceWorkspace masWorkspace) 166var options = BlockStructureOptionsStorage.GetBlockStructureOptions(globalOptions, openDocument.Project.Language, isMetadataAsSource: true);
LanguageService\AbstractLanguageService`2.IVsLanguageTextOps.cs (3)
59var formattingOptions = textBuffer.GetSyntaxFormattingOptions(EditorOptionsService, document.Project.GetFallbackAnalyzerOptions(), document.Project.Services, explicitFormat: true); 74[ruleFactory.CreateRule(documentSyntax, start), .. Formatter.GetDefaultFormattingRules(document.Project.Services)],
MoveStaticMembers\VisualStudioMoveStaticMembersOptionsService.cs (2)
52return GenerateOptions(document.Project.Language, viewModel, result.GetValueOrDefault()); 107var memberToDependentsMap = SymbolDependentsBuilder.FindMemberToDependentsMap(membersInType, document.Project, cancellationTokenSource.Token);
Preview\FileChange.cs (3)
86left.Project.Services.GetService<IContentTypeLanguageService>().GetDefaultContentType()); 223var workspace = document.Project.Solution.Workspace; 234= document.Project.Language == LanguageNames.CSharp ? (ushort)StandardGlyphGroup.GlyphCSharpFile :
Preview\PreviewUpdater.cs (2)
73_previewWorkspace ??= new PreviewDialogWorkspace(document.Project.Solution); 82var contentTypeService = document.Project.Services.GetRequiredService<IContentTypeLanguageService>();
Preview\TopLevelChange.cs (1)
89var oldLinkedDocument = oldDocument.Project.Solution.GetDocument(linkedDocumentId);
Progression\GraphBuilder.cs (1)
706_nodeToContextProjectMap[node] = document.Project;
Progression\GraphNodeIdCreation.cs (1)
32GraphNodeId.GetPartial(CodeGraphNodeIdName.Assembly, new Uri(document.Project.FilePath, UriKind.RelativeOrAbsolute)),
ProjectSystem\VisualStudioWorkspaceImpl.AddAdditionalDocumentUndoUnit.cs (1)
24=> fromProject.AddAdditionalDocument(DocumentInfo.Name, Text, DocumentInfo.Folders, DocumentInfo.FilePath).Project;
ProjectSystem\VisualStudioWorkspaceImpl.AddAnalyzerConfigDocumentUndoUnit.cs (1)
23=> fromProject.AddAnalyzerConfigDocument(DocumentInfo.Name, Text, DocumentInfo.Folders, DocumentInfo.FilePath).Project;
ProjectSystem\VisualStudioWorkspaceImpl.AddDocumentUndoUnit.cs (1)
23=> fromProject.AddDocument(DocumentInfo.Name, Text, DocumentInfo.Folders, DocumentInfo.FilePath).Project;
PullMemberUp\VisualStudioPullMemberUpService.cs (2)
60document.Project.Solution, 63var memberToDependentsMap = SymbolDependentsBuilder.FindMemberToDependentsMap(membersInType, document.Project, cancellationTokenSource.Token);
Snippets\AbstractSnippetCommandHandler.cs (1)
47=> document.Project.Services.SolutionServices.GetRequiredService<ISnippetExpansionClientFactory>();
Snippets\SnippetExpansionClient.cs (7)
542if (!(EditorOptionsService.GlobalOptions.GetOption(CompletionViewOptionsStorage.EnableArgumentCompletionSnippets, document.Project.Language) ?? false)) 747var compilation = await document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(true); 774var semanticInfo = semanticModel.GetSemanticInfo(token, document.Project.Solution.Services, cancellationToken); 906foreach (var provider in GetArgumentProviders(document.Project.Solution.Workspace)) 1068var languageServices = documentWithImports.Project.Services; 1069var fallbackOptions = documentWithImports.Project.GetFallbackAnalyzerOptions(); 1075AddReferences(documentWithImports.Project, snippetNode);
Snippets\SnippetFunctions\SnippetFunctionClassName.cs (1)
42var snippetFunctionService = document.Project.GetRequiredLanguageService<SnippetFunctionService>();
Snippets\SnippetFunctions\SnippetFunctionGenerateSwitchCases.cs (1)
51var snippetFunctionService = document.Project.GetRequiredLanguageService<SnippetFunctionService>();
ValueTracking\ValueTrackingCommandHandler.cs (1)
124var solution = document.Project.Solution;
Venus\ContainedDocument.cs (3)
773var formattingOptions = subjectBuffer.GetSyntaxFormattingOptions(editorOptionsService, document.Project.GetFallbackAnalyzerOptions(), document.Project.Services, explicitFormat: false); 807var services = document.Project.Solution.Services;
Venus\ContainedLanguage.IVsContainedLanguageCodeSupport.cs (2)
51var targetDocument = thisDocument.Project.Solution.GetDocument(targetDocumentId); 77additionalFormattingRule: targetDocument.Project.Services.GetService<IAdditionalFormattingRuleLanguageService>().GetAdditionalCodeGenerationRule(),
Venus\ContainedLanguageCodeSupport.cs (19)
47var type = document.Project.GetCompilationAsync(cancellationToken).WaitAndGetResult_Venus(cancellationToken).GetTypeByMetadataName(className); 60var type = document.Project.GetCompilationAsync(cancellationToken).WaitAndGetResult_Venus(cancellationToken).GetTypeByMetadataName(className); 90var compilation = document.Project.GetCompilationAsync(cancellationToken).WaitAndGetResult_Venus(cancellationToken); 158var thisCompilation = thisDocument.Project.GetCompilationAsync(cancellationToken).WaitAndGetResult_Venus(cancellationToken); 194returnType: targetDocument.Project.GetCompilationAsync(cancellationToken).WaitAndGetResult_Venus(cancellationToken).GetSpecialType(SpecialType.System_Void), 205var codeModel = targetDocument.Project.Services.GetRequiredService<ICodeModelNavigationPointService>(); 206var syntaxFacts = targetDocument.Project.Services.GetRequiredService<ISyntaxFactsService>(); 232targetDocument.Project.Solution.Services, 261var type = thisDocument.Project.GetCompilationAsync(cancellationToken).WaitAndGetResult_Venus(cancellationToken).GetTypeByMetadataName(className); 269var codeModel = thisDocument.Project.Services.GetService<ICodeModelNavigationPointService>(); 273var memberNodeDocument = thisDocument.Project.Solution.GetDocument(memberNode.SyntaxTree); 294var type = document.Project.GetCompilationAsync(cancellationToken).WaitAndGetResult_Venus(cancellationToken).GetTypeByMetadataName(className); 296var compilation = document.Project.GetCompilationAsync(cancellationToken).WaitAndGetResult_Venus(cancellationToken); 330var newSolution = Renamer.RenameSymbolAsync(document.Project.Solution, symbol, options, newName, cancellationToken).WaitAndGetResult_Venus(cancellationToken); 331var changedDocuments = newSolution.GetChangedDocuments(document.Project.Solution); 417return document.Project.GetCompilationAsync(cancellationToken).WaitAndGetResult_Venus(cancellationToken).GetTypeByMetadataName(fullyQualifiedName); 423var type = document.Project.GetCompilationAsync(cancellationToken).WaitAndGetResult_Venus(cancellationToken).GetTypeByMetadataName(typeName); 429var ns = document.Project.GetCompilationAsync(cancellationToken).WaitAndGetResult_Venus(cancellationToken).GlobalNamespace; 481var compilation = document.Project.GetCompilationAsync(cancellationToken).WaitAndGetResult_Venus(cancellationToken);
Workspace\VisualStudioDocumentNavigationService.cs (1)
307vsWorkspace.OpenDocumentFromPath(mappedSpanResult.FilePath, generatedDocument.Project.Id);
Workspace\VisualStudioSymbolNavigationService.cs (2)
284if (document.Project.Solution.Workspace is VisualStudioWorkspace visualStudioWorkspace 287hierarchy = visualStudioWorkspace.GetHierarchy(document.Project.Id);
Microsoft.VisualStudio.LanguageServices.CSharp (3)
LanguageService\CSharpHelpContextService.cs (1)
170symbol = semanticModel.GetSemanticInfo(token, document.Project.Solution.Services, cancellationToken)
Snippets\CSharpSnippetExpansionLanguageHelper.cs (2)
96var compilation = await document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(true); 102await document.Project.Solution.Workspace.ApplyDocumentChangesAsync(
Microsoft.VisualStudio.LanguageServices.UnitTests (28)
ChangeSignature\ChangeSignatureViewModelTests.vb (1)
467Dim token = Await tree.GetTouchingWordAsync(doc.CursorPosition.Value, workspaceDoc.Project.Services.GetService(Of ISyntaxFactsService)(), CancellationToken.None)
CommonControls\MemberSelectionViewModelTests.vb (2)
183Dim token = Await tree.GetTouchingWordAsync(doc.CursorPosition.Value, workspaceDoc.Project.Services.GetService(Of ISyntaxFactsService)(), CancellationToken.None) 188Dim memberToDependents = SymbolDependentsBuilder.FindMemberToDependentsMap(membersInType, workspaceDoc.Project, CancellationToken.None)
CommonControls\NewTypeDestinationSelectionViewModelTests.vb (1)
236Dim token = Await tree.GetTouchingWordAsync(doc.CursorPosition.Value, workspaceDoc.Project.Services.GetService(Of ISyntaxFactsService)(), CancellationToken.None)
ExtractInterface\ExtractInterfaceViewModelTests.vb (2)
299Dim token = Await tree.GetTouchingWordAsync(doc.CursorPosition.Value, workspaceDoc.Project.Services.GetService(Of ISyntaxFactsService)(), CancellationToken.None) 308workspaceDoc.Project.Services.GetService(Of ISyntaxFactsService)(),
GenerateType\GenerateTypeViewModelTests.vb (1)
862If(document.Project.Language = LanguageNames.CSharp, ".cs", ".vb"),
GoToDefinition\GoToDefinitionApiTests.vb (2)
36Dim project = document.Project 47symbolInfo.Symbol, document.Project.Solution,
MoveStaticMembers\MoveStaticMembersViewModelTest.vb (1)
34Dim syntaxFacts = workspaceDoc.Project.Services.GetService(Of ISyntaxFactsService)()
Preview\PreviewChangesTests.vb (5)
49forkedDocument.Project.Solution, 97Dim newSolution = forkedDocument.Project.Solution 144forkedDocument.Project.Solution, 192Dim newSolution = forkedDocument.Project.Solution 281Dim updatedSolution = document1.Project.Solution _
Progression\ProgressionTestState.vb (1)
45Await graphBuilder.AddNodeAsync(symbol, document.Project, document, CancellationToken.None)
PullMemberUp\PullMemberUpViewModelTest.vb (3)
255Dim token = Await tree.GetTouchingWordAsync(doc.CursorPosition.Value, workspaceDoc.Project.Services.GetService(Of ISyntaxFactsService)(), CancellationToken.None) 257Dim baseTypeTree = BaseTypeTreeNodeViewModel.CreateBaseTypeTree(glyphService:=Nothing, workspaceDoc.Project.Solution, memberSymbol.ContainingType, CancellationToken.None) 261Dim memberToDependents = SymbolDependentsBuilder.FindMemberToDependentsMap(membersInType, workspaceDoc.Project, CancellationToken.None)
RQName\RQNameTests.vb (1)
247Dim token = Await tree.GetTouchingWordAsync(doc.CursorPosition.Value, workspaceDoc.Project.Services.GetService(Of ISyntaxFactsService)(), CancellationToken.None)
Venus\DocumentService_IntegrationTests.vb (4)
198Assert.True(workspace.TryApplyChanges(newDocument.Project.Solution)) 205Assert.Throws(Of NotSupportedException)(Sub() workspace.TryApplyChanges(newDocument.Project.Solution)) 273Dim testWorkspace = DirectCast(document.Project.Solution.Workspace, EditorTestWorkspace) 311Dim testWorkspace = DirectCast(document.Project.Solution.Workspace, EditorTestWorkspace)
VsNavInfo\VsNavInfoTests.vb (4)
837Dim project = document.Project 839Dim navInfo = libraryService.NavInfoFactory.CreateForSymbol(symbol, document.Project, compilation, useExpandedHierarchy) 875Dim project = document.Project 877Dim navInfo = libraryService.NavInfoFactory.CreateForSymbol(symbol, document.Project, compilation, useExpandedHierarchy)
Microsoft.VisualStudio.LanguageServices.VisualBasic (11)
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\SnippetCompletionProvider.vb (1)
102Dim expansionClientFactory = document.Project.Services.SolutionServices.GetRequiredService(Of ISnippetExpansionClientFactory)()
Snippets\VisualBasicSnippetExpansionLanguageHelper.vb (2)
71Await document.Project.Solution.Workspace.ApplyDocumentChangesAsync(Me.ThreadingContext, formattedDocument, cancellationToken).configureawait(True) 104Dim compilation = Await document.Project.GetCompilationAsync(cancellationToken).ConfigureAwait(True)
Venus\ContainedLanguageStaticEventBinding.vb (7)
27Dim type = document.Project.GetCompilationAsync(cancellationToken).WaitAndGetResult(cancellationToken).GetTypeByMetadataName(className) 64Dim type = document.Project.GetCompilationAsync(cancellationToken).WaitAndGetResult(cancellationToken).GetTypeByMetadataName(className) 66Dim targetDocument = document.Project.Solution.GetDocument(memberSymbol.Locations.First().SourceTree) 80Dim codeModel = targetDocument.Project.Services.GetService(Of ICodeModelService)() 92Dim type = document.Project.GetCompilationAsync(cancellationToken).WaitAndGetResult(cancellationToken).GetTypeByMetadataName(className) 94Dim targetDocument = document.Project.Solution.GetDocument(memberSymbol.Locations.First().SourceTree) 108Dim codeModel = targetDocument.Project.Services.GetService(Of ICodeModelService)()
Microsoft.VisualStudio.LanguageServices.Xaml (18)
Extensions.cs (4)
28if (document.Project.SupportsCompilation) 30return document.Project; 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\Handler\Commands\CreateEventCommandHandler.cs (1)
54var commandService = document.Project.Services.GetService<IXamlCommandService>();
Implementation\LanguageServer\Handler\Completion\CompletionHandler.cs (1)
65var completionService = document.Project.Services.GetRequiredService<IXamlCompletionService>();
Implementation\LanguageServer\Handler\Definitions\GoToDefinitionHandler.cs (2)
61var solution = document.Project.Solution; 63var xamlGoToDefinitionService = document.Project.Services.GetService<IXamlGoToDefinitionService>();
Implementation\LanguageServer\Handler\Diagnostics\AbstractPullDiagnosticHandler.cs (1)
127var project = document.Project;
Implementation\LanguageServer\Handler\FoldingRanges\FoldingRangesHandler.cs (1)
42var xamlStructureService = document.Project.Services.GetService<IXamlStructureService>();
Implementation\LanguageServer\Handler\Formatting\AbstractFormatDocumentHandlerBase.cs (1)
31var formattingService = document?.Project.Services.GetService<IXamlFormattingService>();
Implementation\LanguageServer\Handler\Formatting\FormatDocumentOnTypeHandler.cs (1)
43var formattingService = document?.Project.Services.GetService<IXamlFormattingService>();
Implementation\LanguageServer\Handler\Hover\HoverHandler.cs (2)
53var quickInfoService = document.Project.Services.GetService<IXamlQuickInfoService>(); 68var options = _globalOptions.GetSymbolDescriptionOptions(document.Project.Language);
Implementation\LanguageServer\Handler\OnAutoInsert\OnAutoInsertHandler.cs (1)
41var insertService = document.Project.Services.GetService<IXamlAutoInsertService>();
Implementation\LanguageServer\Handler\OnTypeRename\OnTypeRenameHandler.cs (1)
73var renameService = document.Project.Services.GetService<IXamlTypeRenameService>();
Implementation\XamlProjectService.cs (1)
204var project = _xamlProjects.Values.SingleOrDefault(p => p.Id == document.Project.Id);
Roslyn.VisualStudio.Next.UnitTests (14)
Remote\RemoteHostClientServiceFactoryTests.cs (1)
52var newSolution = document.Project.Solution.WithDocumentText(document.Id, newText, PreservationMode.PreserveIdentity);
Remote\SnapshotSerializationTests.cs (2)
53var project2 = document1.Project.Solution.AddProject("Project2", "Project2.dll", LanguageNames.VisualBasic); 56solution = document2.Project.Solution.GetRequiredProject(project1.Id)
Services\ServiceHubServicesTests.cs (3)
1626if (document.Project.Language == LanguageNames.CSharp) 1737solution = current.AddDocument($"Document{i}", SourceText.From(documents[i])).Project.Solution; 1743solution = current.AddAdditionalDocument($"AdditionalDocument{i}", SourceText.From(additionalDocuments[i])).Project.Solution;
Services\SolutionServiceTests.cs (8)
315project = project.AddDocument("newDocument", SourceText.From("// new text")).Project; 321return document.Project.Solution; 523var frozenSolution1 = solution.WithFrozenSourceGeneratedDocument(documentIdentity, DateTime.Now, frozenText1).Project.Solution; 532var frozenSolution2 = solution.WithFrozenSourceGeneratedDocument(documentIdentity, DateTime.Now, frozenText2).Project.Solution; 835solution = solution.GetProject(project1.Id).AddDocument("X.cs", SourceText.From("// X")).Project.Solution; 836solution = solution.GetProject(project2.Id).AddDocument("Y.vb", SourceText.From("' Y")).Project.Solution; 890solution = solution.GetProject(project1.Id).AddDocument("X.cs", SourceText.From("// X")).Project.Solution; 891solution = solution.GetProject(project2.Id).AddDocument("Y.cs", SourceText.From("// Y")).Project.Solution;