Skip to content

Commit d96ce21

Browse files
authored
Additional feedback for "allowing Razor completion items on deletion" PR (#11996)
1 parent 67b5515 commit d96ce21

File tree

2 files changed

+0
-74
lines changed

2 files changed

+0
-74
lines changed

src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Completion/RazorCompletionListProvider.cs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using System;
55
using System.Collections.Generic;
66
using System.Collections.Immutable;
7-
using System.Diagnostics;
87
using System.Diagnostics.CodeAnalysis;
98
using System.Linq;
109
using Microsoft.AspNetCore.Razor;
@@ -38,11 +37,6 @@ internal class RazorCompletionListProvider(
3837
HashSet<string>? existingCompletions,
3938
RazorCompletionOptions completionOptions)
4039
{
41-
if (!IsApplicableTriggerContext(completionContext))
42-
{
43-
return null;
44-
}
45-
4640
var reason = completionContext.TriggerKind switch
4741
{
4842
CompletionTriggerKind.TriggerForIncompleteCompletions => CompletionReason.Invoked,
@@ -262,24 +256,4 @@ internal static bool TryConvert(
262256
completionItem = null;
263257
return false;
264258
}
265-
266-
// Internal for testing
267-
internal static bool IsApplicableTriggerContext(CompletionContext context)
268-
{
269-
if (context is not VSInternalCompletionContext vsCompletionContext)
270-
{
271-
Debug.Fail("Completion context should always be converted into a VSCompletionContext (even in VSCode).");
272-
273-
// We do not support providing completions on delete.
274-
return false;
275-
}
276-
277-
if (vsCompletionContext.TriggerKind == CompletionTriggerKind.TriggerForIncompleteCompletions)
278-
{
279-
// For incomplete completions we want to re-provide information if we would have originally.
280-
return true;
281-
}
282-
283-
return true;
284-
}
285259
}

src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/Completion/RazorCompletionListProviderTest.cs

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -61,54 +61,6 @@ private static IRazorCompletionItemProvider[] GetCompletionProviders()
6161
new TagHelperCompletionProvider(new TagHelperCompletionService())
6262
];
6363

64-
[Fact]
65-
public void IsApplicableTriggerContext_Deletion_ReturnsTrue()
66-
{
67-
// Arrange
68-
var completionContext = new VSInternalCompletionContext()
69-
{
70-
InvokeKind = VSInternalCompletionInvokeKind.Deletion
71-
};
72-
73-
// Act
74-
var result = RazorCompletionListProvider.IsApplicableTriggerContext(completionContext);
75-
76-
// Assert
77-
Assert.True(result);
78-
}
79-
80-
[Fact]
81-
public void IsApplicableTriggerContext_Explicit_ReturnsTrue()
82-
{
83-
// Arrange
84-
var completionContext = new VSInternalCompletionContext()
85-
{
86-
InvokeKind = VSInternalCompletionInvokeKind.Explicit
87-
};
88-
89-
// Act
90-
var result = RazorCompletionListProvider.IsApplicableTriggerContext(completionContext);
91-
92-
// Assert
93-
Assert.True(result);
94-
}
95-
96-
[Fact]
97-
public void IsApplicableTriggerContext_Typing_ReturnsTrue()
98-
{
99-
// Arrange
100-
var completionContext = new VSInternalCompletionContext()
101-
{
102-
InvokeKind = VSInternalCompletionInvokeKind.Typing
103-
};
104-
105-
// Act
106-
var result = RazorCompletionListProvider.IsApplicableTriggerContext(completionContext);
107-
108-
// Assert
109-
Assert.True(result);
110-
}
111-
11264
[Fact]
11365
public void TryConvert_Directive_ReturnsTrue()
11466
{

0 commit comments

Comments
 (0)