3 types derived from TextDocument
Microsoft.CodeAnalysis.Workspaces (3)
Workspace\Solution\AdditionalDocument.cs (1)
10public sealed class AdditionalDocument : TextDocument
Workspace\Solution\AnalyzerConfigDocument.cs (1)
7public sealed class AnalyzerConfigDocument : TextDocument
Workspace\Solution\Document.cs (1)
28public class Document : TextDocument
365 references to TextDocument
Microsoft.CodeAnalysis.CodeStyle.Fixes (12)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
96public static bool IsOpen(this TextDocument document)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ISolutionExtensions.cs (4)
32public static TextDocument? GetTextDocument(this Solution solution, DocumentId? documentId) 73public static TextDocument GetRequiredAdditionalDocument(this Solution solution, DocumentId documentId) 76public static TextDocument GetRequiredAnalyzerConfigDocument(this Solution solution, DocumentId documentId) 79public static TextDocument GetRequiredTextDocument(this Solution solution, DocumentId documentId)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\TextDocumentExtensions.cs (7)
15public static ValueTask<SourceText> GetValueTextAsync(this TextDocument document, CancellationToken cancellationToken) 27public static TextDocument WithText(this TextDocument textDocument, SourceText text) 48public static TextDocument WithAdditionalDocumentText(this TextDocument textDocument, SourceText text) 57public static TextDocument WithAnalyzerConfigDocumentText(this TextDocument textDocument, SourceText text)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (5)
Workspaces\WorkspaceTests_EditorFeatures.cs (5)
1062var additionalDocument = project.GetAdditionalDocument(additionalDoc.Id); 1122var doc = workspace.CurrentSolution.GetAdditionalDocument(additionalDoc.Id); 1239var doc = workspace.CurrentSolution.GetAdditionalDocument(additionalDoc.Id); 1309var doc = project.AddAdditionalDocument("app.config", "text"); 1337var doc = project.AddAnalyzerConfigDocument("app.config", SourceText.From("text"));
Microsoft.CodeAnalysis.EditorFeatures (24)
CodeActions\CodeActionEditHandlerService.cs (1)
186private static TextDocument? TryGetSingleChangedText(
EditAndContinue\ActiveStatementTrackingService.cs (4)
96public ValueTask<ImmutableArray<ActiveStatementTrackingSpan>> GetAdjustedTrackingSpansAsync(TextDocument document, ITextSnapshot snapshot, CancellationToken cancellationToken) 213using var _ = ArrayBuilder<TextDocument?>.GetInstance(out var documents); 297private static bool TryGetSnapshot(TextDocument document, [NotNullWhen(true)] out ITextSnapshot? snapshot) 343internal async ValueTask<ImmutableArray<ActiveStatementTrackingSpan>> GetAdjustedTrackingSpansAsync(TextDocument document, ITextSnapshot snapshot, CancellationToken cancellationToken)
EditAndContinue\IActiveStatementTrackingService.cs (1)
28ValueTask<ImmutableArray<ActiveStatementTrackingSpan>> GetAdjustedTrackingSpansAsync(TextDocument document, ITextSnapshot snapshot, CancellationToken cancellationToken);
Preview\AbstractPreviewFactoryService.cs (18)
252private async ValueTask<IDifferenceViewerPreview<TDifferenceViewer>> CreateAddedDocumentPreviewViewCoreAsync(ITextDocument newEditorDocument, ReferenceCountedDisposable<PreviewWorkspace> workspace, TextDocument document, double zoomLevel, CancellationToken cancellationToken) 278where TDocument : TextDocument 305public Task<IDifferenceViewerPreview<TDifferenceViewer>> CreateAddedAdditionalDocumentPreviewViewAsync(TextDocument document, double zoomLevel, CancellationToken cancellationToken) 313public Task<IDifferenceViewerPreview<TDifferenceViewer>> CreateAddedAnalyzerConfigDocumentPreviewViewAsync(TextDocument document, double zoomLevel, CancellationToken cancellationToken) 324private async ValueTask<IDifferenceViewerPreview<TDifferenceViewer>> CreateRemovedDocumentPreviewViewCoreAsync(ITextDocument oldEditorDocument, ReferenceCountedDisposable<PreviewWorkspace> workspace, TextDocument document, double zoomLevel, CancellationToken cancellationToken) 350where TDocument : TextDocument 387public Task<IDifferenceViewerPreview<TDifferenceViewer>> CreateRemovedAdditionalDocumentPreviewViewAsync(TextDocument document, double zoomLevel, CancellationToken cancellationToken) 395public Task<IDifferenceViewerPreview<TDifferenceViewer>> CreateRemovedAnalyzerConfigDocumentPreviewViewAsync(TextDocument document, double zoomLevel, CancellationToken cancellationToken) 511TextDocument oldDocument, 512TextDocument newDocument, 566public Task<IDifferenceViewerPreview<TDifferenceViewer>?> CreateChangedAdditionalDocumentPreviewViewAsync(TextDocument oldDocument, TextDocument newDocument, double zoomLevel, CancellationToken cancellationToken) 572public Task<IDifferenceViewerPreview<TDifferenceViewer>?> CreateChangedAnalyzerConfigDocumentPreviewViewAsync(TextDocument oldDocument, TextDocument newDocument, double zoomLevel, CancellationToken cancellationToken) 640private async ValueTask<ITextDocument> CreateNewPlainTextBufferAsync(TextDocument document, CancellationToken cancellationToken) 652private async ValueTask<ITextDocument> CreateTextBufferCoreAsync(TextDocument document, IContentType contentType, CancellationToken cancellationToken) 789private IHierarchicalDifferenceCollection ComputeEditDifferences(TextDocument oldDocument, TextDocument newDocument, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (1)
Diagnostics\MockDiagnosticAnalyzerService.cs (1)
67public Task<ImmutableArray<DiagnosticData>> GetDiagnosticsForSpanAsync(TextDocument document, TextSpan? range, Func<string, bool>? shouldIncludeDiagnostic, bool includeCompilerDiagnostics, bool includeSuppressedDiagnostics, ICodeActionRequestPriorityProvider priorityProvider, DiagnosticKind diagnosticKind, bool isExplicit, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.EditorFeatures.Text (1)
Extensions.cs (1)
79internal static TextDocument? GetOpenTextDocumentInCurrentContextWithChanges(this ITextSnapshot text)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (21)
CodeFixes\CodeFixServiceTests.cs (13)
83GetDocumentAndExtensionManager(tuple.analyzerService, workspace, out var document, out var extensionManager, analyzerReference); 109GetDocumentAndExtensionManager(tuple.analyzerService, workspace, out var document, out var extensionManager, analyzerReference); 140GetDocumentAndExtensionManager(tuple.analyzerService, workspace, out var document, out var extensionManager, analyzerReference); 176GetDocumentAndExtensionManager(tuple.analyzerService, workspace, out var document, out var extensionManager, analyzerReference); 206GetDocumentAndExtensionManager(tuple.analyzerService, workspace, out var document, out var extensionManager, analyzerReference); 292GetDocumentAndExtensionManager(tuple.analyzerService, workspace, out var document, out var extensionManager); 319GetDocumentAndExtensionManager(tuple.analyzerService, workspace, out var document, out var extensionManager); 379out TextDocument document, 388out TextDocument document, 883GetDocumentAndExtensionManager(tuple.analyzerService, workspace, out var txtDocument, out var extensionManager, analyzerReference, documentKind: TextDocumentKind.AdditionalDocument); 900GetDocumentAndExtensionManager(tuple.analyzerService, workspace2, out var logDocument, out extensionManager, analyzerReference, documentKind: TextDocumentKind.AdditionalDocument); 947var document = context.TextDocument; 1037GetDocumentAndExtensionManager(tuple.analyzerService, workspace, out var document,
CodeRefactorings\CodeRefactoringServiceTest.cs (3)
171var txtAdditionalDocument = project.AdditionalDocuments.Single(t => t.Name == "test.txt"); 186var logAdditionalDocument = project.AdditionalDocuments.Single(t => t.Name == "test.log"); 244var document = context.TextDocument;
Diagnostics\DiagnosticAnalyzerServiceTests.cs (4)
451var firstAdditionalDocument = project.AdditionalDocuments.FirstOrDefault(); 464foreach (var additionalDoc in project.AdditionalDocuments) 753var additionalDocument = project.AdditionalDocuments.Single(); 772var documentToAnalyze = kind == FilterSpanTestAnalyzer.AnalysisKind.AdditionalFile ? additionalDocument : document;
Diagnostics\DiagnosticDataTests.cs (1)
139var additionalDocument = workspace.CurrentSolution.AddProject("TestProject", "TestProject", LanguageNames.CSharp)
Microsoft.CodeAnalysis.EditorFeatures.Wpf (8)
Suggestions\SuggestedActions\CodeFixSuggestedAction.cs (1)
29TextDocument originalDocument,
Suggestions\SuggestedActions\CodeRefactoringSuggestedAction.cs (1)
27TextDocument originalDocument,
Suggestions\SuggestedActionsSource.cs (2)
218TextDocument document, 272TextDocument document,
Suggestions\SuggestedActionsSource_Async.cs (2)
201TextDocument document, 279SuggestedActionSet? ConvertToSuggestedActionSet(UnifiedSuggestedActionSet? unifiedSuggestedActionSet, TextDocument originalDocument)
Suggestions\SuggestedActionWithNestedFlavors.cs (2)
38public TextDocument OriginalDocument { get; } 44TextDocument originalDocument,
Microsoft.CodeAnalysis.ExternalAccess.Razor (4)
Cohost\RazorCohostRequestContext.cs (1)
20internal TextDocument? TextDocument => context.TextDocument;
SolutionExtensions.cs (1)
12public static ImmutableArray<TextDocument> GetTextDocuments(this Solution solution, Uri documentUri)
TextDocumentExtensions.cs (2)
14public static Uri CreateUri(this TextDocument document) 17public static async Task<ChecksumWrapper> GetChecksumAsync(this TextDocument document, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.ExternalAccess.Xaml (5)
External\ConversionHelpers.cs (1)
19public static (string content, bool isMarkdown) CreateMarkdownContent(TextDocument document, QuickInfoItem info, XamlRequestContext context)
External\ILocationService.cs (1)
24Task<FileLinePositionSpan?> GetLocationAsync(TextDocument document, TextSpan textSpan, CancellationToken cancellationToken);
External\XamlRequestContext.cs (1)
25public readonly TextDocument? TextDocument => _context.TextDocument;
Internal\LocationService.cs (1)
33public async Task<FileLinePositionSpan?> GetLocationAsync(TextDocument document, TextSpan textSpan, CancellationToken cancellationToken)
Internal\XamlDiagnosticSource.cs (1)
17internal sealed class XamlDiagnosticSource(IXamlDiagnosticSource xamlDiagnosticSource, TextDocument document) : IDiagnosticSource
Microsoft.CodeAnalysis.Features (29)
CodeFixes\Configuration\ConfigureCodeStyle\ConfigureCodeStyleOptionCodeFixProvider.cs (1)
56public Task<ImmutableArray<CodeFix>> GetFixesAsync(TextDocument document, TextSpan span, IEnumerable<Diagnostic> diagnostics, CancellationToken cancellationToken)
CodeFixes\Configuration\ConfigureSeverity\ConfigureSeverityLevelCodeFixProvider.cs (1)
47public Task<ImmutableArray<CodeFix>> GetFixesAsync(TextDocument document, TextSpan span, IEnumerable<Diagnostic> diagnostics, CancellationToken cancellationToken)
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.cs (1)
142TextDocument textDocument, TextSpan span, IEnumerable<Diagnostic> diagnostics, CancellationToken cancellationToken)
CodeRefactorings\CodeRefactoringService.cs (5)
63private ConcatImmutableArray<CodeRefactoringProvider> GetProviders(TextDocument document) 73static ImmutableArray<CodeRefactoringProvider> GetProjectRefactorings(TextDocument document) 91TextDocument document, 150TextDocument document, 206TextDocument textDocument,
CodeRefactorings\ICodeRefactoringService.cs (3)
15Task<bool> HasRefactoringsAsync(TextDocument document, TextSpan textSpan, CancellationToken cancellationToken); 17Task<ImmutableArray<CodeRefactoring>> GetRefactoringsAsync(TextDocument document, TextSpan textSpan, CodeActionRequestPriority? priority, CancellationToken cancellationToken); 22public static Task<ImmutableArray<CodeRefactoring>> GetRefactoringsAsync(this ICodeRefactoringService service, TextDocument document, TextSpan state, CancellationToken cancellationToken)
Common\AbstractProjectExtensionProvider.cs (3)
80public static ImmutableArray<TExtension> GetExtensions(TextDocument document, Func<TExportAttribute, ExtensionInfo>? getExtensionInfoForFiltering) 88public static ImmutableArray<TExtension> FilterExtensions(TextDocument document, ImmutableArray<TExtension> extensions, Func<TExportAttribute, ExtensionInfo> getExtensionInfoForFiltering) 92static bool ShouldIncludeExtension(TExtension extension, (TextDocument, Func<TExportAttribute, ExtensionInfo>) args)
Copilot\Extensions.cs (1)
16public static async Task<ImmutableArray<DiagnosticData>> GetCachedCopilotDiagnosticsAsync(this TextDocument document, TextSpan? span, CancellationToken cancellationToken)
Diagnostics\IDiagnosticAnalyzerService.cs (4)
109TextDocument document, TextSpan? range, Func<string, bool>? shouldIncludeDiagnostic, 127TextDocument document, TextSpan? range, CancellationToken cancellationToken) 138TextDocument document, TextSpan? range, DiagnosticKind diagnosticKind, bool includeSuppressedDiagnostics, CancellationToken cancellationToken) 153TextDocument document, TextSpan? range, string? diagnosticId,
EditAndContinue\DebuggingSession.cs (1)
805public async ValueTask<ImmutableArray<ActiveStatementSpan>> GetAdjustedActiveStatementSpansAsync(TextDocument mappedDocument, ActiveStatementSpanProvider activeStatementSpanProvider, CancellationToken cancellationToken)
EditAndContinue\EditAndContinueService.cs (1)
272public ValueTask<ImmutableArray<ActiveStatementSpan>> GetAdjustedActiveStatementSpansAsync(DebuggingSessionId sessionId, TextDocument mappedDocument, ActiveStatementSpanProvider activeStatementSpanProvider, CancellationToken cancellationToken)
EditAndContinue\EditSession.cs (2)
322private static async ValueTask<bool> ContentEqualsAsync(TextDocument oldDocument, TextDocument newDocument, CancellationToken cancellationToken)
EditAndContinue\IActiveStatementSpanFactory.cs (1)
36ValueTask<ImmutableArray<ActiveStatementSpan>> GetAdjustedActiveStatementSpansAsync(TextDocument document, ActiveStatementSpanProvider activeStatementSpanProvider, CancellationToken cancellationToken);
EditAndContinue\IEditAndContinueService.cs (1)
34ValueTask<ImmutableArray<ActiveStatementSpan>> GetAdjustedActiveStatementSpansAsync(DebuggingSessionId sessionId, TextDocument document, ActiveStatementSpanProvider activeStatementSpanProvider, CancellationToken cancellationToken);
EditAndContinue\Remote\RemoteDebuggingSessionProxy.cs (1)
174public async ValueTask<ImmutableArray<ActiveStatementSpan>> GetAdjustedActiveStatementSpansAsync(TextDocument document, ActiveStatementSpanProvider activeStatementSpanProvider, CancellationToken cancellationToken)
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.cs (1)
325private async Task EnqueueDocumentWorkItemAsync(Project project, DocumentId documentId, TextDocument? document, UnitTestingInvocationReasons invocationReasons, SyntaxNode? changedMember = null)
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs (1)
120TextDocument textDocument, ImmutableArray<IUnitTestingIncrementalAnalyzer> analyzers, UnitTestingWorkItem workItem, CancellationToken cancellationToken)
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs (1)
249private async Task ProcessReanalyzeDocumentAsync(UnitTestingWorkItem workItem, TextDocument document, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.Features.Test.Utilities (5)
EditAndContinue\MockActiveStatementSpanProvider.cs (2)
15public Func<TextDocument, ActiveStatementSpanProvider, ImmutableArray<ActiveStatementSpan>>? GetAdjustedActiveStatementSpansImpl; 20public ValueTask<ImmutableArray<ActiveStatementSpan>> GetAdjustedActiveStatementSpansAsync(TextDocument document, ActiveStatementSpanProvider activeStatementSpanProvider, CancellationToken cancellationToken)
EditAndContinue\MockEditAndContinueService.cs (2)
22public Func<TextDocument, ActiveStatementSpanProvider, ImmutableArray<ActiveStatementSpan>>? GetAdjustedActiveStatementSpansImpl; 55public ValueTask<ImmutableArray<ActiveStatementSpan>> GetAdjustedActiveStatementSpansAsync(DebuggingSessionId sessionId, TextDocument document, ActiveStatementSpanProvider activeStatementSpanProvider, CancellationToken cancellationToken)
Snippets\AbstractSnippetProviderTests.cs (1)
44var editorConfigDoc = document.Project.AddAnalyzerConfigDocument(".editorconfig", SourceText.From(editorconfig), filePath: "/.editorconfig");
Microsoft.CodeAnalysis.LanguageServer (1)
HostWorkspace\LanguageServerWorkspace.cs (1)
103var textDocument = w.CurrentSolution.GetDocument(documentId) ?? w.CurrentSolution.GetAdditionalDocument(documentId);
Microsoft.CodeAnalysis.LanguageServer.Protocol (108)
Extensions\Extensions.cs (10)
26public static Uri GetURI(this TextDocument document) 38public static Uri GetUriForRenamedDocument(this TextDocument document) 50public static Uri CreateUriForDocumentWithoutFilePath(this TextDocument document) 62/// Get all regular and additional <see cref="TextDocument"/>s for the given <paramref name="documentUri"/>. 65public static ImmutableArray<TextDocument> GetTextDocuments(this Solution solution, Uri documentUri) 95var textDocument = await solution.GetTextDocumentAsync(documentIdentifier, cancellationToken).ConfigureAwait(false); 103public static async ValueTask<TextDocument?> GetTextDocumentAsync(this Solution solution, TextDocumentIdentifier documentIdentifier, CancellationToken cancellationToken) 151public static T FindDocumentInProjectContext<T>(this ImmutableArray<T> documents, TextDocumentIdentifier documentIdentifier, Func<Solution, DocumentId, T> documentGetter) where T : TextDocument 173public static TextDocument? GetAdditionalDocument(this Solution solution, TextDocumentIdentifier documentIdentifier) 184public static async Task<int> GetPositionFromLinePositionAsync(this TextDocument document, LinePosition linePosition, CancellationToken cancellationToken)
Extensions\ProtocolConversions.cs (7)
286public static LSP.TextDocumentIdentifier DocumentToTextDocumentIdentifier(TextDocument document) 377Func<DocumentId, T> getOldDocumentFunc, IDocumentTextDifferencingService? textDiffService, CancellationToken cancellationToken) where T : TextDocument 442TextDocument document, 451TextDocument document, 490TextDocument document, 860public static LSP.MarkupContent GetDocumentationMarkupContent(ImmutableArray<TaggedText> tags, TextDocument document, bool featureSupportsMarkdown) 992private static async Task<ImmutableArray<MappedSpanResult>?> GetMappedSpanResultAsync(TextDocument textDocument, ImmutableArray<TextSpan> textSpans, CancellationToken cancellationToken)
ExternalAccess\Razor\SimplifyMethodParams.cs (1)
20public required TextDocumentIdentifier TextDocument { get; set; }
Features\CodeFixes\CodeFixService.cs (16)
77TextDocument document, 102TextDocument document, TextSpan range, ICodeActionRequestPriorityProvider priorityProvider, CancellationToken cancellationToken) 170TextDocument document, 245TextDocument document, 281TextDocument document, TextSpan range, string diagnosticId, CancellationToken cancellationToken) 285TextDocument document, TextSpan range, string diagnosticId, DiagnosticSeverity minimumSeverity, CancellationToken cancellationToken) 324public Task<TDocument> ApplyCodeFixesForSpecificDiagnosticIdAsync<TDocument>(TDocument document, string diagnosticId, IProgress<CodeAnalysisProgress> progressTracker, CancellationToken cancellationToken) where TDocument : TextDocument 333where TDocument : TextDocument 356private bool TryGetWorkspaceFixersMap(TextDocument document, [NotNullWhen(true)] out ImmutableDictionary<DiagnosticId, ImmutableArray<CodeFixProvider>>? fixerMap) 382private bool TryGetWorkspaceFixersPriorityMap(TextDocument document, [NotNullWhen(true)] out Lazy<ImmutableDictionary<CodeFixProvider, int>>? fixersPriorityMap) 436TextDocument document, 618TextDocument document, TextSpan span, CodeFixProvider fixer, CodeChangeProviderMetadata? fixerMetadata, 698TextDocument document, 733TextDocument textDocument, 957private ImmutableDictionary<DiagnosticId, ImmutableArray<CodeFixProvider>> GetProjectFixers(TextDocument document) 965private ImmutableDictionary<DiagnosticId, ImmutableArray<CodeFixProvider>> ComputeProjectFixers(TextDocument document)
Features\CodeFixes\ICodeFixService.cs (8)
18IAsyncEnumerable<CodeFixCollection> StreamFixesAsync(TextDocument document, TextSpan textSpan, ICodeActionRequestPriorityProvider priorityProvider, CancellationToken cancellationToken); 25Task<CodeFixCollection?> GetMostSevereFixAsync(TextDocument document, TextSpan range, ICodeActionRequestPriorityProvider priorityProvider, CancellationToken cancellationToken); 27Task<CodeFixCollection?> GetDocumentFixAllForIdInSpanAsync(TextDocument document, TextSpan textSpan, string diagnosticId, DiagnosticSeverity severity, CancellationToken cancellationToken); 29where TDocument : TextDocument; 35public static IAsyncEnumerable<CodeFixCollection> StreamFixesAsync(this ICodeFixService service, TextDocument document, TextSpan range, CancellationToken cancellationToken) 38public static Task<ImmutableArray<CodeFixCollection>> GetFixesAsync(this ICodeFixService service, TextDocument document, TextSpan range, CancellationToken cancellationToken) 41public static Task<ImmutableArray<CodeFixCollection>> GetFixesAsync(this ICodeFixService service, TextDocument document, TextSpan textSpan, ICodeActionRequestPriorityProvider priorityProvider, CancellationToken cancellationToken) 44public static Task<TDocument> ApplyCodeFixesForSpecificDiagnosticIdAsync<TDocument>(this ICodeFixService service, TDocument document, string diagnosticId, IProgress<CodeAnalysisProgress> progressTracker, CancellationToken cancellationToken) where TDocument : TextDocument
Features\Diagnostics\DiagnosticAnalyzerService.cs (1)
80TextDocument document,
Features\Diagnostics\DocumentAnalysisExecutor.cs (2)
78var textDocument = AnalysisScope.TextDocument; 391TextDocument textDocument,
Features\Diagnostics\DocumentAnalysisExecutor_Helpers.cs (2)
403public static IEnumerable<DiagnosticData> ConvertToLocalDiagnostics(IEnumerable<Diagnostic> diagnostics, TextDocument targetTextDocument, TextSpan? span = null) 420static bool IsReportedInDocument(Diagnostic diagnostic, TextDocument targetTextDocument)
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.cs (1)
92private static string GetOpenLogMessage(TextDocument document)
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.ProjectState.cs (6)
118public async Task<DiagnosticAnalysisResult> GetAnalysisDataAsync(TextDocument document, bool avoidLoadingData, CancellationToken cancellationToken) 250public async ValueTask MergeAsync(ActiveFileState state, TextDocument document, IGlobalOptionService globalOptions) 327private async Task<DiagnosticAnalysisResult> LoadInitialAnalysisDataAsync(TextDocument document, CancellationToken cancellationToken) 358VersionStamp serializerVersion, Project project, TextDocument? document, object key, string stateKey, ImmutableArray<DiagnosticData> diagnostics) 366private async ValueTask<bool> TryGetDiagnosticsFromInMemoryStorageAsync(VersionStamp serializerVersion, TextDocument document, Builder builder, CancellationToken cancellationToken) 418VersionStamp serializerVersion, Project project, TextDocument? document, object key, string stateKey, CancellationToken _)
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.StateSet.cs (3)
104public async Task<bool> OnDocumentOpenedAsync(TextDocument document) 126public async Task<bool> OnDocumentClosedAsync(TextDocument document, IGlobalOptionService globalOptions) 141public bool OnDocumentReset(TextDocument document)
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs (4)
26TextDocument document, 57private readonly TextDocument _document; 77TextDocument document, 157TextDocument document,
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer_IncrementalAnalyzer.cs (2)
61private async Task TextDocumentOpenAsync(TextDocument document, CancellationToken cancellationToken) 155public Task TextDocumentOpenAsync(TextDocument document)
Features\EditAndContinue\EditAndContinueDiagnosticSource_Workspace.cs (1)
29private sealed class ClosedDocumentSource(TextDocument document, ImmutableArray<DiagnosticData> diagnostics) : AbstractWorkspaceDocumentDiagnosticSource(document)
Features\UnifiedSuggestions\UnifiedSuggestedActionsSource.cs (3)
38TextDocument document, 436TextDocument document, 506TextDocument document,
Handler\CodeActions\CodeActionHelpers.cs (3)
33TextDocument document, 305TextDocument document, 383TextDocument document,
Handler\CodeActions\CodeActionResolveHandler.cs (1)
76var document = context.GetRequiredTextDocument();
Handler\CodeActions\CodeActionResolveHelper.cs (3)
205where TTextDocument : TextDocument 221where TTextDocument : TextDocument 259where TTextDocument : TextDocument
Handler\CodeActions\CodeActionsHandler.cs (1)
56var document = context.GetRequiredTextDocument();
Handler\Diagnostics\AbstractDocumentPullDiagnosticHandler.cs (1)
39var textDocument = context.TextDocument;
Handler\Diagnostics\AbstractPullDiagnosticHandler.cs (2)
252var document = await solution.GetTextDocumentAsync(textDocumentIdentifier, cancellationToken).ConfigureAwait(false); 264var additionalDocument = solution.GetAdditionalDocument(textDocumentIdentifier);
Handler\Diagnostics\DiagnosticSourceProviders\DocumentSyntaxAndSemanticDiagnosticSourceProvider.cs (1)
27if (context.GetTrackedDocument<TextDocument>() is { } document)
Handler\Diagnostics\DiagnosticSourceProviders\WorkspaceDiagnosticSourceHelpers.cs (1)
42public static bool ShouldSkipDocument(RequestContext context, TextDocument document)
Handler\Diagnostics\DiagnosticSourceProviders\WorkspaceDocumentsAndProjectDiagnosticSourceProvider.cs (2)
91void AddDocumentSources(IEnumerable<TextDocument> documents) 93foreach (var document in documents)
Handler\Diagnostics\DiagnosticSources\AbstractDocumentDiagnosticSource.cs (1)
14where TDocument : TextDocument
Handler\Diagnostics\DiagnosticSources\AbstractWorkspaceDocumentDiagnosticSource.cs (5)
16internal abstract class AbstractWorkspaceDocumentDiagnosticSource(TextDocument document) : AbstractDocumentDiagnosticSource<TextDocument>(document) 18public static AbstractWorkspaceDocumentDiagnosticSource CreateForFullSolutionAnalysisDiagnostics(TextDocument document, IDiagnosticAnalyzerService diagnosticAnalyzerService, Func<DiagnosticAnalyzer, bool>? shouldIncludeAnalyzer) 21public static AbstractWorkspaceDocumentDiagnosticSource CreateForCodeAnalysisDiagnostics(TextDocument document, ICodeAnalysisDiagnosticAnalyzerService codeAnalysisService) 24private sealed class FullSolutionAnalysisDiagnosticSource(TextDocument document, IDiagnosticAnalyzerService diagnosticAnalyzerService, Func<DiagnosticAnalyzer, bool>? shouldIncludeAnalyzer)
Handler\Diagnostics\DiagnosticSources\DocumentDiagnosticSource.cs (2)
13internal sealed class DocumentDiagnosticSource(IDiagnosticAnalyzerService diagnosticAnalyzerService, DiagnosticKind diagnosticKind, TextDocument document) 14: AbstractDocumentDiagnosticSource<TextDocument>(document)
Handler\Diagnostics\DiagnosticSources\NonLocalDocumentDiagnosticSource.cs (2)
13internal sealed class NonLocalDocumentDiagnosticSource(TextDocument document, IDiagnosticAnalyzerService diagnosticAnalyzerService, Func<DiagnosticAnalyzer, bool>? shouldIncludeAnalyzer) 14: AbstractDocumentDiagnosticSource<TextDocument>(document)
Handler\Diagnostics\Public\PublicDocumentNonLocalDiagnosticSourceProvider.cs (1)
35if (context.GetTrackedDocument<TextDocument>() is { } textDocument &&
Handler\Hover\HoverHandler.cs (1)
133TextDocument document, QuickInfoItem info, bool supportsMarkdown, CancellationToken cancellationToken)
Handler\RequestContext.cs (7)
56private readonly StrongBox<(Workspace Workspace, Solution Solution, TextDocument? Document)>? _lspSolution; 124public TextDocument? TextDocument 175TextDocument? document, 185_lspSolution = new StrongBox<(Workspace Workspace, Solution Solution, TextDocument? Document)>((workspace, solution, document)); 219public TextDocument GetRequiredTextDocument() 261TextDocument? document = null; 321public TDocument? GetTrackedDocument<TDocument>() where TDocument : TextDocument
Handler\SpellCheck\AbstractSpellCheckingHandler.cs (1)
214var document = await context.Solution.GetTextDocumentAsync(textDocument, cancellationToken).ConfigureAwait(false);
Workspaces\LspWorkspaceManager.cs (6)
278public async Task<(Workspace?, Solution?, TextDocument?)> GetLspDocumentInfoAsync(TextDocumentIdentifier textDocumentIdentifier, CancellationToken cancellationToken) 287var document = await lspSolution.GetTextDocumentAsync(textDocumentIdentifier, cancellationToken).ConfigureAwait(false); 504private async Task<bool> DoesAllTextMatchWorkspaceSolutionAsync(ImmutableDictionary<Uri, ImmutableArray<TextDocument>> documentsInWorkspace, CancellationToken cancellationToken) 522private static async ValueTask<bool> AreChecksumsEqualAsync(TextDocument document, SourceText lspText, CancellationToken cancellationToken) 557private static ImmutableDictionary<Uri, ImmutableArray<TextDocument>> GetDocumentsForUris(ImmutableArray<Uri> trackedDocuments, Solution workspaceCurrentSolution) 559using var _ = PooledDictionary<Uri, ImmutableArray<TextDocument>>.GetInstance(out var documentsInSolution);
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (1)
ProtocolConversionsTests.cs (1)
338internal static async Task<TextDocument?> GetTextDocumentAsync(TestLspServer testLspServer, Uri uri)
Microsoft.CodeAnalysis.Remote.ServiceHub (7)
Host\RemoteWorkspace.SolutionCreator.cs (3)
541TextDocument document, 572private async Task<TextDocument> UpdateDocumentInfoAsync(TextDocument document, Checksum infoChecksum, CancellationToken cancellationToken)
Host\TestUtils.cs (1)
236foreach (var document in project.Documents.Concat(project.AdditionalDocuments).Concat(project.AnalyzerConfigDocuments))
Services\DiagnosticAnalyzer\DiagnosticComputer.cs (3)
82private readonly TextDocument? _document; 91TextDocument? document, 110TextDocument? document,
Microsoft.CodeAnalysis.TestAnalyzerReference (1)
NonSourceFileRefactoring.cs (1)
26var document = context.TextDocument;
Microsoft.CodeAnalysis.Workspaces (81)
CodeActions\Operations\ApplyChangesOperation.cs (3)
127var originalDocument = changedProject.OldProject.Solution.GetRequiredTextDocument(documentId); 128var changedDocument = changedProject.NewProject.Solution.GetRequiredTextDocument(documentId); 139var currentDocument = currentSolution.GetTextDocument(documentId);
CodeFixes\CodeFixContext.cs (4)
49public TextDocument TextDocument { get; } 91: this((TextDocument)document, 117TextDocument document, 169TextDocument document,
CodeFixes\Supression\IConfigurationFixProvider.cs (1)
28Task<ImmutableArray<CodeFix>> GetFixesAsync(TextDocument document, TextSpan span, IEnumerable<Diagnostic> diagnostics, CancellationToken cancellationToken);
CodeRefactorings\CodeRefactoringContext.cs (3)
44public TextDocument TextDocument { get; } 74TextDocument document, 85TextDocument document,
Diagnostics\DiagnosticAnalysisResult.cs (1)
331var textDocument = project.GetTextDocument(documentId) ?? project.TryGetSourceGeneratedDocumentForAlreadyGeneratedId(documentId);
Diagnostics\DiagnosticAnalysisResultBuilder.cs (1)
97private void AddDocumentDiagnostic(ref Dictionary<DocumentId, List<DiagnosticData>>? map, TextDocument? document, Diagnostic diagnostic)
Diagnostics\DiagnosticData.cs (4)
165private static DiagnosticDataLocation CreateLocation(TextDocument? document, Location location) 194public static DiagnosticData Create(Diagnostic diagnostic, TextDocument document) 248private static ImmutableDictionary<string, string?>? GetAdditionalProperties(TextDocument document, Diagnostic diagnostic) 254private static ImmutableArray<DiagnosticDataLocation> GetAdditionalLocations(TextDocument document, Diagnostic diagnostic)
Diagnostics\DocumentAnalysisScope.cs (2)
22TextDocument document, 42public TextDocument TextDocument { get; }
Diagnostics\Extensions.cs (1)
44var textDocument = project.GetTextDocument(dataLocation.DocumentId)
ExternalAccess\UnitTesting\Api\UnitTestingTextDocumentEventArgsWrapper.cs (1)
13public TextDocument Document => UnderlyingObject.Document;
Rename\Renamer.cs (1)
98/// <param name="newDocumentFolders">The new set of folders for the <see cref="TextDocument.Folders"/> property</param>
Shared\Extensions\ISolutionExtensions.cs (1)
42internal static TextDocument? GetTextDocumentForLocation(this Solution solution, Location location)
Shared\Extensions\ProjectExtensions.cs (4)
19public static TextDocument? GetTextDocument(this Project project, DocumentId? documentId) 40public static TextDocument GetRequiredAdditionalDocument(this Project project, DocumentId documentId) 43public static TextDocument GetRequiredAnalyzerConfigDocument(this Project project, DocumentId documentId) 46public static TextDocument GetRequiredTextDocument(this Project project, DocumentId documentId)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
96public static bool IsOpen(this TextDocument document)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ISolutionExtensions.cs (5)
32public static TextDocument? GetTextDocument(this Solution solution, DocumentId? documentId) 69public static async ValueTask<TextDocument> GetRequiredTextDocumentAsync(this Solution solution, DocumentId documentId, CancellationToken cancellationToken = default) 73public static TextDocument GetRequiredAdditionalDocument(this Solution solution, DocumentId documentId) 76public static TextDocument GetRequiredAnalyzerConfigDocument(this Solution solution, DocumentId documentId) 79public static TextDocument GetRequiredTextDocument(this Solution solution, DocumentId documentId)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\TextDocumentExtensions.cs (6)
27public static TextDocument WithText(this TextDocument textDocument, SourceText text) 48public static TextDocument WithAdditionalDocumentText(this TextDocument textDocument, SourceText text) 57public static TextDocument WithAnalyzerConfigDocumentText(this TextDocument textDocument, SourceText text)
Workspace\Host\DocumentService\Extensions.cs (3)
13public static bool CanApplyChange([NotNullWhen(returnValue: true)] this TextDocument? document) 19public static bool SupportsDiagnostics([NotNullWhen(returnValue: true)] this TextDocument? document) 25public static bool IsRazorDocument(this TextDocument document)
Workspace\Solution\Document.cs (2)
61internal override bool HasInfoChanged(TextDocument otherTextDocument) 481/// share the same <see cref="TextDocument.FilePath" />. This <see cref="DocumentId"/> is excluded from the
Workspace\Solution\Project.cs (7)
201public IEnumerable<TextDocument> AdditionalDocuments => AdditionalDocumentIds.Select(GetAdditionalDocument)!; 247public TextDocument? GetAdditionalDocument(DocumentId documentId) 273internal async ValueTask<TextDocument?> GetTextDocumentAsync(DocumentId documentId, CancellationToken cancellationToken = default) 275var document = GetDocument(documentId) ?? GetAdditionalDocument(documentId) ?? GetAnalyzerConfigDocument(documentId); 729public TextDocument AddAdditionalDocument(string name, SourceText text, IEnumerable<string>? folders = null, string? filePath = null) 738public TextDocument AddAdditionalDocument(string name, string text, IEnumerable<string>? folders = null, string? filePath = null) 747public TextDocument AddAnalyzerConfigDocument(string name, SourceText text, IEnumerable<string>? folders = null, string? filePath = null)
Workspace\Solution\Solution.cs (3)
258internal ValueTask<TextDocument?> GetTextDocumentAsync(DocumentId? documentId, CancellationToken cancellationToken = default) 273public TextDocument? GetAdditionalDocument(DocumentId? documentId) 1671/// <see cref="TextDocument.FilePath"/> that matches the given file path. This may return IDs for any type of document
Workspace\Solution\TextDocument.cs (2)
113internal virtual bool HasInfoChanged(TextDocument otherTextDocument) 119internal bool HasTextChanged(TextDocument otherTextDocument, bool ignoreUnchangeableDocument)
Workspace\Solution\TextDocumentKind.cs (1)
8/// Indicates kind of a <see cref="TextDocument"/>
Workspace\TextDocumentEventArgs.cs (2)
9public sealed class TextDocumentEventArgs(TextDocument document) : EventArgs 11public TextDocument Document { get; } = document ?? throw new ArgumentNullException(nameof(document));
Workspace\TextExtensions.cs (3)
53/// Gets the <see cref="TextDocument"/> from the corresponding workspace's current solution that is associated with the source text's container 56public static TextDocument? GetOpenTextDocumentInCurrentContextWithChanges(this SourceText text) 59private static TextDocument? GetOpenTextDocumentInCurrentContextWithChanges(this SourceText text, bool sourceDocumentOnly)
Workspace\Workspace.cs (7)
1213Func<Solution, DocumentId, TextDocument?> getDocumentInSolution, 1233var document = data.getDocumentInSolution(oldSolution, documentId); 1908var document = projectChanges.NewProject.GetAdditionalDocument(documentId)!; 1932var newDoc = projectChanges.NewProject.GetAdditionalDocument(documentId)!; 2010private static DocumentInfo CreateDocumentInfoWithText(TextDocument doc) 2013internal static DocumentInfo CreateDocumentInfoWithoutText(TextDocument doc) 2543var document = this.CurrentSolution.GetTextDocument(documentId);
Workspace\Workspace_Editor.cs (7)
569var oldDocument = oldSolution.GetTextDocument(documentId); 615var newDoc = newSolution.GetRequiredTextDocument(documentId); 761var oldDocument = oldSolution.GetTextDocument(documentId); 791var newDoc = newSolution.GetRequiredTextDocument(data.documentId); 852var doc = solution.GetRequiredTextDocument(documentId); 869var document = newSolution.GetTextDocument(docId); 887var document = newSolution.GetTextDocument(docId);
Workspace\Workspace_Events.cs (5)
127/// An event that is fired when any <see cref="TextDocument"/> is opened in the editor. 142protected Task RaiseTextDocumentOpenedEventAsync(TextDocument document) 149where TDocument : TextDocument 186/// An event that is fired when any <see cref="TextDocument"/> is closed in the editor. 201protected Task RaiseTextDocumentClosedEventAsync(TextDocument document)
Microsoft.CodeAnalysis.Workspaces.MSBuild (2)
MSBuild\MSBuildWorkspace.cs (2)
405var document = this.CurrentSolution.GetAdditionalDocument(documentId); 421private static Encoding? DetermineEncoding(SourceText text, TextDocument document)
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (6)
VisualStudioMSBuildWorkspaceTests.cs (6)
2142var document = documents.Single(d => d.Name.Contains("ValidAdditionalFile")); 2151var document2 = solution2.GetAdditionalDocument(document.Id); 2209var xaml = workspace.CurrentSolution.GetProject(csProjectId).AdditionalDocuments.FirstOrDefault(d => d.Name == "XamlFile.xaml"); 2351var doc = Assert.Single(proj.AdditionalDocuments); 2374var additionalDocument = project.AdditionalDocuments.Single(a => a.Name == "XamlFile.xaml"); 2393var adoc = proj.AdditionalDocuments.First(a => a.Name == "XamlFile.xaml");
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (1)
SolutionUtilities.cs (1)
47public static TextDocument GetSingleChangedAdditionalDocument(Solution oldSolution, Solution newSolution)
Microsoft.CodeAnalysis.Workspaces.UnitTests (2)
SolutionTests\SolutionWithSourceGeneratorTests.cs (1)
632var originalAdditionalFile = AddEmptyProject(workspace.CurrentSolution)
WorkspaceTests\AdhocWorkspaceTests.cs (1)
260var doc = ws.CurrentSolution.GetAdditionalDocument(docInfo.Id);
Microsoft.VisualStudio.LanguageServices (25)
Preview\FileChange.cs (12)
29private readonly TextDocument _left; 30private readonly TextDocument _right; 41public FileChange(TextDocument left, 42TextDocument right, 68private ChangeList ComputeChildren(TextDocument left, TextDocument right, CancellationToken cancellationToken) 124private ChangeList GetEntireDocumentAsSpanChange(TextDocument document) 200public TextDocument GetOldDocument() 203public TextDocument GetUpdatedDocument() 219var document = _right ?? _left; 238private static IHierarchicalDifferenceCollection ComputeDiffSpans(ITextDifferencingService diffService, TextDocument left, TextDocument right, CancellationToken cancellationToken)
Preview\PreviewUpdater.cs (3)
36public void UpdateView(TextDocument document, SpanChange spanSource) 47private void UpdateBuffer(TextDocument document) 80private void ApplyDocumentToBuffer(TextDocument document, out SourceTextContainer container)
Preview\PreviewUpdater.PreviewDialogWorkspace.cs (1)
25public void CloseDocument(TextDocument document, SourceText text)
Preview\TopLevelChange.cs (3)
76var oldTextDocument = fileChange.GetOldDocument(); 77var updatedTextDocument = fileChange.GetUpdatedDocument(); 112TextDocument oldDocument,
ProjectSystem\VisualStudioWorkspaceImpl.AbstractRemoveDocumentUndoUnit.cs (2)
28protected abstract TextDocument? GetDocument(Solution currentSolution); 46var document = GetDocument(currentSolution);
ProjectSystem\VisualStudioWorkspaceImpl.OpenFileTracker.cs (1)
53/// Boolean flag to indicate if any <see cref="TextDocument"/> has been opened in the workspace.
ProjectSystem\VisualStudioWorkspaceImpl.RemoveAdditionalDocumentUndoUnit.cs (1)
24protected override TextDocument? GetDocument(Solution currentSolution)
ProjectSystem\VisualStudioWorkspaceImpl.RemoveAnalyzerConfigDocumentUndoUnit.cs (1)
24protected override TextDocument? GetDocument(Solution currentSolution)
ProjectSystem\VisualStudioWorkspaceImpl.RemoveDocumentUndoUnit.cs (1)
24protected override TextDocument? GetDocument(Solution currentSolution)
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (1)
ProjectSystemShim\CPS\SourceFileHandlingTests.cs (1)
50IEnumerable<TextDocument> GetCurrentAdditionalDocuments() => environment.Workspace.CurrentSolution.Projects.Single().AdditionalDocuments;
Microsoft.VisualStudio.LanguageServices.UnitTests (1)
Diagnostics\ExternalDiagnosticUpdateSourceTests.vb (1)
319Public Function GetDiagnosticsForSpanAsync(document As TextDocument, range As TextSpan?, shouldIncludeDiagnostic As Func(Of String, Boolean), includeCompilerDiagnostics As Boolean, includeSuppressedDiagnostics As Boolean, priority As ICodeActionRequestPriorityProvider, diagnosticKinds As DiagnosticKind, isExplicit As Boolean, cancellationToken As CancellationToken) As Task(Of ImmutableArray(Of DiagnosticData)) Implements IDiagnosticAnalyzerService.GetDiagnosticsForSpanAsync
Microsoft.VisualStudio.LanguageServices.Xaml (13)
Extensions.cs (1)
26public static Project GetCodeProject(this TextDocument document)
Features\AutoInsert\IXamlAutoInsertService.cs (1)
16public Task<XamlAutoInsertResult> GetAutoInsertAsync(TextDocument document, char typedChar, int position, CancellationToken cancellationToken);
Features\Commands\IXamlCommandService.cs (1)
22Task<bool> ExecuteCommandAsync(TextDocument document, string command, object[]? commandArguments, CancellationToken cancellationToken);
Features\Completion\XamlCompletionContext.cs (2)
16public XamlCompletionContext(TextDocument document, int offset, char triggerChar = '\0') 23public TextDocument Document { get; }
Features\Definitions\IXamlGoToDefinitionService.cs (1)
15Task<ImmutableArray<XamlDefinition>> GetDefinitionsAsync(TextDocument document, int position, CancellationToken cancellationToken);
Features\Diagnostics\IXamlPullDiagnosticService.cs (1)
21Task<XamlDiagnosticReport> GetDiagnosticReportAsync(TextDocument document, string? previousResultId, CancellationToken cancellationToken);
Features\Formatting\IXamlFormattingService.cs (2)
18Task<IList<TextChange>> GetFormattingChangesAsync(TextDocument document, XamlFormattingOptions options, TextSpan? textSpan, CancellationToken cancellationToken); 19Task<IList<TextChange>> GetFormattingChangesAsync(TextDocument document, XamlFormattingOptions options, char typedChar, int position, CancellationToken cancellationToken);
Features\QuickInfo\IXamlQuickInfoService.cs (1)
16Task<XamlQuickInfo> GetQuickInfoAsync(TextDocument document, int position, CancellationToken cancellationToken);
Features\Structure\IXamlStructureService.cs (1)
17Task<ImmutableArray<XamlStructureTag>> GetStructureTagsAsync(TextDocument document, CancellationToken cancellationToken);
Features\TypeRename\IXamlTypeRenameService.cs (1)
14public Task<XamlTypeRenameResult> GetTypeRenameAsync(TextDocument document, int position, CancellationToken cancellationToken);
Implementation\LanguageServer\Extensions\SymbolExtensions.cs (1)
21public static async Task<IEnumerable<TaggedText>> GetDescriptionAsync(this ISymbol symbol, TextDocument document, SymbolDescriptionOptions options, CancellationToken cancellationToken)