1 type derived from TextEdit
Microsoft.CodeAnalysis.LanguageServer.Protocol (1)
Protocol\AnnotatedTextEdit.cs (1)
16
internal sealed class AnnotatedTextEdit :
TextEdit
38 instantiations of TextEdit
Microsoft.CodeAnalysis.LanguageServer.Protocol (9)
Extensions\ProtocolConversions.cs (3)
360
return new LSP.
TextEdit
460
uriToTextEdits.Add((CreateAbsoluteDocumentUri(mappedSpan.FilePath), new LSP.
TextEdit
499
uriToTextEdits.Add((CreateAbsoluteDocumentUri(filePath), new LSP.
TextEdit
Handler\CodeActions\CodeActionResolveHelper.cs (1)
259
var edit = new
TextEdit
{ Range = emptyDocumentRange, NewText = newText.ToString() };
Handler\Completion\CompletionResultFactory.cs (3)
508
lspItem.TextEdit = new LSP.
TextEdit
()
554
builder.Add(new LSP.
TextEdit
()
699
var textEdit = new LSP.
TextEdit
()
Handler\OnAutoInsert\OnAutoInsertHandler.cs (2)
153
TextEdit = new LSP.
TextEdit
218
TextEdit = new LSP.
TextEdit
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (27)
CodeActions\CodeActionResolveTests.cs (5)
316
new
TextEdit
()
346
new
TextEdit
()
447
new
TextEdit
()
476
new
TextEdit
()
524
=>
new
()
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) } };
242
var expectedAdditionalEdit = new
TextEdit
() { NewText = "using NS2;\r\n\r\n", Range = new() { Start = new(1, 0), End = new(1, 0) } };
301
var expectedEdit = new
TextEdit
{ Range = new LSP.Range { Start = new(1, 5), End = new(1, 9) }, NewText = "summary" };
730
var expectedAdditionalEdit1 = new
TextEdit
() { NewText = "using Namespace1;\r\n\r\n", Range = new() { Start = new(1, 0), End = new(1, 0) } };
738
var expectedAdditionalEdit2 = new
TextEdit
() { NewText = "using Namespace2;\r\n\r\n", Range = new() { Start = new(1, 0), End = new(1, 0) } };
1004
var expectedEdit = new
TextEdit
{ Range = new LSP.Range { Start = new(0, 5), End = new(0, 5) }, NewText = "ComplexItem" };
1061
var 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)
703
var textEdit = new LSP.
TextEdit
{ Range = textLocation.Range, NewText = "partial " };
Rename\RenameTests.cs (11)
48
var expectedEdits = testLspServer.GetLocations("renamed").Select(location => new LSP.
TextEdit
() { NewText = renameValue, Range = location.Range });
103
var expectedEdits = testLspServer.GetLocations("renamed").Select(location => new LSP.
TextEdit
() { NewText = renameValue, Range = location.Range });
148
var expectedEdits = testLspServer.GetLocations("renamed").Select(location => new LSP.
TextEdit
() { NewText = renameValue, Range = location.Range });
228
var expectedEdits = testLspServer.GetLocations("renamed").Select(location => new LSP.
TextEdit
() { NewText = renameValue, Range = location.Range });
281
var expectedEdits = testLspServer.GetLocations("renamed").Select(location => new LSP.
TextEdit
() { NewText = renameValue, Range = location.Range });
282
var expectedGeneratedEdits = spans["renamed"].Select(span => new LSP.
TextEdit
() { NewText = renameValue, Range = ProtocolConversions.TextSpanToRange(span, generatedSourceText) });
334
var expectedEdits = testLspServer.GetLocations("renamed").Select(location => new LSP.
TextEdit
() { NewText = renameValue, Range = location.Range });
335
var expectedGeneratedEdits = spans["renamed"].Select(span => new LSP.
TextEdit
() { NewText = renameValue, Range = ProtocolConversions.TextSpanToRange(span, generatedSourceText) });
394
var expectedEdits = testLspServer.GetLocations("renamed").Select(location => new LSP.
TextEdit
() { NewText = renameValue, Range = location.Range });
395
var expectedGeneratedEdits = spans["renamed"].Select(span => new LSP.
TextEdit
() { NewText = renameValue, Range = ProtocolConversions.TextSpanToRange(span, generatedSourceText) });
447
var expectedGeneratedEdits = spans["renamed"].Select(span => new LSP.
TextEdit
() { NewText = renameValue, Range = ProtocolConversions.TextSpanToRange(span, generatedSourceText) });
SimplifyMethod\SimplifyMethodTests.cs (2)
39
var expectedEdit = new
TextEdit
()
59
TextEdit = new
TextEdit
() { Range = location.Range, NewText = newText },
Microsoft.VisualStudio.LanguageServices.Xaml (2)
Implementation\LanguageServer\Handler\Completion\CompletionHandler.cs (1)
102
item.TextEdit = new
TextEdit
Implementation\LanguageServer\Handler\OnAutoInsert\OnAutoInsertHandler.cs (1)
67
TextEdit = new
TextEdit
88 references to TextEdit
Microsoft.CodeAnalysis.ExternalAccess.Razor.Features (2)
Cohost\Handlers\CodeActions.cs (2)
78
public static Task<
TextEdit
[]> GetSimplifiedEditsAsync(Document document,
TextEdit
textEdit, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.LanguageServer.Protocol (50)
Extensions\ProtocolConversions.cs (4)
357
public static LSP.
TextEdit
TextChangeToTextEdit(TextChange textChange, SourceText oldText)
367
public static TextChange TextEditToTextChange(LSP.
TextEdit
edit, SourceText oldText)
417
using var _ = ArrayBuilder<(DocumentUri Uri, LSP.
TextEdit
TextEdit)>.GetInstance(out var uriToTextEdits);
519
var 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)
20
internal class SimplifyMethodHandler : ILspServiceDocumentRequestHandler<SimplifyMethodParams,
TextEdit
[]?>
36
public async Task<
TextEdit
[]?> HandleRequestAsync(
46
var
textEdit = request.TextEdit;
51
internal static async Task<
TextEdit
[]> GetSimplifiedEditsAsync(Document originalDocument,
TextEdit
textEdit, CancellationToken cancellationToken)
ExternalAccess\Razor\SimplifyMethodParams.cs (1)
26
public required
TextEdit
TextEdit { get; set; }
Handler\CodeActions\CodeActionResolveHelper.cs (2)
259
var
edit = new TextEdit { Range = emptyDocumentRange, NewText = newText.ToString() };
299
var edits = textChanges.Select(tc => new LSP.SumType<LSP.
TextEdit
, LSP.AnnotatedTextEdit>(ProtocolConversions.TextChangeToTextEdit(tc, oldText))).ToArray();
Handler\Completion\CompletionResultFactory.cs (4)
538
public static async Task<LSP.
TextEdit
[]?> GenerateAdditionalTextEditForImportCompletionAsync(
548
using var _ = ArrayBuilder<LSP.
TextEdit
>.GetInstance(out var builder);
683
public static async Task<(LSP.
TextEdit
edit, bool isSnippetString, int? newPosition)> GenerateComplexTextEditAsync(
699
var
textEdit = new LSP.TextEdit()
Handler\Formatting\AbstractFormatDocumentHandlerBase.cs (1)
24
protected static async Task<LSP.
TextEdit
[]?> GetTextEditsAsync(
Handler\Formatting\FormatDocumentHandler.cs (2)
19
internal sealed class FormatDocumentHandler(IGlobalOptionService globalOptions) : AbstractFormatDocumentHandlerBase<LSP.DocumentFormattingParams, LSP.
TextEdit
[]?>
25
public override Task<LSP.
TextEdit
[]?> HandleRequestAsync(
Handler\Formatting\FormatDocumentOnTypeHandler.cs (2)
23
internal sealed class FormatDocumentOnTypeHandler : ILspServiceDocumentRequestHandler<DocumentOnTypeFormattingParams,
TextEdit
[]?>
39
public async Task<
TextEdit
[]?> HandleRequestAsync(
Handler\Formatting\FormatDocumentRangeHandler.cs (2)
19
internal sealed class FormatDocumentRangeHandler(IGlobalOptionService globalOptions) : AbstractFormatDocumentHandlerBase<DocumentRangeFormattingParams,
TextEdit
[]?>
25
public override Task<
TextEdit
[]?> HandleRequestAsync(
Handler\InlayHint\InlayHintHandler.cs (2)
77
TextEdit
[]? textEdits = null;
80
var
textEdit = ProtocolConversions.TextChangeToTextEdit(hint.ReplacementTextChange.Value, text);
Handler\MapCode\MapCodeHandler.cs (4)
45
using var _ = PooledDictionary<DocumentUri, LSP.
TextEdit
[]>.GetInstance(out var uriToEditsMap);
50
if (mappingResult is not (DocumentUri uri, LSP.
TextEdit
[] textEdits))
68
Edits = [.. kvp.Value.Select(v => new SumType<LSP.
TextEdit
, LSP.AnnotatedTextEdit>(v))],
80
async Task<(DocumentUri, LSP.
TextEdit
[])?> MapCodeAsync(LSP.VSInternalMapCodeMapping codeMapping)
Handler\OnAutoInsert\OnAutoInsertHandler.cs (1)
302
var
edit = ProtocolConversions.TextChangeToTextEdit(textChange.Value, sourceText);
Handler\Rename\WillRenameHandler.cs (3)
31
using var _1 = PooledDictionary<string, ArrayBuilder<
TextEdit
>>.GetInstance(out var changesBuilder);
49
existingEdits = ArrayBuilder<
TextEdit
>.GetInstance();
84
var changes = new Dictionary<string,
TextEdit
[]>();
Protocol\ColorPresentation.cs (4)
29
/// A <see cref="Protocol.
TextEdit
"/> which is applied to a document when selecting this presentation for the color.
36
public
TextEdit
? TextEdit { get; init; }
39
/// An optional array of additional <see cref="Protocol.
TextEdit
"/> that are applied
47
public
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.
227
public SumType<
TextEdit
, InsertReplaceEdit>? TextEdit
268
public
TextEdit
[]? AdditionalTextEdits
Protocol\InlayHint.cs (1)
74
public
TextEdit
[]? TextEdits
Protocol\Internal\VSInternalDocumentOnAutoInsertResponseItem.cs (1)
35
public
TextEdit
TextEdit
Protocol\Methods.Document.cs (3)
532
public static readonly LspRequest<DocumentFormattingParams,
TextEdit
[]?> TextDocumentFormatting = new(TextDocumentFormattingName);
548
public static readonly LspRequest<DocumentRangeFormattingParams,
TextEdit
[]?> TextDocumentRangeFormatting = new(TextDocumentRangeFormattingName);
564
public static readonly LspRequest<DocumentOnTypeFormattingParams,
TextEdit
[]?> TextDocumentOnTypeFormatting = new(TextDocumentOnTypeFormattingName);
Protocol\Methods.DocumentSynchronization.cs (1)
75
public static readonly LspRequest<WillSaveTextDocumentParams,
TextEdit
[]?> TextDocumentWillSaveWaitUntil = new(TextDocumentWillSaveWaitUntilName);
Protocol\TextDocumentEdit.cs (1)
39
public SumType<
TextEdit
, AnnotatedTextEdit>[] Edits { get; set; }
Protocol\WorkspaceEdit.cs (2)
23
public Dictionary<string,
TextEdit
[]>? Changes { get; set; }
36
/// <see cref="WorkspaceEditSetting.ResourceOperations"/> then only plain <see cref="
TextEdit
"/>s
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (26)
CodeActions\CodeActionResolveTests.cs (5)
59
var expectedTextEdits = new SumType<
TextEdit
, AnnotatedTextEdit>[]
116
var expectedTextEdits = new SumType<
TextEdit
, AnnotatedTextEdit>[]
245
var edits = textDocumentEdit[0].Edits.Select(e => (LSP.
TextEdit
)e.Value!).ToArray();
523
private static LSP.
TextEdit
GenerateTextEdit(string newText, LSP.Range range)
532
SumType<
TextEdit
, AnnotatedTextEdit>[] edits)
Completion\CompletionFeaturesTests.cs (7)
155
TextEdit
expectedAdditionalEdit = isInUsingStatement
242
var
expectedAdditionalEdit = new TextEdit() { NewText = "using NS2;\r\n\r\n", Range = new() { Start = new(1, 0), End = new(1, 0) } };
301
var
expectedEdit = new TextEdit { Range = new LSP.Range { Start = new(1, 5), End = new(1, 9) }, NewText = "summary" };
730
var
expectedAdditionalEdit1 = new TextEdit() { NewText = "using Namespace1;\r\n\r\n", Range = new() { Start = new(1, 0), End = new(1, 0) } };
738
var
expectedAdditionalEdit2 = new TextEdit() { NewText = "using Namespace2;\r\n\r\n", Range = new() { Start = new(1, 0), End = new(1, 0) } };
1004
var
expectedEdit = new TextEdit { Range = new LSP.Range { Start = new(0, 5), End = new(0, 5) }, NewText = "ComplexItem" };
1061
var
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)
634
var
textEdit = GenerateTextEdit(@"\\A", startLine: 5, startChar: 19, endLine: 5, endChar: 19);
Diagnostics\PullDiagnosticTests.cs (1)
703
var
textEdit = new LSP.TextEdit { Range = textLocation.Range, NewText = "partial " };
Formatting\FormatDocumentOnTypeTests.cs (1)
175
var results = await testLspServer.ExecuteRequestAsync<LSP.DocumentOnTypeFormattingParams, LSP.
TextEdit
[]>(
Formatting\FormatDocumentRangeTests.cs (2)
83
private static async Task<LSP.
TextEdit
[]> RunFormatDocumentRangeAsync(
89
return await testLspServer.ExecuteRequestAsync<LSP.DocumentRangeFormattingParams, LSP.
TextEdit
[]>(
Formatting\FormatDocumentTests.cs (2)
308
private static async Task<LSP.
TextEdit
[]?> RunFormatDocumentAsync(
314
return await testLspServer.ExecuteRequestAsync<LSP.DocumentFormattingParams, LSP.
TextEdit
[]>(LSP.Methods.TextDocumentFormattingName,
MapCode\MapCodeTests.cs (1)
101
TextEdit
[]? edits;
Rename\WillRenameTests.cs (3)
124
Changes = new Dictionary<string,
TextEdit
[]>
131
listeners[0].Result = new WorkspaceEdit() { Changes = new Dictionary<string,
TextEdit
[]> { { "file://file1.cs", [] } } };
132
listeners[1].Result = new WorkspaceEdit() { Changes = new Dictionary<string,
TextEdit
[]> { { "file://file2.cs", [] } } };
SimplifyMethod\SimplifyMethodTests.cs (3)
39
var
expectedEdit = new TextEdit()
50
private static async Task<
TextEdit
[]?> RunRenameAsync(TestLspServer testLspServer, SimplifyMethodParams @params)
52
return 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)
26
protected async Task<LSP.
TextEdit
[]> GetTextEditsAsync(LSP.FormattingOptions formattingOptions, RequestContext context, CancellationToken cancellationToken, LSP.Range? range = null)
28
using var _ = ArrayBuilder<LSP.
TextEdit
>.GetInstance(out var edits);
Implementation\LanguageServer\Handler\Formatting\FormatDocumentHandler.cs (2)
17
internal sealed class FormatDocumentHandler : AbstractFormatDocumentHandlerBase<LSP.DocumentFormattingParams, LSP.
TextEdit
[]>
27
public override Task<LSP.
TextEdit
[]> HandleRequestAsync(LSP.DocumentFormattingParams request, RequestContext context, CancellationToken cancellationToken)
Implementation\LanguageServer\Handler\Formatting\FormatDocumentOnTypeHandler.cs (3)
21
internal sealed class FormatDocumentOnTypeHandler : ILspServiceRequestHandler<DocumentOnTypeFormattingParams,
TextEdit
[]>
34
public async Task<
TextEdit
[]> HandleRequestAsync(DocumentOnTypeFormattingParams request, RequestContext context, CancellationToken cancellationToken)
41
using var _ = ArrayBuilder<
TextEdit
>.GetInstance(out var edits);
Implementation\LanguageServer\Handler\Formatting\FormatDocumentRangeHandler.cs (2)
17
internal sealed class FormatDocumentRangeHandler : AbstractFormatDocumentHandlerBase<DocumentRangeFormattingParams,
TextEdit
[]>
27
public override Task<
TextEdit
[]> HandleRequestAsync(DocumentRangeFormattingParams request, RequestContext context, CancellationToken cancellationToken)