549 references to Id
AnalyzerRunner (3)
CodeRefactoringRunner.cs (3)
65updatedSolution = updatedSolution.WithDocumentSyntaxRoot(document.Id, await newDocument.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false)); 111if (documentChanges.Length != 1 || documentChanges[0] != document.Id) 116return projectChanges[0].NewProject.GetDocument(document.Id);
Microsoft.Analyzers.Extra (3)
CallAnalysis\Fixers\LegacyLoggingFixer.cs (3)
471var docEditor = await solEditor.GetDocumentEditorAsync(doc.Id, cancellationToken).ConfigureAwait(false); 542var invocationDocId = invocationDoc.Id; 581var docEditor = await solEditor.GetDocumentEditorAsync(targetDoc.Id, cancellationToken).ConfigureAwait(false);
Microsoft.AspNetCore.Analyzer.Testing (1)
CodeFixRunner.cs (1)
39var updatedDocument = updatedSolution.GetDocument(document.Id);
Microsoft.AspNetCore.App.Analyzers.Test (3)
TestDiagnosticAnalyzer.cs (3)
32var doc = project.Solution.GetDocument(project.Documents.First().Id); 49var doc = project.Solution.GetDocument(project.Documents.First().Id); 71var document = project.Solution.GetDocument(project.Documents.First().Id);
Microsoft.AspNetCore.Components.Analyzers.Tests (1)
Helpers\CodeFixVerifier.Helper.cs (1)
30return solution.GetDocument(document.Id);
Microsoft.AspNetCore.Components.SdkAnalyzers.Tests (1)
Helpers\CodeFixVerifier.Helper.cs (1)
30return solution.GetDocument(document.Id);
Microsoft.CodeAnalysis.CodeStyle.Fixes (10)
src\Analyzers\Core\CodeFixes\MakeMethodAsynchronous\AbstractMakeMethodAsynchronousCodeFixProvider.cs (1)
172var newDocument = newSolution.GetRequiredDocument(document.Id);
src\Analyzers\Core\CodeFixes\MakeMethodSynchronous\AbstractMakeMethodSynchronousCodeFixProvider.cs (2)
84var newDocument = newSolution.GetRequiredDocument(document.Id); 183return currentSolution.WithDocumentSyntaxRoot(document.Id, newRoot);
src\Analyzers\Core\CodeFixes\MatchFolderAndNamespace\AbstractChangeNamespaceToMatchFolderCodeFixProvider.CustomFixAllProvider.cs (1)
80.SelectAsArray(group => (id: solution.GetRequiredDocument(group.Key!).Id, diagnostics: group.ToImmutableArray()));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
99return workspace != null && workspace.IsDocumentOpen(document.Id);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\TextDocumentExtensions.cs (4)
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\Utilities\ParsedDocument.cs (1)
39return new ParsedDocument(document.Id, text, root, document.Project.GetExtendedLanguageServices());
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (4)
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (1)
98.GetDocumentEditorAsync(document.Id, cancellationToken).ConfigureAwait(false);
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (2)
132var constructorDocumentEditor = await solutionEditor.GetDocumentEditorAsync(document.Id, cancellationToken).ConfigureAwait(false); 342var documentEditor = await solutionEditor.GetDocumentEditorAsync(document.Id, cancellationToken).ConfigureAwait(false);
src\Analyzers\CSharp\CodeFixes\UseSystemThreadingLock\CSharpUseSystemThreadingLockCodeFixProvider.cs (1)
96var editor = await solutionEditor.GetDocumentEditorAsync(document.Id, cancellationToken).ConfigureAwait(false);
Microsoft.CodeAnalysis.CSharp.EditorFeatures (1)
EventHookup\EventHookupCommandHandler_TabKeyCommand.cs (1)
203var updatedDocument = workspace.CurrentSolution.GetRequiredDocument(document.Id);
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (26)
CodeActions\ApplyChangesOperationTests.cs (10)
80return solution.WithDocumentText(document1.Id, SourceText.From("NewProgram1Content")); 85return solution.WithDocumentText(document2.Id, SourceText.From("NewProgram2Content")); 112return solution.WithDocumentText(document1.Id, SourceText.From("NewProgram1Content")); 117return solution.RemoveDocument(document2.Id); 144return solution.WithDocumentText(document1.Id, SourceText.From("NewProgram1Content1")); 149return solution.WithDocumentText(document1.Id, SourceText.From("NewProgram1Content2")); 175return solution.WithDocumentText(document1.Id, SourceText.From("NewProgram1Content1")); 180return solution.RemoveDocument(document1.Id); 207return solution.RemoveDocument(document1.Id); 212return solution.WithDocumentText(document2.Id, SourceText.From("NewProgram1Content2"));
CodeActions\PreviewExceptionTests.cs (1)
109textBuffer = workspace.GetTestDocument(document.Id).GetTextBuffer();
CodeActions\PreviewTests.cs (1)
84solution = solution.WithDocumentSyntaxRoot(_oldDocument.Id, CSharpSyntaxTree.ParseText(ChangedDocumentText, cancellationToken: cancellationToken).GetRoot(cancellationToken));
EditAndContinue\ActiveStatementTrackingServiceTests.cs (2)
85var spans2 = await trackingSession.GetSpansAsync(solution, document1.Id, document1.FilePath, CancellationToken.None); 88var spans3 = await trackingSession.GetSpansAsync(solution, document2.Id, document2.FilePath, CancellationToken.None);
EditorConfigSettings\Updater\SettingsUpdaterTests.cs (1)
367var newSolution = solution.WithAnalyzerConfigDocumentText(editorconfig.Id, text);
TaskList\NoCompilationTaskListTests.cs (1)
66document.Id,
Workspaces\WorkspaceTests_EditorFeatures.cs (10)
807(sender, args) => Assert.True(args.Document.Id == document.Id, 811(sender, args) => Assert.True(args.Document.Id == document.Id, 873(sender, args) => Assert.True(args.Document.Id == document.Id, 877(sender, args) => Assert.True(args.Document.Id == document.Id, 937(sender, args) => Assert.True(args.Document.Id == document.Id, 941(sender, args) => Assert.True(args.Document.Id == document.Id, 998(sender, args) => Assert.True(args.Document.Id == document.Id, 1002(sender, args) => Assert.True(args.Document.Id == document.Id, 1317workspace.TryApplyChanges(project.RemoveAdditionalDocument(doc.Id).Solution); 1345workspace.TryApplyChanges(project.RemoveAnalyzerConfigDocument(doc.Id).Solution);
Microsoft.CodeAnalysis.CSharp.Features (7)
ConvertPrimaryToRegularConstructor\ConvertPrimaryToRegularConstructorCodeRefactoringProvider.cs (1)
94var mainDocumentEditor = await solutionEditor.GetDocumentEditorAsync(document.Id, cancellationToken).ConfigureAwait(false);
GenerateType\CSharpGenerateTypeService.cs (1)
777updatedSolution = updatedSolution.WithDocumentSyntaxRoot(document.Id, addedCompilationRoot, PreservationMode.PreserveIdentity);
InitializeParameter\CSharpInitializeMemberFromPrimaryConstructorParameterCodeRefactoringProvider_Update.cs (1)
49var currentDocument = currentSolution.GetRequiredDocument(document.Id);
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (1)
98.GetDocumentEditorAsync(document.Id, cancellationToken).ConfigureAwait(false);
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (2)
132var constructorDocumentEditor = await solutionEditor.GetDocumentEditorAsync(document.Id, cancellationToken).ConfigureAwait(false); 342var documentEditor = await solutionEditor.GetDocumentEditorAsync(document.Id, cancellationToken).ConfigureAwait(false);
src\Analyzers\CSharp\CodeFixes\UseSystemThreadingLock\CSharpUseSystemThreadingLockCodeFixProvider.cs (1)
96var editor = await solutionEditor.GetDocumentEditorAsync(document.Id, cancellationToken).ConfigureAwait(false);
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (9)
EditAndContinue\CSharpEditAndContinueAnalyzerTests.cs (9)
306var documentId = oldDocument.Id; 371var documentId = oldDocument.Id; 432var documentId = oldDocument.Id; 468var documentId = oldDocument.Id; 514var documentId = oldDocument.Id; 546var documentId = oldDocument.Id; 583var documentId = oldDocument.Id; 622var documentId = oldDocument.Id; 798var documentId = oldProject.Documents.Single().Id;
Microsoft.CodeAnalysis.EditorFeatures (35)
Classification\Syntactic\SyntacticClassificationTaggerProvider.TagComputer.cs (1)
481if (_lineCache.TryUseCache(lastProcessedDocument.Id, lastProcessedDocument.Project.ParseOptions, span, classifiedSpans))
CodeActions\CodeActionEditHandlerService.cs (1)
163transaction.AddDocument(fromDocument.Id);
EditAndContinue\ActiveStatementTrackingService.cs (1)
171var compileTimeDocument = await compileTimeSolution.GetDocumentAsync(designTimeDocument.Id, includeSourceGenerated: true, cancellationToken).ConfigureAwait(false);
Extensibility\NavigationBar\AbstractEditorNavigationBarItemService.cs (1)
83return Task.FromResult((document.Id, navigationSpan.Start, 0));
ExternalAccess\VSTypeScript\VSTypeScriptNavigationBarItemService.cs (1)
62_threadingContext, workspace, document.Id, navigationSpan.Start, cancellationToken).ConfigureAwait(false);
Formatting\FormatCommandHandler.cs (1)
73changes = ruleFactory.FilterFormattedChanges(document.Id, selectionOpt.Value, changes).ToImmutableArray();
Formatting\FormatCommandHandler.Paste.cs (1)
70if (formattingRuleService != null && formattingRuleService.ShouldNotFormatOrCommitOnPaste(document.Id))
InlineRename\InlineRenameService.cs (1)
144workspace, document.Id, documentSpan.SourceSpan, cancellationToken).ConfigureAwait(false);
InlineRename\InlineRenameSession.OpenTextBufferManager.cs (11)
330var newDocument = mergeResult.MergedSolution.GetDocument(documents.First().Id); 331var originalDocument = _baseDocuments.Single(d => d.Id == newDocument.Id); 356.Select(document => (document, conflictResolution.GetReplacements(document.Id).Where(r => GetRenameSpanKind(r.Kind) != RenameSpanKind.None).ToImmutableArray())) 409var firstDocumentNewText = conflictResolution.NewSolution.GetDocument(firstDocumentReplacements.document.Id).GetTextSynchronously(cancellationToken); 418var documentNewText = conflictResolution.NewSolution.GetDocument(document.Id).GetTextSynchronously(cancellationToken); 439var relevantReplacements = conflictResolution.GetReplacements(document.Id).Where(r => GetRenameSpanKind(r.Kind) != RenameSpanKind.None); 448conflictResolution.NewSolution.GetDocument(document.Id), 449mergeResult.MergedSolution.GetDocument(document.Id), 455mergeResult.MergeConflictCommentSpans.TryGetValue(document.Id, out var mergeConflictComments); 550if (newDocument.Id != oldDocument.Id)
Navigation\AbstractDefinitionLocationService.cs (1)
37workspace, document.Id, position, cancellationToken);
NavigationBar\NavigationBarController.cs (1)
252documentId: d.Id,
Preview\AbstractPreviewFactoryService.cs (8)
290rightWorkspace.Target.OpenDocument(document.Id, newEditorDocument.TextBuffer.AsTextContainer()); 372leftWorkspace.Target.OpenDocument(document.Id, oldEditorDocument.TextBuffer.AsTextContainer()); 487var allLeftIds = leftSolution.GetRelatedDocumentIds(oldDocument.Id); 491leftWorkspace.Target.OpenDocument(oldDocument.Id, oldBuffer.AsTextContainer()); 494var allRightIds = rightSolution.GetRelatedDocumentIds(newDocument.Id); 498rightWorkspace.Target.OpenDocument(newDocument.Id, newBuffer.AsTextContainer()); 554leftWorkspace.Target.OpenDocument(oldDocument.Id, oldBuffer.AsTextContainer()); 557rightWorkspace.Target.OpenDocument(newDocument.Id, newBuffer.AsTextContainer());
Remote\SolutionChecksumUpdater.cs (1)
254(service, cancellationToken) => service.SynchronizeTextAsync(oldDocument.Id, state.Text, textChanges, cancellationToken),
RenameTracking\RenameTrackingCancellationCommandHandler.cs (1)
43RenameTrackingDismisser.DismissVisibleRenameTracking(document.Project.Solution.Workspace, document.Id);
RenameTracking\RenameTrackingTaggerProvider.RenameTrackingCommitter.cs (2)
89var symbol = await TryGetSymbolAsync(solutionWithOriginalName, document.Id, cancellationToken).ConfigureAwait(false); 200document.GetLinkedDocumentIds().Add(document.Id).SelectAsArray(id => (id, newFullText)));
Shared\Extensions\WorkspaceExtensions.cs (2)
23var oldDocument = oldSolution.GetRequiredDocument(newDocument.Id); 25var newSolution = oldSolution.UpdateDocument(newDocument.Id, changes, cancellationToken);
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (2)
ExtractInterface\AbstractExtractInterfaceTests.cs (2)
135var updatedOriginalDocument = result.UpdatedSolution.GetDocument(testState.ExtractFromDocument.Id); 162var updatedDocument = updatedSolution.GetDocument(testState.ExtractFromDocument.Id);
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (37)
CodeFixes\CodeFixServiceTests.cs (4)
893var changedtxtDocument = solution!.Projects.Single().AdditionalDocuments.Single(t => t.Id == txtDocument.Id); 950return document.Project.Solution.WithAdditionalDocumentText(document.Id, newText); 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,
CodeRefactorings\CodeRefactoringServiceTest.cs (4)
181var changedtxtDocument = solution.Projects.Single().AdditionalDocuments.Single(t => t.Id == txtAdditionalDocument.Id); 220var changedEditorConfig = solution.Projects.Single().AnalyzerConfigDocuments.Single(t => t.Id == editorConfig.Id); 248return document.Project.Solution.WithAdditionalDocumentText(document.Id, newText); 249return document.Project.Solution.WithAnalyzerConfigDocumentText(document.Id, newText);
Diagnostics\DiagnosticAnalyzerServiceTests.cs (14)
49workspace.OpenDocument(document.Id); 52documentTrackingService.SetActiveDocument(document.Id); 120workspace.OpenDocument(document.Id); 190workspace.OpenDocument(document.Id); 453workspace.OpenAdditionalDocument(firstAdditionalDocument.Id); 522workspace.OpenDocument(document.Id); 524documentTrackingService.SetActiveDocument(document.Id); 528workspace.OpenDocument(document.Id); 643workspace.OpenSourceGeneratedDocument(document.Id); 645workspace.OpenDocument(document.Id); 648documentTrackingService.SetActiveDocument(document.Id); 653workspace.OpenSourceGeneratedDocument(document.Id); 655workspace.OpenDocument(document.Id); 870workspace.OpenDocument(document.Id);
Diagnostics\DiagnosticDataTests.cs (8)
125location: new DiagnosticDataLocation(new("originalFile1", new(startLine, startColumn), new(endLine, endColumn)), document.Id), 145new(additionalDocument.Name, new(0, 0), new(0, 1)), additionalDocument.Id); 158location: new DiagnosticDataLocation(new FileLinePositionSpan(document.FilePath, span: default), document.Id), 236firstDocument = secondDocument.Project.Solution.GetRequiredDocument(firstDocument.Id); 239new(secondDocument.Name, new(0, 0), new(0, 1)), secondDocument.Id); 252location: new DiagnosticDataLocation(new FileLinePositionSpan(firstDocument.FilePath, span: default), firstDocument.Id), 261.RemoveDocument(secondDocument.Id) 262.GetRequiredDocument(firstDocument.Id);
LinkedFiles\LinkedFileDiffMergingEditorTests.cs (2)
108.WithDocumentText(document.Id, (await document.GetTextAsync()).Replace(textString.IndexOf("public"), "public".Length, "internal")) 109.WithDocumentText(linkedDocument.Id, sourceText.Replace(textString.LastIndexOf("public"), "public".Length, "private"));
MetadataAsSource\AbstractMetadataAsSourceTests.cs (1)
89metadataProject = metadataProject.RemoveDocument(newDoc.Id);
Preview\PreviewWorkspaceTests.cs (4)
104previewWorkspace.OpenDocument(document.Id, sourceTextContainer); 106Assert.True(previewWorkspace.IsDocumentOpen(document.Id)); 108previewWorkspace.CloseDocument(document.Id); 110Assert.False(previewWorkspace.IsDocumentOpen(document.Id));
Microsoft.CodeAnalysis.EditorFeatures.Wpf (1)
QuickInfo\ContentControlService.cs (1)
71workspace.OpenDocument(document.Id, textBuffer.AsTextContainer());
Microsoft.CodeAnalysis.ExternalAccess.FSharp (4)
Internal\Editor\FSharpNavigationBarItemService.cs (2)
74if (navigationService.CanNavigateToPosition(workspace, document.Id, span.Start, virtualSpace: 0, cancellationToken)) 76navigationService.TryNavigateToPosition(workspace, document.Id, span.Start, virtualSpace: 0, cancellationToken);
Internal\Editor\FSharpSmartIndentProvider.cs (1)
95result = _provider._service.GetDesiredIndentation(document.Project.LanguageServices, text, document.Id, document.FilePath, line.LineNumber, fsharpOptions);
TaskList\FSharpTaskListService.cs (1)
49return new TaskListItem(priority, d.Message, document.Id, span, span);
Microsoft.CodeAnalysis.ExternalAccess.Xaml (1)
Internal\XamlDiagnosticSourceProvider.cs (1)
31document.Project.GetAdditionalDocument(document.Id) != null)
Microsoft.CodeAnalysis.Features (105)
AddConstructorParametersFromMembers\AddConstructorParametersFromMembersCodeRefactoringProvider.cs (1)
189var intent = new IntentProcessorResult(changedSolution, [priorDocument.Id], action.Title, action.ActionName);
AddImport\AbstractAddImportFeatureService.cs (2)
74service.GetFixesAsync(solutionInfo, callbackId, document.Id, span, diagnosticId, maxResults, options, packageSources, cancellationToken), 541service.GetUniqueFixesAsync(solutionInfo, callbackId, document.Id, span, diagnosticIds, options, packageSources, cancellationToken),
AddImport\CodeActions\InstallPackageAndAddImportCodeAction.cs (1)
93OriginalDocument.Id, oldText, newText, _installOperation));
AddPackage\InstallPackageDirectlyCodeActionOperation.cs (1)
71workspace, _document.Id, _source, _packageName,
CodeFixes\Configuration\ConfigurationUpdater.cs (1)
281return solution.WithAnalyzerConfigDocumentText(editorConfigDocument.Id, newText);
CodeFixes\Suppression\AbstractSuppressionBatchFixAllProvider.cs (3)
315documentIdToFinalText.TryAdd(document.Id, finalText); 324var oldDocument = oldSolution.GetRequiredDocument(orderedDocuments[0].document.Id); 330Debug.Assert(currentDocument.Id == oldDocument.Id);
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.AbstractGlobalSuppressMessageCodeAction.cs (2)
38new OpenDocumentOperation(changedSuppressionDocument.Id, activateIfAlreadyOpen: true), 39new DocumentNavigationOperation(changedSuppressionDocument.Id, position: 0),
CodeLens\CodeLensReferencesService.cs (1)
148var documentId = solution.GetDocument(location.SourceTree)?.Id;
CodeRefactorings\AddMissingImports\AbstractAddMissingImportsFeatureService.cs (2)
146var newDocument = newProject.GetRequiredDocument(document.Id).WithText(newText); 239var newDocument = newSolution.GetRequiredDocument(document.Id);
CodeRefactorings\MoveType\AbstractMoveTypeService.MoveTypeEditor.cs (1)
72return await RemoveUnnecessaryImportsAsync(solutionWithBothDocumentsUpdated, sourceDocument.Id, documentWithMovedType.Id).ConfigureAwait(false);
CodeRefactorings\SyncNamespace\AbstractChangeNamespaceService.cs (3)
159document = solution.GetRequiredDocument(document.Id); 361allDocumentIds = linkedDocumentIds.Add(document.Id); 702Debug.Assert(document.Id == refLoc.Document.Id);
CodeRefactorings\SyncNamespace\AbstractSyncNamespaceCodeRefactoringProvider.MoveFileCodeAction.cs (1)
43solution = solution.RemoveDocument(document.Id);
Completion\Providers\AbstractPreprocessorCompletionProvider.cs (1)
32foreach (var documentId in solution.GetRelatedDocumentIds(originatingDocument.Id))
Completion\Providers\AbstractRecommendationServiceBasedCompletionProvider.cs (3)
212var description = await TryGetDescriptionAsync(document.Id).ConfigureAwait(false); 217var relatedDocumentIds = document.Project.Solution.GetRelatedDocumentIds(document.Id); 220if (relatedId == document.Id)
Completion\Providers\AbstractSymbolCompletionProvider.cs (1)
310documentIdToIndex.Add(document.Id, 0);
Completion\Providers\ImportCompletionProvider\ExtensionMethodImportCompletionHelper.cs (1)
75solutionInfo, document.Id, position, receiverTypeSymbolKeyData, [.. namespaceInScope],
Completion\Providers\SymbolCompletionItem.cs (1)
213if (supportedPlatforms != null && supportedPlatforms.InvalidProjects.Contains(document.Id.ProjectId))
Completion\SharedSyntaxContextsWithSpeculativeModel.cs (3)
35if (_document.Id != document.Id && !_lazyRelatedDocumentIds.Value.Contains(document.Id))
ConvertTupleToStruct\AbstractConvertTupleToStructCodeRefactoringProvider.cs (3)
196var parsedDocument = new ParsedDocument(document.Id, text, root, hostServices); 229(service, solutionInfo, cancellationToken) => service.ConvertToStructAsync(solutionInfo, document.Id, span, scope, isRecord, cancellationToken), 590var docId = currentDoc.Id;
DesignerAttribute\DesignerAttributeDiscoveryService.cs (2)
240if (specificDocument != null && documentId != specificDocument.Id) 399var priorityDocumentId = activeDocument.Id;
DocumentHighlighting\AbstractDocumentHighlightsService.cs (1)
48(service, solutionInfo, cancellationToken) => service.GetDocumentHighlightsAsync(solutionInfo, document.Id, position, documentsToSearch.SelectAsArray(d => d.Id), options, cancellationToken),
DocumentIdSpan.cs (1)
26=> new(documentSpan.Document.Id, documentSpan.SourceSpan);
DocumentSpanExtensions.cs (1)
26workspace, documentSpan.Document.Id, documentSpan.SourceSpan.Start, cancellationToken);
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (7)
541var oldDocument = await oldProject.GetDocumentAsync(newDocument.Id, includeSourceGenerated: true, cancellationToken).ConfigureAwait(false); 577return DocumentAnalysisResults.SyntaxErrors(newDocument.Id, filePath, [], syntaxError, analysisStopwatch.Elapsed, hasChanges); 588return DocumentAnalysisResults.Unchanged(newDocument.Id, filePath, analysisStopwatch.Elapsed); 597return DocumentAnalysisResults.SyntaxErrors(newDocument.Id, filePath, [new RudeEditDiagnostic(RudeEditKind.ExperimentalFeaturesEnabled, default)], syntaxError: null, analysisStopwatch.Elapsed, hasChanges); 606return DocumentAnalysisResults.SyntaxErrors(newDocument.Id, filePath, [new RudeEditDiagnostic(RudeEditKind.NotSupportedByRuntime, default)], syntaxError: null, analysisStopwatch.Elapsed, hasChanges); 685newDocument.Id, 710return DocumentAnalysisResults.SyntaxErrors(newDocument.Id, filePath, [diagnostic], syntaxError: null, analysisStopwatch.Elapsed, hasChanges);
EditAndContinue\CommittedSolution.cs (1)
142Contract.ThrowIfFalse(currentDocument == null || documentId == currentDocument.Id);
EditAndContinue\DebuggingSession.cs (2)
480var (oldDocument, oldDocumentState) = await LastCommittedSolution.GetDocumentAndStateAsync(document.Id, document, cancellationToken).ConfigureAwait(false); 794var newDocumentActiveStatementSpans = await activeStatementSpanProvider(mappedDocument.Id, mappedDocument.FilePath, cancellationToken).ConfigureAwait(false);
EditAndContinue\EditAndContinueDocumentAnalysesCache.cs (5)
119var newMappedDocumentSpans = await newActiveStatementSpanProvider(newDocument.Id, newDocument.FilePath, cancellationToken).ConfigureAwait(false); 139newMappedDocumentSpans = await newActiveStatementSpanProvider((newDocument.FilePath == mappedFilePath) ? newDocument.Id : null, mappedFilePath, cancellationToken).ConfigureAwait(false); 151Debug.Assert(newMappedDocumentActiveSpan.UnmappedDocumentId == null || newMappedDocumentActiveSpan.UnmappedDocumentId == newDocument.Id); 176if (_analyses.TryGetValue(document.Id, out var analysis) && 203_analyses[document.Id] = (lazyResults, baseProject, document, activeStatementSpans);
EditAndContinue\Remote\RemoteDebuggingSessionProxy.cs (1)
168(service, solutionInfo, callbackId, cancellationToken) => service.GetAdjustedActiveStatementSpansAsync(solutionInfo, callbackId, sessionId, document.Id, cancellationToken),
EncapsulateField\AbstractEncapsulateFieldService.cs (4)
125(service, solutionInfo, cancellationToken) => service.EncapsulateFieldsAsync(solutionInfo, document.Id, fieldSymbolKeys, updateReferences, cancellationToken), 148document = currentSolution.GetRequiredDocument(document.Id); 194document = solutionNeedingProperty.GetRequiredDocument(document.Id); 251document = solution.GetRequiredDocument(document.Id);
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.cs (3)
381await EnqueueDocumentWorkItemAsync(project, document.Id, document, invocationReasons).ConfigureAwait(false); 466await EnqueueDocumentWorkItemAsync(newDocument.Project, newDocument.Id, newDocument, UnitTestingInvocationReasons.DocumentChanged).ConfigureAwait(false); 473await EnqueueDocumentWorkItemAsync(newDocument.Project, newDocument.Id, newDocument, differenceResult.ChangeType, differenceResult.ChangedMember).ConfigureAwait(false);
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingSemanticChangeProcessor.cs (2)
177var projectId = thisDocument.Id.ProjectId; 184if (documentId == null || thisDocument.Id == documentId)
ExternalAccess\VSTypeScript\VSTypeScriptTaskListService.cs (1)
44return new TaskListItem(d.Descriptor.Descriptor.Priority, d.Message, document.Id, span, span);
ExtractInterface\AbstractExtractInterfaceService.cs (3)
227var document = symbolMapping.AnnotatedSolution.GetDocument(refactoringResult.DocumentToExtractFrom.Id); 246symbolMapping.DocumentIdsToSymbolMap.Keys.Concat(refactoringResult.DocumentToExtractFrom.Id), 252navigationDocumentId: refactoringResult.DocumentToExtractFrom.Id);
FullyQualify\AbstractFullyQualifyService.cs (1)
48(service, solutionChecksum, cancellationToken) => service.GetFixDataAsync(solutionChecksum, document.Id, span, cancellationToken),
GenerateConstructorFromMembers\AbstractGenerateConstructorFromMembersCodeRefactoringProvider.cs (1)
121return new IntentProcessorResult(applyChangesOperation.ChangedSolution, [priorDocument.Id], codeAction.Title, type.Name);
GenerateType\AbstractGenerateTypeService.Editor.cs (2)
446var updatedSolution = solution.WithDocumentSyntaxRoot(generateTypeOptionsResult.ExistingDocument.Id, newRoot, PreservationMode.PreserveIdentity); 453generateTypeOptionsResult.ExistingDocument.Id == _semanticDocument.Document.Id ? newRoot : null,
InheritanceMargin\AbstractInheritanceMarginService.cs (1)
47service.GetInheritanceMarginItemsAsync(solutionInfo, document.Id, spanToSearch, includeGlobalImports, frozenPartialSemantics, cancellationToken),
InitializeParameter\AbstractInitializeMemberFromParameterCodeRefactoringProviderMemberCreation.cs (3)
388var currentDocument = currentSolution.GetRequiredDocument(document.Id); 504otherDocument.Id, otherRoot.ReplaceNode(propertySyntax, withoutThrowNotImplemented)); 509return currentSolution.WithDocumentSyntaxRoot(document.Id, editor.GetChangedRoot());
InlineMethod\AbstractInlineMethodRefactoringProvider.cs (1)
359var callerDocumentEditor = await solutionEditor.GetDocumentEditorAsync(document.Id, cancellationToken).ConfigureAwait(false);
IntroduceParameter\IntroduceParameterDocumentRewriter.cs (4)
258if (currentDocument.Id == _originalDocument.Id) 524if (document.Id == _originalDocument.Id)
MetadataAsSource\DecompilationMetadataAsSourceFileProvider.cs (1)
347if (!_openedDocumentIds.TryGetKey(document.Id, out fileInfo))
MoveToNamespace\AbstractMoveToNamespaceService.cs (3)
231return new MoveToNamespaceResult(originalSolution, changedSolution, document.Id, newNameOriginalSymbolMapping); 255var modifiedDocument = modifiedSolution.GetDocument(document.Id); 261var mergedDocument = mergedSolution.GetDocument(document.Id);
NavigateTo\AbstractNavigateToSearchService.NormalSearch.cs (1)
38service.SearchDocumentAsync(solutionInfo, document.Id, searchPattern, [.. kinds], callbackId, cancellationToken),
NavigateTo\RoslynNavigateToItem.cs (1)
117_activeDocument = (activeDocument.Id, activeDocument.Folders);
Navigation\INavigableItem.cs (1)
59document.Id,
NavigationBar\AbstractNavigationBarItemService.cs (1)
28var documentId = document.Id;
RelatedDocuments\AbstractRelatedDocumentsService.cs (2)
53solutionChecksum, document.Id, position, callbackId, cancellationToken), 137var documentId = solution.GetDocument(syntaxReference.SyntaxTree)?.Id;
ReplaceMethodWithProperty\ReplaceMethodWithPropertyCodeRefactoringProvider.cs (5)
215if (originalDocument.Id.IsSourceGenerated) 226updatedSolution = updatedSolution.WithDocumentSyntaxRoot(originalDocument.Id, editor.GetChangedRoot()); 388if (setMethodDocument?.Id == documentId) 417if (getMethodDeclaration != null && updatedSolution.GetDocument(getMethodDeclaration.SyntaxTree)?.Id == documentId) 464result.Add(document.Id, definition);
ReplacePropertyWithMethods\ReplacePropertyWithMethodsCodeRefactoringProvider.cs (3)
234updatedSolution = updatedSolution.WithDocumentSyntaxRoot(originalDocument.Id, editor.GetChangedRoot()); 337result.Add(document.Id, definition); 412if (property != null && declaration != null && updatedSolution.GetDocument(declaration.SyntaxTree)?.Id == documentId)
SemanticSearch\SemanticSearchUtilities.cs (1)
79=> GetQueryDocumentId(document.Project.Solution) == document.Id;
src\Analyzers\Core\CodeFixes\MakeMethodAsynchronous\AbstractMakeMethodAsynchronousCodeFixProvider.cs (1)
172var newDocument = newSolution.GetRequiredDocument(document.Id);
src\Analyzers\Core\CodeFixes\MakeMethodSynchronous\AbstractMakeMethodSynchronousCodeFixProvider.cs (2)
84var newDocument = newSolution.GetRequiredDocument(document.Id); 183return currentSolution.WithDocumentSyntaxRoot(document.Id, newRoot);
TaskList\AbstractTaskListService.cs (1)
38(service, checksum, cancellationToken) => service.GetTaskListItemsAsync(checksum, document.Id, descriptors, cancellationToken),
UseAutoProperty\AbstractUseAutoPropertyCodeFixProvider.cs (1)
344canEditDocument = document != null && !linkedDocuments.Contains(document.Id);
ValueTracking\ValueTrackingService.cs (1)
40(service, solutionInfo, cancellationToken) => service.TrackValueSourceAsync(solutionInfo, selection, document.Id, cancellationToken),
Workspace\CompileTimeSolutionProvider.cs (1)
177var compileTimeDocument = await compileTimeSolution.GetDocumentAsync(designTimeDocument.Id, includeSourceGenerated: true, cancellationToken).ConfigureAwait(false);
Microsoft.CodeAnalysis.Features.Test.Utilities (4)
Diagnostics\TestDiagnosticAnalyzerDriver.cs (1)
52project.Solution, project.Id, document.Id, diagnosticIds: null, shouldIncludeAnalyzer: null,
EditAndContinue\EditAndContinueTestVerifier.cs (2)
460newSolution = newSolution.WithDocumentSyntaxRoot(oldDocument.Id, editScripts[documentIndex].Match.NewRoot, PreservationMode.PreserveIdentity); 529session.LastCommittedSolution.Test_SetDocumentState(document.Id, state);
Snippets\AbstractSnippetProviderTests.cs (1)
45document = editorConfigDoc.Project.GetDocument(document.Id)!;
Microsoft.CodeAnalysis.Features.UnitTests (20)
EditAndContinue\EditAndContinueWorkspaceServiceTests.cs (17)
211Assert.Equal(document1.Id, document2.Id); 249solution = solution.WithDocumentText(document1.Id, CreateText("dummy2")); 257var document2 = solution.GetDocument(document1.Id); 288solution = solution.WithDocumentText(document1.Id, CreateText(sourceV2)); 361solution = solution.WithDocumentText(document1.Id, CreateText("class E {}")); 588solution = solution.WithDocumentText(document1.Id, CreateText("class C1 { void M() { System.Console.WriteLine(2); } }")); 589var document2 = solution.GetDocument(document1.Id); 825solution = solution.WithDocumentText(document1.Id, CreateText(source2)); 875solution = solution.WithDocumentText(document1.Id, CreateText(source2)); 876var document2 = solution.GetDocument(document1.Id); 975solution = solution.WithDocumentText(document1.Id, CreateText(source2)); 976var document2 = solution.GetDocument(document1.Id); 1112solution = solution.WithDocumentText(document1.Id, CreateText(sourceV2)); 1347solution = solution.WithDocumentText(document1.Id, CreateText("class C1 { void M() { ")); 1387solution = solution.WithDocumentText(document1.Id, CreateText("class C1 { void M() { int i = 0L; System.Console.WriteLine(i); } }")); 1447solution = solution.WithDocumentText(documentC.Id, CreateText("class C { void M() { "));
EditAndContinue\EmitSolutionUpdateResultsTests.cs (3)
88DiagnosticDataLocation.TestAccessor.Create(new(sourcePath, new(0, 0), new(0, 5)), document.Id, new("a.razor", new(10, 10), new(10, 15)), forceMappedPath: true), 104DiagnosticDataLocation.TestAccessor.Create(new(sourcePath, new(0, 0), new(0, 5)), document.Id, new(@"..\a.razor", new(10, 10), new(10, 15)), forceMappedPath: true), 121new DiagnosticDataLocation(new(sourcePath, new(0, 1), new(0, 5)), document.Id),
Microsoft.CodeAnalysis.LanguageServer.Protocol (36)
Extensions\Extensions.cs (2)
96Contract.ThrowIfTrue(textDocument is not null && textDocument is not Document, $"{textDocument!.Id} is not a Document"); 160var documentIdInCurrentContext = solution.Workspace.GetDocumentIdInCurrentContext(documents.First().Id);
Features\CodeCleanup\AbstractCodeCleanupService.cs (4)
194return solution.GetDocument(document.Id) ?? throw new NotSupportedException(FeaturesResources.Removal_of_document_not_supported); 266projectChanges.GetChangedDocuments().Any(documentId => documentId != updatedDocument.Id) || 267projectChanges.GetChangedAdditionalDocuments().Any(documentId => documentId != updatedDocument.Id) || 268projectChanges.GetChangedAnalyzerConfigDocuments().Any(documentId => documentId != updatedDocument.Id));
Features\CodeFixes\CodeFixService.cs (1)
353return (TDocument)(solution.GetTextDocument(document.Id) ?? throw new NotSupportedException(FeaturesResources.Removal_of_document_not_supported));
Features\CodeFixes\CodeFixService.FixAllDiagnosticProvider.cs (1)
47var diagnostics = await _diagnosticService.GetDiagnosticsForIdsAsync(solution, projectId: null, document.Id, _diagnosticIds, shouldIncludeAnalyzer: null, _includeSuppressedDiagnostics, includeLocalDocumentDiagnostics: true, includeNonLocalDocumentDiagnostics: false, cancellationToken).ConfigureAwait(false);
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.Executor.cs (3)
269builder.AddExternalSyntaxDiagnostics(document.Id, await DocumentAnalysisExecutor.ComputeDocumentDiagnosticAnalyzerDiagnosticsAsync(documentAnalyzer, document, AnalysisKind.Syntax, compilation, cancellationToken).ConfigureAwait(false)); 270builder.AddExternalSemanticDiagnostics(document.Id, await DocumentAnalysisExecutor.ComputeDocumentDiagnosticAnalyzerDiagnosticsAsync(documentAnalyzer, document, AnalysisKind.Semantic, compilation, cancellationToken).ConfigureAwait(false)); 311lazyLoadDiagnostics.Add(document.Id, [DiagnosticData.Create(loadDiagnostic, document)]);
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.IncrementalMemberEditAnalyzer.cs (3)
126SaveMemberSpans(document.Id, version, newMemberSpans); 207|| lastDocument?.Id != document.Id)
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.IncrementalMemberEditAnalyzer_MemberSpans.cs (2)
32if (_savedMemberSpans.DocumentId == document.Id && _savedMemberSpans.Version == version) 40_savedMemberSpans = new MemberSpans(document.Id, version, memberSpans);
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.ProjectState.cs (5)
136if (IsEmpty(lastResult, document.Id)) 252Contract.ThrowIfFalse(state.DocumentId == document.Id); 287AddToInMemoryStorage(serializerVersion, project, document, document.Id, SyntaxStateName, syntax.Items); 288AddToInMemoryStorage(serializerVersion, project, document, document.Id, SemanticStateName, semantic.Items); 370var documentId = document.Id;
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.StateSet.cs (6)
108projectState.IsEmpty(document.Id)) 118var activeFileState = GetOrCreateActiveFileState(document.Id); 120activeFileState.Save(AnalysisKind.Syntax, new DocumentAnalysisData(result.Version, text.Lines.Count, result.GetDocumentDiagnostics(document.Id, AnalysisKind.Syntax))); 121activeFileState.Save(AnalysisKind.Semantic, new DocumentAnalysisData(result.Version, text.Lines.Count, result.GetDocumentDiagnostics(document.Id, AnalysisKind.Semantic))); 130if (!_activeFileStates.TryRemove(document.Id, out var activeFileState)) 146if (TryGetActiveFileState(document.Id, out var activeFileState))
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs (2)
226var state = stateSet.GetOrCreateActiveFileState(_document.Id); 532return diagnostic.DocumentId == _document.Id &&
Features\EditAndContinue\EditAndContinueDiagnosticSource_OpenDocument.cs (1)
37var applyDiagnostics = sessionStateTracker.ApplyChangesDiagnostics.WhereAsArray(static (data, id) => data.DocumentId == id, designTimeDocument.Id);
Handler\CodeLens\CodeLensResolveHandler.cs (1)
68var referenceCount = await codeLensReferencesService.GetReferenceCountAsync(document.Project.Solution, document.Id, memberToResolve.Node, maxSearchResults: 99, cancellationToken).ConfigureAwait(false);
Handler\Diagnostics\AbstractPullDiagnosticHandler.cs (2)
255return new ProjectOrDocumentId(document.Id); 267return new ProjectOrDocumentId(additionalDocument.Id);
Handler\Highlights\DocumentHighlightHandler.cs (1)
104var highlightsForDocument = highlights.FirstOrDefault(h => h.Document.Id == document.Id);
Handler\SourceGenerators\SourceGeneratedDocumentGetTextHandler.cs (1)
41document = await document.Project.Solution.WithoutFrozenSourceGeneratedDocuments().GetDocumentAsync(document.Id, includeSourceGenerated: true, cancellationToken).ConfigureAwait(false);
Handler\SpellCheck\AbstractSpellCheckingHandler.cs (1)
105new ProjectOrDocumentId(document.Id),
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (1)
Diagnostics\PullDiagnosticTests.cs (1)
1290location: new DiagnosticDataLocation(new FileLinePositionSpan("file", span: default), document?.Id),
Microsoft.CodeAnalysis.Remote.ServiceHub (14)
Host\RemoteWorkspace.SolutionCreator.cs (12)
556assetPath: document.Id, newDocumentChecksums.textChecksum, cancellationToken).ConfigureAwait(false); 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), 575assetPath: document.Id, infoChecksum, cancellationToken).ConfigureAwait(false); 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\DiagnosticAnalyzer\DiagnosticComputer.cs (1)
141document = project.GetTextDocument(document.Id);
Services\SymbolFinder\RemoteSymbolFinderService.cs (1)
191=> _callback.InvokeAsync((callback, cancellationToken) => callback.OnLiteralReferenceFoundAsync(_callbackId, document.Id, span, cancellationToken), cancellationToken);
Microsoft.CodeAnalysis.TestAnalyzerReference (2)
NonSourceFileRefactoring.cs (2)
30return document.Project.Solution.WithAdditionalDocumentText(document.Id, newText); 31return document.Project.Solution.WithAnalyzerConfigDocumentText(document.Id, newText);
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures (1)
LineCommit\CommitCommandHandler.vb (1)
244If formattingRuleService.ShouldNotFormatOrCommitOnPaste(document.Id) Then
Microsoft.CodeAnalysis.VisualBasic.Features (1)
GenerateType\VisualBasicGenerateTypeService.vb (1)
671updatedSolution = updatedSolution.WithDocumentSyntaxRoot(document.Id, addedCompilationRoot, PreservationMode.PreserveIdentity)
Microsoft.CodeAnalysis.Workspaces (81)
Classification\AbstractClassificationService.cs (1)
93solutionInfo, document.Id, textSpans, type, options, isFullyLoaded, cancellationToken),
Classification\SemanticClassificationCacheUtilities.cs (1)
24var documentKey = new DocumentKey(projectKey, document.Id, document.FilePath, document.Name);
CodeActions\CodeAction_Cleanup.cs (2)
113[(document.Id, options)], 117return cleanedSolution.GetRequiredDocument(document.Id);
CodeFixes\FixAllOccurrences\BatchFixAllProvider.cs (1)
208foreach (var group in allChangedDocumentsInDiagnosticsOrder.GroupBy(d => d.Id))
CodeFixes\FixAllOccurrences\TextChangeMerger.cs (2)
45Debug.Assert(newDocument.Id == _oldDocument.Id);
CodeFixesAndRefactorings\DocumentBasedFixAllProviderHelpers.cs (1)
92callback((newDocument.Id, (newRoot, newText)));
Diagnostics\DiagnosticAnalysisResultBuilder.cs (2)
105map.GetOrAdd(document.Id, _ => []).Add(DiagnosticData.Create(diagnostic, document)); 108_lazyDocumentsWithDiagnostics.Add(document.Id);
Diagnostics\DiagnosticData.cs (2)
172return new DiagnosticDataLocation(originalLineInfo, document?.Id, mappedLineInfo); 179diagnosticSpanMappingService.GetAdjustedDiagnosticSpan(document.Id, location, out _, out originalLineInfo, out mappedLineInfo);
Diagnostics\Extensions.cs (1)
163tree: null, documentAnalysisScope.TextDocument.Id, spanToAnalyze, AnalysisKind.Syntax, diagnosticIdsToFilter, includeSuppressedDiagnostics);
Editing\SymbolEditor.cs (3)
332return EditOneDeclarationAsync(symbol, doc.Id, location.SourceSpan.Start, editAction, cancellationToken); 377return doc != null && doc.Id == documentId && d.FullSpan.IntersectsWith(position); 463var declsByDocId = this.GetDeclarations(currentSymbol).ToLookup(d => ChangedSolution.GetDocument(d.SyntaxTree).Id);
FindSymbols\ReferenceLocation.cs (3)
118EqualityComparer<DocumentId>.Default.Equals(this.Document.Id, other.Document.Id) && 129Hash.Combine(this.Location, this.Document.Id.GetHashCode()))));
FindSymbols\SymbolFinder_FindReferences_Current.cs (1)
51var documentIds = documents?.SelectAsArray(d => d.Id) ?? default;
LinkedFileDiffMerging\LinkedFileDiffMergingSession.cs (6)
30var relatedDocumentIds = newSolution.GetRelatedDocumentIds(newDocument.Id); 60var relatedDocuments = newSolution.GetRelatedDocumentIds(firstNewDocument.Id); 102var firstOldDocument = oldSolution.GetRequiredDocument(firstNewDocument.Id); 112var siblingOldDocument = oldSolution.GetRequiredDocument(siblingNewDocument.Id); 123var linkedDocuments = oldSolution.GetRelatedDocumentIds(firstOldDocument.Id); 203oldDocument.Id));
Remote\RemoteArguments.cs (1)
163referenceLocation.Document.Id,
Rename\ConflictEngine\ConflictResolver.cs (4)
193implicitUsageConflict.SourceSpan, conflictResolution.OldSolution.GetRequiredDocument(implicitUsageConflict.SourceTree).Id, RelatedLocationType.UnresolvableConflict)); 217implicitConflict.SourceSpan, conflictResolution.OldSolution.GetRequiredDocument(implicitConflict.SourceTree).Id, RelatedLocationType.UnresolvableConflict)); 310languageConflict.SourceSpan, conflictResolution.OldSolution.GetRequiredDocument(languageConflict.SourceTree).Id, RelatedLocationType.UnresolvableConflict)); 337oldLocation.SourceSpan, conflictResolution.OldSolution.GetRequiredDocument(oldLocation.SourceTree).Id, RelatedLocationType.UnresolvableConflict));
Rename\ConflictEngine\ConflictResolver.Session.cs (5)
67_documentIdOfRenameSymbolDeclaration = renameLocationSet.Solution.GetRequiredDocument(renameSymbolDeclarationLocation.SourceTree!).Id; 740if (documentIds.Contains(document.Id)) 749documentIds.Add(document.Id); 755documentIds.Add(document.Id); 763documentIds.Add(document.Id);
Rename\ConflictEngine\MutableConflictResolution.cs (1)
126_renamedDocument = (document.Id, newName);
Rename\Renamer.cs (2)
112return new RenameDocumentActionSet([], document.Id, document.Name, [.. document.Folders], options); 134document.Id,
Rename\Renamer.RenameDocumentActionSet.cs (1)
92var documentId = document.Id;
Rename\RenameUtilities.cs (1)
94.Concat(documentsOfRenameSymbolDeclaration.First().Id)
Rename\SymbolicRenameLocations.ReferenceProcessing.cs (8)
240results.Add(new RenameLocation(location, document.Id, isRenamableAccessor: isRenamableAccessor)); 268results.Add(new RenameLocation(location, location.Document.Id)); 274results.Add(new RenameLocation(aliasLocation, solution.GetRequiredDocument(aliasLocation.SourceTree).Id)); 287results.Add(new RenameLocation(location.Location, location.Document.Id, 293results.Add(new RenameLocation(aliasLocation, solution.GetRequiredDocument(aliasLocation.SourceTree).Id)); 301location.Document.Id, 309location.Document.Id, 424var renameLocation = new RenameLocation(matchLocation, document.Id, containingLocationForStringOrComment: containingSpan);
Shared\Extensions\DocumentExtensions.cs (1)
26=> document.Project.Solution.WithOptions(options).GetRequiredDocument(document.Id);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
99return workspace != null && workspace.IsDocumentOpen(document.Id);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\TextDocumentExtensions.cs (4)
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\Utilities\ParsedDocument.cs (2)
39return new ParsedDocument(document.Id, text, root, document.Project.GetExtendedLanguageServices()); 47return new ParsedDocument(document.Id, text, root, document.Project.GetExtendedLanguageServices());
Workspace\Solution\Document.cs (19)
333this.Project.Solution.OnSemanticModelObtained(this.Id, semanticModel); 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); 432if (this.Id != oldDocument.Id) 486var filteredDocumentIds = this.Project.Solution.GetRelatedDocumentIds(this.Id); 487return filteredDocumentIds.Remove(this.Id); 528var newSolution = this.Project.Solution.WithFrozenPartialCompilationIncludingSpecificDocument(this.Id, cancellationToken); 529return newSolution.GetRequiredDocument(this.Id);
Workspace\Workspace.cs (2)
1607ApplyDocumentInfoChanged(newDoc.Id, 2015doc.Id,
Workspace\Workspace_Editor.cs (3)
471CheckDocumentIsOpen(document.Id); 473Contract.ThrowIfFalse(_openSourceGeneratedDocumentIdentities.Remove(document.Id)); 474ClearOpenDocument(document.Id);
Microsoft.CodeAnalysis.Workspaces.MSBuild (3)
MSBuild\MSBuildWorkspace.cs (3)
394_reporter.Report(new DocumentDiagnostic(WorkspaceDiagnosticKind.Failure, message, document.Id)); 412_reporter.Report(new DocumentDiagnostic(WorkspaceDiagnosticKind.Failure, message, document.Id)); 517this.DeleteDocumentFile(document.Id, document.FilePath);
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (12)
VisualStudioMSBuildWorkspaceTests.cs (12)
398var solution1 = solution.WithDocumentText(document.Id, SourceText.From("using test;")); 399var document1 = solution1.GetDocument(document.Id); 412var document2 = solution2.GetDocument(document.Id); 2058workspace.TryApplyChanges(solution.WithDocumentText(document.Id, newText, PreservationMode.PreserveIdentity)); 2091workspace.RemoveDocument(document.Id); 2118var newSolution = solution.WithDocumentText(document.Id, newText); 2124var document2 = solution2.GetDocument(document.Id); 2145var newSolution = solution.WithAdditionalDocumentText(document.Id, newText); 2151var document2 = solution2.GetAdditionalDocument(document.Id); 2216workspace.TryApplyChanges(workspace.CurrentSolution.RemoveAdditionalDocument(xaml.Id)); 2242workspace.TryApplyChanges(workspace.CurrentSolution.WithDocumentText(doc.Id, SourceText.From(newText), PreservationMode.PreserveIdentity)); 2276doc.Id,
Microsoft.CodeAnalysis.Workspaces.UnitTests (44)
Formatter\FormatterTests.cs (3)
78document = document.Project.Solution.WithOptions(solutionOptions).GetRequiredDocument(document.Id); 128var csDocumentWithUpdatedOptions = solutionWithUpdatedOptions.GetRequiredDocument(csDocument.Id); 129var vbDocumentWithUpdatedOptions = solutionWithUpdatedOptions.GetRequiredDocument(vbDocument.Id);
Simplifier\SimplifierTests.cs (2)
91var csDocumentWithUpdatedOptions = solutionWithUpdatedOptions.GetRequiredDocument(csDocument.Id); 92var vbDocumentWithUpdatedOptions = solutionWithUpdatedOptions.GetRequiredDocument(vbDocument.Id);
SolutionTests\SolutionTests.cs (21)
3694var doc2 = doc.Project.Solution.WithDocumentSyntaxRoot(doc.Id, newRoot, PreservationMode.PreserveValue).GetDocument(doc.Id); 4133var solution = project.Solution.WithDocumentText(documentToFreezeOriginal.Id, SourceText.From("class DocumentToFreeze { void M() { /*no top level change*/ } }")); 4134var documentToFreezeChanged = solution.GetDocument(documentToFreezeOriginal.Id); 4178var solution = project.Solution.WithDocumentText(documentToFreezeOriginal.Id, SourceText.From("class DocumentToFreeze { void M() { } public void NewMethod() { } }")); 4179var documentToFreezeChanged = solution.GetDocument(documentToFreezeOriginal.Id); 4419var relatedIds1 = currentSolution.GetRelatedDocumentIds(document1.Id); 4420var relatedIds2 = currentSolution.GetRelatedDocumentIds(document2.Id); 4421AssertEx.SetEqual(relatedIds1, ImmutableArray.Create(document1.Id, document2.Id)); 4422AssertEx.SetEqual(relatedIds2, ImmutableArray.Create(document1.Id, document2.Id)); 4424document1 = currentSolution.GetRequiredDocument(document1.Id); 4425document2 = currentSolution.GetRequiredDocument(document2.Id); 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), 5715var forkedProject1 = frozenSolution.WithDocumentText(project1.Documents.Single().Id, SourceText.From("class Doc2 { }")).GetProject(project1.Id); 5754var forkedProject1 = frozenSolution.WithDocumentText(project1.Documents.Single().Id, SourceText.From("class Doc2 { }")).GetProject(project1.Id);
SolutionTests\SolutionWithSourceGeneratorTests.cs (5)
380Assert.Equal(generatedDocumentBeforeChange.Id, generatedDocumentAfterChange.Id); 642workspace.OnAdditionalDocumentRemoved(originalAdditionalFile.Id); 819var documentIdsToTest = new[] { originalDocument1.Id, originalDocument2.Id };
SymbolKeyTests.cs (2)
877document = workspace.CurrentSolution.GetDocument(document.Id); 924document = workspace.CurrentSolution.GetDocument(document.Id);
WorkspaceTests\AdhocWorkspaceTests.cs (11)
378var docid1 = ws.AddDocument(projid, "A.cs", SourceText.From("public class A { }")).Id; 379var docid2 = ws.AddDocument(projid, "B.cs", SourceText.From("public class B { }")).Id; 426&& args.DocumentId == originalDoc.Id) 434var appliedDoc = ws.CurrentSolution.GetDocument(originalDoc.Id); 459&& args.DocumentId == originalDoc.Id) 467var appliedDoc = ws.CurrentSolution.GetDocument(originalDoc.Id); 493&& args.DocumentId == originalDoc.Id) 501var appliedDoc = ws.CurrentSolution.GetDocument(originalDoc.Id); 524&& args.DocumentId == originalDoc.Id) 532var appliedDoc = ws.CurrentSolution.GetDocument(originalDoc.Id); 562var appliedDoc = ws.CurrentSolution.GetDocument(originalDoc.Id);
Microsoft.Interop.ComInterfaceGenerator (1)
src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (1)
140ct => ApplyActionAndEnableUnsafe(doc.Project.Solution, doc.Id, fix.ApplyFix, ct),
Microsoft.Interop.LibraryImportGenerator (3)
Analyzers\ConvertToLibraryImportFixer.cs (2)
286if (!location.Document.Id.Equals(document.Id))
src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (1)
140ct => ApplyActionAndEnableUnsafe(doc.Project.Solution, doc.Id, fix.ApplyFix, ct),
Microsoft.VisualStudio.LanguageServices (43)
CallHierarchy\CallHierarchyDetail.cs (1)
77_provider.ThreadingContext, _workspace, document.Id, _span,
CodeLens\CodeLensCallbackListener.cs (1)
165return (document.Id, root.FindNode(textSpan));
DebuggerIntelliSense\AbstractDebuggerIntelliSenseContext.cs (2)
172var forkedSolution = solution.WithDocumentText(document.Id, _projectionBuffer.CurrentSnapshot.AsText(), PreservationMode.PreserveIdentity); 181_workspace.OpenDocument(document.Id, _projectionBuffer.AsTextContainer());
Implementation\VisualStudioSupportsFeatureService.cs (5)
91=> SupportsCodeFixesWorker(document.Id); 94=> SupportsRefactoringsWorker(document.Id); 97=> SupportsRenameWorker(document.Project.Solution.GetRelatedDocumentIds(document.Id)); 100=> SupportsSemanticSnippetsWorker(document.Id); 103=> SupportsNavigationToAnyPositionWorker(document.Id);
LanguageService\AbstractLanguageService`2.IVsLanguageTextOps.cs (1)
78var formattedChanges = ruleFactory.FilterFormattedChanges(document.Id, originalSpan, originalChanges);
LanguageService\AbstractLanguageService`2.VsLanguageDebugInfo.cs (2)
235var filePath = _languageService.Workspace.GetFilePath(document.Id); 241_threadingContext, document.Id, cancellationToken).ConfigureAwait(false);
NavigateTo\VisualStudioNavigateToPreviewService.cs (1)
30=> ContainedDocument.TryGetContainedDocument(document.Id) == null;
Preview\FileChange.cs (5)
50this.Id = left != null ? left.Id : right.Id; 97return GetChangeList(diff, right.Id, oldText, newText); 130var entireSpanChild = new SpanChange(entireSpan, _buffer, document.Id, displayText, text, text, isDeletion: false, parent: this, engine: engine); 226if (vsWorkspace.TryGetImageListAndIndex(_imageService, document.Id, out pData[0].hImageList, out pData[0].Image))
Preview\PreviewUpdater.cs (3)
54if (document.Id == _currentDocumentId) 75_currentDocumentId = document.Id; 77_previewWorkspace.OpenDocument(document.Id, container);
Preview\PreviewUpdater.PreviewDialogWorkspace.cs (3)
30OnDocumentClosed(document.Id, new PreviewTextLoader(text)); 34OnAnalyzerConfigDocumentClosed(document.Id, new PreviewTextLoader(text)); 38OnAdditionalDocumentClosed(document.Id, new PreviewTextLoader(text));
Preview\TopLevelChange.cs (6)
81ApplyFileChangesCore(oldTextDocument, updatedTextDocument?.Id, updatedDocumentTextOpt, 92var newLinkedDocumentIdOpt = updatedDocumentTextOpt != null ? oldLinkedDocument.Id : null; 157solution = solution.AddDocument(oldDocument.Id, oldDocument.Name, oldText, oldDocument.Folders, oldDocument.FilePath); 161solution = solution.AddAnalyzerConfigDocument(oldDocument.Id, oldDocument.Name, SourceText.From(oldText), oldDocument.Folders, oldDocument.FilePath); 165solution = solution.AddAdditionalDocument(oldDocument.Id, oldDocument.Name, oldText, oldDocument.Folders, oldDocument.FilePath); 175Debug.Assert(oldDocument.Id == updatedDocumentIdOpt);
Progression\GraphBuilder.cs (1)
230node[RoslynGraphProperties.ContextDocumentId] = contextDocument.Id;
ProjectSystem\VisualStudioWorkspaceImpl.cs (2)
1294if (document.Id != updatedInfo.Id) 1297$"This Workspace does not support changing a document's {nameof(document.Id)}.");
Snippets\AbstractSnippetExpansionLanguageHelper.cs (1)
50var containedDocument = ContainedDocument.TryGetContainedDocument(document.Id);
StackTraceExplorer\StackFrameViewModel.cs (1)
135_threadingContext, _workspace, document.Id, lineNumber - 1, offset: 0, options, cancellationToken).ConfigureAwait(false);
TableDataSource\Suppression\VisualStudioDiagnosticListSuppressionStateService.cs (1)
268new FileLinePositionSpan(filePath, linePositionSpan), document.Id);
Venus\ContainedDocument.cs (3)
188return document.Id; 200if (document.Id == this.Id) 205return hierarchy.TryGetItemId(_workspace.CurrentSolution.GetDocument(document.Id).FilePath);
Workspace\SourceGeneratedFileManager.cs (3)
112if (!_directoryInfoOnDiskByContainingDirectoryId.ContainsKey(document.Id.Id)) 114_directoryInfoOnDiskByContainingDirectoryId.Add(document.Id.Id, document.Identity); 121document.Id.Id.ToString(),
Workspace\VisualStudioSymbolNavigationService.cs (1)
71solution.Workspace, targetDocument.Id, sourceLocation.SourceSpan.Start, cancellationToken).ConfigureAwait(false);
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (1)
CodeModel\FileCodeModelTestHelpers.cs (1)
36var document = project.Documents.Single().Id;
Microsoft.VisualStudio.LanguageServices.LiveShare (2)
Client\RemoteLanguageServiceWorkspace.cs (2)
220OnDocumentOpened(document.Id, textContainer); 221_openedDocs = _openedDocs.SetItem(moniker, document.Id);
Microsoft.VisualStudio.LanguageServices.UnitTests (5)
Venus\DocumentService_IntegrationTests.vb (5)
148Dim results = Await codelensService.FindReferenceLocationsAsync(workspace.CurrentSolution, startDocument.Id, node, CancellationToken.None) 201Dim currentDocument = workspace.CurrentSolution.GetDocument(document.Id) 242workspace.CurrentSolution, projectId:=Nothing, documentId:=document.Id, diagnosticIds:=Nothing, shouldIncludeAnalyzer:=Nothing, 274Dim testDocument = testWorkspace.GetTestDocument(document.Id) 312Dim testDocument = testWorkspace.GetTestDocument(document.Id)
Microsoft.VisualStudio.LanguageServices.VisualBasic (4)
Venus\ContainedLanguageStaticEventBinding.vb (4)
74Using visualStudioWorkspace.OpenInvisibleEditor(targetDocument.Id) 75targetDocument = visualStudioWorkspace.CurrentSolution.GetDocument(targetDocument.Id) 102Using visualStudioWorkspace.OpenInvisibleEditor(targetDocument.Id) 103targetDocument = visualStudioWorkspace.CurrentSolution.GetDocument(targetDocument.Id)
Microsoft.VisualStudio.LanguageServices.Xaml (1)
Implementation\LanguageServer\Handler\Completion\CompletionHandler.cs (1)
77Items = completionResult.Completions.Select(c => CreateCompletionItem(c, document.Id, text, request.Position, request.TextDocument, commitCharactersCache)).ToArray(),
Roslyn.VisualStudio.DiagnosticsWindow (1)
Panels\WorkspacePanel.xaml.cs (1)
84where !workspace.IsDocumentOpen(document.Id)
Roslyn.VisualStudio.Next.UnitTests (15)
Remote\RemoteHostClientServiceFactoryTests.cs (1)
52var newSolution = document.Project.Solution.WithDocumentText(document.Id, newText, PreservationMode.PreserveIdentity);
Services\ServiceHubServicesTests.cs (3)
94(service, cancellationToken) => service.SynchronizeTextAsync(oldDocument.Id, oldState.Text, newText.GetTextChanges(oldText).AsImmutable(), cancellationToken), 146var priorityDocumentId = solution.Projects.Single().Documents.Single().Id; 158Assert.Equal(solution.Projects.Single().Documents.Single().Id, info.DocumentId);
Services\SolutionServiceTests.cs (11)
296await VerifySolutionUpdate(code, s => s.WithDocumentFolders(s.Projects.First().Documents.First().Id, ["test"])); 1074var objectReference2 = ObjectReference.CreateFromFactory(() => syncedSolution.GetRequiredDocument(document1.Id).GetSemanticModelAsync().GetAwaiter().GetResult()); 1097remoteDocumentTrackingService.SetActiveDocument(document1.Id); 1103var objectReference2 = ObjectReference.CreateFromFactory(() => syncedSolution.GetRequiredDocument(document1.Id).GetSemanticModelAsync().GetAwaiter().GetResult()); 1137var objectReference2 = ObjectReference.CreateFromFactory(() => syncedSolution.GetRequiredDocument(document1.Id).GetSemanticModelAsync().GetAwaiter().GetResult()); 1171documentTrackingService.SetActiveDocument(document1.Id); 1191var oopDocumentReference1_step1 = ObjectReference.CreateFromFactory(() => syncedSolution.GetRequiredDocument(document1.Id).GetSemanticModelAsync().GetAwaiter().GetResult()); 1192var oopDocumentReference2_step1 = ObjectReference.CreateFromFactory(() => syncedSolution.GetRequiredDocument(document2.Id).GetSemanticModelAsync().GetAwaiter().GetResult()); 1197documentTrackingService.SetActiveDocument(document2.Id); 1210var oopDocumentReference1_step2 = ObjectReference.CreateFromFactory(() => syncedSolution.GetRequiredDocument(document1.Id).GetSemanticModelAsync().GetAwaiter().GetResult()); 1211var oopDocumentReference2_step2 = ObjectReference.CreateFromFactory(() => syncedSolution.GetRequiredDocument(document2.Id).GetSemanticModelAsync().GetAwaiter().GetResult());