Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option for element completion commit characters #9379

Merged
merged 11 commits into from
Oct 9, 2023
Prev Previous commit
Remove unused parameter
  • Loading branch information
davidwengier committed Oct 8, 2023
commit 2df13ffefec06563c9dbd0ec556150f46e89beb9
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ internal class RazorCompletionListProvider
{
private readonly IRazorCompletionFactsService _completionFactsService;
private readonly CompletionListCache _completionListCache;
private readonly RazorLSPOptionsMonitor _razorLSPOptionsMonitor;
private readonly ILogger<RazorCompletionListProvider> _logger;
private static readonly Command s_retriggerCompletionCommand = new()
{
Expand All @@ -34,12 +33,10 @@ internal class RazorCompletionListProvider
public RazorCompletionListProvider(
IRazorCompletionFactsService completionFactsService,
CompletionListCache completionListCache,
RazorLSPOptionsMonitor razorLSPOptionsMonitor,
ILoggerFactory loggerFactory)
{
_completionFactsService = completionFactsService;
_completionListCache = completionListCache;
_razorLSPOptionsMonitor = razorLSPOptionsMonitor;
_logger = loggerFactory.CreateLogger<RazorCompletionListProvider>();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public TestRazorCompletionListProvider(
VSInternalCompletionList completionList,
IEnumerable<string> triggerCharacters,
ILoggerFactory loggerFactory)
: base(null, null, TestRazorLSPOptionsMonitor.Create(), loggerFactory)
: base(null, null, loggerFactory)
{
_completionList = completionList;
TriggerCharacters = triggerCharacters.ToImmutableHashSet();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ public async Task GetCompletionListAsync_ProvidesDirectiveCompletionItems()
var documentPath = "C:/path/to/document.cshtml";
var codeDocument = CreateCodeDocument("@");
var documentContext = TestDocumentContext.From(documentPath, codeDocument, hostDocumentVersion: 0);
var provider = new RazorCompletionListProvider(_completionFactsService, _completionListCache, TestRazorLSPOptionsMonitor.Create(), LoggerFactory);
var provider = new RazorCompletionListProvider(_completionFactsService, _completionListCache, LoggerFactory);

// Act
var completionList = await provider.GetCompletionListAsync(
Expand Down Expand Up @@ -390,7 +390,7 @@ public async Task GetCompletionListAsync_ProvidesDirectiveCompletions_Incomplete
TriggerKind = CompletionTriggerKind.TriggerForIncompleteCompletions,
InvokeKind = VSInternalCompletionInvokeKind.Deletion,
};
var provider = new RazorCompletionListProvider(_completionFactsService, _completionListCache, TestRazorLSPOptionsMonitor.Create(), LoggerFactory);
var provider = new RazorCompletionListProvider(_completionFactsService, _completionListCache, LoggerFactory);

// Act
var completionList = await provider.GetCompletionListAsync(
Expand Down Expand Up @@ -418,7 +418,7 @@ public async Task GetCompletionListAsync_ProvidesInjectOnIncomplete_KeywordIn()
var codeDocument = CreateCodeDocument("@in");
codeDocument.SetTagHelperContext(tagHelperContext);
var documentContext = TestDocumentContext.From(documentPath, codeDocument, hostDocumentVersion: 0);
var provider = new RazorCompletionListProvider(_completionFactsService, _completionListCache, TestRazorLSPOptionsMonitor.Create(), LoggerFactory);
var provider = new RazorCompletionListProvider(_completionFactsService, _completionListCache, LoggerFactory);
var completionContext = new VSInternalCompletionContext()
{
TriggerKind = CompletionTriggerKind.TriggerForIncompleteCompletions,
Expand Down Expand Up @@ -452,7 +452,7 @@ public async Task GetCompletionListAsync_DoesNotProvideInjectOnInvoked()
var codeDocument = CreateCodeDocument("@inje");
codeDocument.SetTagHelperContext(tagHelperContext);
var documentContext = TestDocumentContext.From(documentPath, codeDocument, hostDocumentVersion: 0);
var provider = new RazorCompletionListProvider(_completionFactsService, _completionListCache, TestRazorLSPOptionsMonitor.Create(), LoggerFactory);
var provider = new RazorCompletionListProvider(_completionFactsService, _completionListCache, LoggerFactory);
var completionContext = new VSInternalCompletionContext()
{
TriggerKind = CompletionTriggerKind.TriggerCharacter,
Expand Down Expand Up @@ -480,7 +480,7 @@ public async Task GetCompletionListAsync_ProvidesInjectOnIncomplete()
var codeDocument = CreateCodeDocument("@inje");
codeDocument.SetTagHelperContext(tagHelperContext);
var documentContext = TestDocumentContext.From(documentPath, codeDocument, hostDocumentVersion: 0);
var provider = new RazorCompletionListProvider(_completionFactsService, _completionListCache, TestRazorLSPOptionsMonitor.Create(), LoggerFactory);
var provider = new RazorCompletionListProvider(_completionFactsService, _completionListCache, LoggerFactory);
var completionContext = new VSInternalCompletionContext()
{
TriggerKind = CompletionTriggerKind.TriggerForIncompleteCompletions,
Expand Down Expand Up @@ -515,7 +515,7 @@ public async Task GetCompletionListAsync_ProvidesTagHelperElementCompletionItems
var codeDocument = CreateCodeDocument("<");
codeDocument.SetTagHelperContext(tagHelperContext);
var documentContext = TestDocumentContext.From(documentPath, codeDocument, hostDocumentVersion: 0);
var provider = new RazorCompletionListProvider(_completionFactsService, _completionListCache, TestRazorLSPOptionsMonitor.Create(), LoggerFactory);
var provider = new RazorCompletionListProvider(_completionFactsService, _completionListCache, LoggerFactory);

// Act
var completionList = await provider.GetCompletionListAsync(
Expand Down Expand Up @@ -545,7 +545,7 @@ public async Task GetCompletionListAsync_ProvidesTagHelperAttributeItems()
var codeDocument = CreateCodeDocument("<test ");
codeDocument.SetTagHelperContext(tagHelperContext);
var documentContext = TestDocumentContext.From(documentPath, codeDocument, hostDocumentVersion: 0);
var provider = new RazorCompletionListProvider(_completionFactsService, _completionListCache, TestRazorLSPOptionsMonitor.Create(), LoggerFactory);
var provider = new RazorCompletionListProvider(_completionFactsService, _completionListCache, LoggerFactory);

// Act
var completionList = await provider.GetCompletionListAsync(
Expand Down Expand Up @@ -580,7 +580,7 @@ public async Task GetCompletionListAsync_ProvidesTagHelperAttributeItems_Attribu
await optionsMonitor.UpdateAsync(optionsMonitor.CurrentValue with { AutoInsertAttributeQuotes = false }, DisposalToken);

var completionFactsService = new RazorCompletionFactsService(GetCompletionProviders(optionsMonitor));
var provider = new RazorCompletionListProvider(completionFactsService, _completionListCache, TestRazorLSPOptionsMonitor.Create(), LoggerFactory);
var provider = new RazorCompletionListProvider(completionFactsService, _completionListCache, LoggerFactory);

// Act
var completionList = await provider.GetCompletionListAsync(
Expand Down
Loading