1 type derived from TextEdit
Microsoft.CodeAnalysis.LanguageServer.Protocol (1)
Protocol\AnnotatedTextEdit.cs (1)
16internal sealed class AnnotatedTextEdit : TextEdit
34 instantiations of TextEdit
Microsoft.CodeAnalysis.LanguageServer.Protocol (8)
Extensions\ProtocolConversions.cs (2)
346return new LSP.TextEdit 438uriToTextEdits.Add((CreateAbsoluteDocumentUri(mappedSpan.FilePath), new LSP.TextEdit
Handler\CodeActions\CodeActionResolveHelper.cs (1)
261var edit = new TextEdit { Range = emptyDocumentRange, NewText = newText.ToString() };
Handler\Completion\CompletionResultFactory.cs (3)
497lspItem.TextEdit = new LSP.TextEdit() 543builder.Add(new LSP.TextEdit() 688var textEdit = new LSP.TextEdit()
Handler\OnAutoInsert\OnAutoInsertHandler.cs (2)
136TextEdit = new LSP.TextEdit 200TextEdit = new LSP.TextEdit
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (24)
CodeActions\CodeActionResolveTests.cs (5)
316new TextEdit() 346new TextEdit() 447new TextEdit() 476new TextEdit() 524=> new LSP.TextEdit
Completion\CompletionFeaturesTests.cs (8)
156? new() { NewText = "System.Threading.Tasks.Task", Range = new() { Start = new(0, 20), End = new(0, 24) } } 157: new() { NewText = "using System.Threading.Tasks;\r\n\r\n", Range = new() { Start = new(1, 0), End = new(1, 0) } }; 242var expectedAdditionalEdit = new TextEdit() { NewText = "using NS2;\r\n\r\n", Range = new() { Start = new(1, 0), End = new(1, 0) } }; 301var expectedEdit = new TextEdit { Range = new LSP.Range { Start = new(1, 5), End = new(1, 9) }, NewText = "summary" }; 730var expectedAdditionalEdit1 = new TextEdit() { NewText = "using Namespace1;\r\n\r\n", Range = new() { Start = new(1, 0), End = new(1, 0) } }; 738var expectedAdditionalEdit2 = new TextEdit() { NewText = "using Namespace2;\r\n\r\n", Range = new() { Start = new(1, 0), End = new(1, 0) } }; 1004var expectedEdit = new TextEdit { Range = new LSP.Range { Start = new(0, 5), End = new(0, 5) }, NewText = "ComplexItem" }; 1061var expectedEdit = new TextEdit { Range = new LSP.Range { Start = new(7, 4), End = new(7, 13) }, NewText = "public override global::System.Boolean AbstractMethod(global::System.Int32 x)\r\n {\r\n throw new System.NotImplementedException();\r\n }" };
Diagnostics\PullDiagnosticTests.cs (1)
690var textEdit = new LSP.TextEdit { Range = textLocation.Range, NewText = "partial " };
Rename\RenameTests.cs (8)
47var expectedEdits = testLspServer.GetLocations("renamed").Select(location => new LSP.TextEdit() { NewText = renameValue, Range = location.Range }); 102var expectedEdits = testLspServer.GetLocations("renamed").Select(location => new LSP.TextEdit() { NewText = renameValue, Range = location.Range }); 147var expectedEdits = testLspServer.GetLocations("renamed").Select(location => new LSP.TextEdit() { NewText = renameValue, Range = location.Range }); 227var expectedEdits = testLspServer.GetLocations("renamed").Select(location => new LSP.TextEdit() { NewText = renameValue, Range = location.Range }); 272var expectedEdits = testLspServer.GetLocations("renamed").Select(location => new LSP.TextEdit() { NewText = renameValue, Range = location.Range }); 273var expectedGeneratedEdits = spans["renamed"].Select(span => new LSP.TextEdit() { NewText = renameValue, Range = ProtocolConversions.TextSpanToRange(span, generatedSourceText) }); 322var expectedEdits = testLspServer.GetLocations("renamed").Select(location => new LSP.TextEdit() { NewText = renameValue, Range = location.Range }); 323var expectedGeneratedEdits = spans["renamed"].Select(span => new LSP.TextEdit() { NewText = renameValue, Range = ProtocolConversions.TextSpanToRange(span, generatedSourceText) });
SimplifyMethod\SimplifyMethodTests.cs (2)
39var expectedEdit = new TextEdit() 59TextEdit = new TextEdit() { Range = location.Range, NewText = newText },
Microsoft.VisualStudio.LanguageServices.Xaml (2)
Implementation\LanguageServer\Handler\Completion\CompletionHandler.cs (1)
102item.TextEdit = new TextEdit
Implementation\LanguageServer\Handler\OnAutoInsert\OnAutoInsertHandler.cs (1)
67TextEdit = new TextEdit
81 references to TextEdit
Microsoft.CodeAnalysis.ExternalAccess.Razor.Features (2)
Cohost\Handlers\CodeActions.cs (2)
78public static Task<TextEdit[]> GetSimplifiedEditsAsync(Document document, TextEdit textEdit, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.LanguageServer.Protocol (46)
Extensions\ProtocolConversions.cs (4)
343public static LSP.TextEdit TextChangeToTextEdit(TextChange textChange, SourceText oldText) 353public static TextChange TextEditToTextChange(LSP.TextEdit edit, SourceText oldText) 395using var _ = ArrayBuilder<(DocumentUri Uri, LSP.TextEdit TextEdit)>.GetInstance(out var uriToTextEdits); 448var documentEdits = uriToTextEdits.GroupBy(uriAndEdit => uriAndEdit.Uri, uriAndEdit => new LSP.SumType<LSP.TextEdit, LSP.AnnotatedTextEdit>(uriAndEdit.TextEdit), (uri, edits) => new LSP.TextDocumentEdit
ExternalAccess\Razor\SimplifyMethodHandler.cs (5)
20internal class SimplifyMethodHandler : ILspServiceDocumentRequestHandler<SimplifyMethodParams, TextEdit[]?> 36public async Task<TextEdit[]?> HandleRequestAsync( 46var textEdit = request.TextEdit; 51internal static async Task<TextEdit[]> GetSimplifiedEditsAsync(Document originalDocument, TextEdit textEdit, CancellationToken cancellationToken)
ExternalAccess\Razor\SimplifyMethodParams.cs (1)
26public required TextEdit TextEdit { get; set; }
Handler\CodeActions\CodeActionResolveHelper.cs (2)
261var edit = new TextEdit { Range = emptyDocumentRange, NewText = newText.ToString() }; 301var edits = textChanges.Select(tc => new LSP.SumType<LSP.TextEdit, LSP.AnnotatedTextEdit>(ProtocolConversions.TextChangeToTextEdit(tc, oldText))).ToArray();
Handler\Completion\CompletionResultFactory.cs (4)
527public static async Task<LSP.TextEdit[]?> GenerateAdditionalTextEditForImportCompletionAsync( 537using var _ = ArrayBuilder<LSP.TextEdit>.GetInstance(out var builder); 672public static async Task<(LSP.TextEdit edit, bool isSnippetString, int? newPosition)> GenerateComplexTextEditAsync( 688var textEdit = new LSP.TextEdit()
Handler\Formatting\AbstractFormatDocumentHandlerBase.cs (1)
24protected static async Task<LSP.TextEdit[]?> GetTextEditsAsync(
Handler\Formatting\FormatDocumentHandler.cs (2)
19internal sealed class FormatDocumentHandler(IGlobalOptionService globalOptions) : AbstractFormatDocumentHandlerBase<LSP.DocumentFormattingParams, LSP.TextEdit[]?> 25public override Task<LSP.TextEdit[]?> HandleRequestAsync(
Handler\Formatting\FormatDocumentOnTypeHandler.cs (2)
21internal sealed class FormatDocumentOnTypeHandler : ILspServiceDocumentRequestHandler<DocumentOnTypeFormattingParams, TextEdit[]?> 37public async Task<TextEdit[]?> HandleRequestAsync(
Handler\Formatting\FormatDocumentRangeHandler.cs (2)
19internal sealed class FormatDocumentRangeHandler(IGlobalOptionService globalOptions) : AbstractFormatDocumentHandlerBase<DocumentRangeFormattingParams, TextEdit[]?> 25public override Task<TextEdit[]?> HandleRequestAsync(
Handler\InlayHint\InlayHintHandler.cs (2)
72TextEdit[]? textEdits = null; 75var textEdit = ProtocolConversions.TextChangeToTextEdit(hint.ReplacementTextChange.Value, text);
Handler\MapCode\MapCodeHandler.cs (4)
45using var _ = PooledDictionary<DocumentUri, LSP.TextEdit[]>.GetInstance(out var uriToEditsMap); 50if (mappingResult is not (DocumentUri uri, LSP.TextEdit[] textEdits)) 68Edits = [.. kvp.Value.Select(v => new SumType<LSP.TextEdit, LSP.AnnotatedTextEdit>(v))], 80async Task<(DocumentUri, LSP.TextEdit[])?> MapCodeAsync(LSP.VSInternalMapCodeMapping codeMapping)
Protocol\ColorPresentation.cs (4)
29/// A <see cref="Protocol.TextEdit"/> which is applied to a document when selecting this presentation for the color. 36public TextEdit? TextEdit { get; init; } 39/// An optional array of additional <see cref="Protocol.TextEdit"/> that are applied 47public TextEdit[]? AdditionalTextEdits { get; init; }
Protocol\CompletionItem.cs (4)
178/// <see cref="TextEdit.NewText"/> property on <see cref="TextEdit"/>. 209/// The <see cref="TextEdit.Range"/> must be single-line and must contain the position at which completion was requested. 227public SumType<TextEdit, InsertReplaceEdit>? TextEdit 268public TextEdit[]? AdditionalTextEdits
Protocol\InlayHint.cs (1)
74public TextEdit[]? TextEdits
Protocol\Internal\VSInternalDocumentOnAutoInsertResponseItem.cs (1)
35public TextEdit TextEdit
Protocol\Methods.Document.cs (3)
532public static readonly LspRequest<DocumentFormattingParams, TextEdit[]?> TextDocumentFormatting = new(TextDocumentFormattingName); 548public static readonly LspRequest<DocumentRangeFormattingParams, TextEdit[]?> TextDocumentRangeFormatting = new(TextDocumentRangeFormattingName); 564public static readonly LspRequest<DocumentOnTypeFormattingParams, TextEdit[]?> TextDocumentOnTypeFormatting = new(TextDocumentOnTypeFormattingName);
Protocol\Methods.DocumentSynchronization.cs (1)
75public static readonly LspRequest<WillSaveTextDocumentParams, TextEdit[]?> TextDocumentWillSaveWaitUntil = new(TextDocumentWillSaveWaitUntilName);
Protocol\TextDocumentEdit.cs (1)
39public SumType<TextEdit, AnnotatedTextEdit>[] Edits { get; set; }
Protocol\WorkspaceEdit.cs (2)
23public Dictionary<string, TextEdit[]>? Changes { get; set; } 36/// <see cref="WorkspaceEditSetting.ResourceOperations"/> then only plain <see cref="TextEdit"/>s
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (23)
CodeActions\CodeActionResolveTests.cs (5)
59var expectedTextEdits = new SumType<TextEdit, AnnotatedTextEdit>[] 116var expectedTextEdits = new SumType<TextEdit, AnnotatedTextEdit>[] 245var edits = textDocumentEdit[0].Edits.Select(e => (LSP.TextEdit)e.Value!).ToArray(); 523private static LSP.TextEdit GenerateTextEdit(string newText, LSP.Range range) 532SumType<TextEdit, AnnotatedTextEdit>[] edits)
Completion\CompletionFeaturesTests.cs (7)
155TextEdit expectedAdditionalEdit = isInUsingStatement 242var expectedAdditionalEdit = new TextEdit() { NewText = "using NS2;\r\n\r\n", Range = new() { Start = new(1, 0), End = new(1, 0) } }; 301var expectedEdit = new TextEdit { Range = new LSP.Range { Start = new(1, 5), End = new(1, 9) }, NewText = "summary" }; 730var expectedAdditionalEdit1 = new TextEdit() { NewText = "using Namespace1;\r\n\r\n", Range = new() { Start = new(1, 0), End = new(1, 0) } }; 738var expectedAdditionalEdit2 = new TextEdit() { NewText = "using Namespace2;\r\n\r\n", Range = new() { Start = new(1, 0), End = new(1, 0) } }; 1004var expectedEdit = new TextEdit { Range = new LSP.Range { Start = new(0, 5), End = new(0, 5) }, NewText = "ComplexItem" }; 1061var expectedEdit = new TextEdit { Range = new LSP.Range { Start = new(7, 4), End = new(7, 13) }, NewText = "public override global::System.Boolean AbstractMethod(global::System.Int32 x)\r\n {\r\n throw new System.NotImplementedException();\r\n }" };
Completion\CompletionTests.cs (1)
634var textEdit = GenerateTextEdit(@"\\A", startLine: 5, startChar: 19, endLine: 5, endChar: 19);
Diagnostics\PullDiagnosticTests.cs (1)
690var textEdit = new LSP.TextEdit { Range = textLocation.Range, NewText = "partial " };
Formatting\FormatDocumentOnTypeTests.cs (1)
112var results = await testLspServer.ExecuteRequestAsync<LSP.DocumentOnTypeFormattingParams, LSP.TextEdit[]>(
Formatting\FormatDocumentRangeTests.cs (2)
83private static async Task<LSP.TextEdit[]> RunFormatDocumentRangeAsync( 89return await testLspServer.ExecuteRequestAsync<LSP.DocumentRangeFormattingParams, LSP.TextEdit[]>(
Formatting\FormatDocumentTests.cs (2)
308private static async Task<LSP.TextEdit[]?> RunFormatDocumentAsync( 314return await testLspServer.ExecuteRequestAsync<LSP.DocumentFormattingParams, LSP.TextEdit[]>(LSP.Methods.TextDocumentFormattingName,
MapCode\MapCodeTests.cs (1)
101TextEdit[]? edits;
SimplifyMethod\SimplifyMethodTests.cs (3)
39var expectedEdit = new TextEdit() 50private static async Task<TextEdit[]?> RunRenameAsync(TestLspServer testLspServer, SimplifyMethodParams @params) 52return await testLspServer.ExecuteRequestAsync<SimplifyMethodParams, TextEdit[]>(SimplifyMethodHandler.SimplifyMethodMethodName, @params, CancellationToken.None);
Microsoft.CodeAnalysis.LanguageServer.UnitTests (1)
Utilities\AbstractLanguageServerClientTests.TestLspClient.cs (1)
236.Cast<TextEdit>()
Microsoft.VisualStudio.LanguageServices.Xaml (9)
Implementation\LanguageServer\Handler\Formatting\AbstractFormatDocumentHandlerBase.cs (2)
26protected async Task<LSP.TextEdit[]> GetTextEditsAsync(LSP.FormattingOptions formattingOptions, RequestContext context, CancellationToken cancellationToken, LSP.Range? range = null) 28using var _ = ArrayBuilder<LSP.TextEdit>.GetInstance(out var edits);
Implementation\LanguageServer\Handler\Formatting\FormatDocumentHandler.cs (2)
17internal sealed class FormatDocumentHandler : AbstractFormatDocumentHandlerBase<LSP.DocumentFormattingParams, LSP.TextEdit[]> 27public override Task<LSP.TextEdit[]> HandleRequestAsync(LSP.DocumentFormattingParams request, RequestContext context, CancellationToken cancellationToken)
Implementation\LanguageServer\Handler\Formatting\FormatDocumentOnTypeHandler.cs (3)
21internal sealed class FormatDocumentOnTypeHandler : ILspServiceRequestHandler<DocumentOnTypeFormattingParams, TextEdit[]> 34public async Task<TextEdit[]> HandleRequestAsync(DocumentOnTypeFormattingParams request, RequestContext context, CancellationToken cancellationToken) 41using var _ = ArrayBuilder<TextEdit>.GetInstance(out var edits);
Implementation\LanguageServer\Handler\Formatting\FormatDocumentRangeHandler.cs (2)
17internal sealed class FormatDocumentRangeHandler : AbstractFormatDocumentHandlerBase<DocumentRangeFormattingParams, TextEdit[]> 27public override Task<TextEdit[]> HandleRequestAsync(DocumentRangeFormattingParams request, RequestContext context, CancellationToken cancellationToken)