Skip to content

Commit

Permalink
Merge pull request #1 from alexgav/dev/alexgav/FixExternalRazorComple…
Browse files Browse the repository at this point in the history
…tionAPI

Access services on Solution rather than Workspace
  • Loading branch information
alexgav authored Oct 17, 2024
2 parents e114b11 + 761a133 commit 8cb765f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Features/Core/Portable/Completion/CompletionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public virtual TextSpan GetDefaultCompletionListSpan(SourceText text, int caretP
if (provider is null)
return CompletionDescription.Empty;

var extensionManager = document.Project.Solution.Workspace.Services.GetRequiredService<IExtensionManager>();
var extensionManager = document.Project.Solution.Services.GetRequiredService<IExtensionManager>();

// We don't need SemanticModel here, just want to make sure it won't get GC'd before CompletionProviders are able to get it.
(document, var semanticModel) = await GetDocumentWithFrozenPartialSemanticsAsync(document, cancellationToken).ConfigureAwait(false);
Expand Down Expand Up @@ -243,7 +243,7 @@ public virtual async Task<CompletionChange> GetChangeAsync(
var provider = GetProvider(item, document.Project);
if (provider != null)
{
var extensionManager = document.Project.Solution.Workspace.Services.GetRequiredService<IExtensionManager>();
var extensionManager = document.Project.Solution.Services.GetRequiredService<IExtensionManager>();

// We don't need SemanticModel here, just want to make sure it won't get GC'd before CompletionProviders are able to get it.
(document, var semanticModel) = await GetDocumentWithFrozenPartialSemanticsAsync(document, cancellationToken).ConfigureAwait(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ ImmutableArray<CompletionProvider> GetTriggeredProviders(
static async Task<ImmutableArray<CompletionProvider>> GetAugmentingProvidersAsync(
Document document, ImmutableArray<CompletionProvider> triggeredProviders, int caretPosition, CompletionTrigger trigger, CompletionOptions options, CancellationToken cancellationToken)
{
var extensionManager = document.Project.Solution.Workspace.Services.GetRequiredService<IExtensionManager>();
var extensionManager = document.Project.Solution.Services.GetRequiredService<IExtensionManager>();
var additionalAugmentingProviders = ArrayBuilder<CompletionProvider>.GetInstance(triggeredProviders.Length);
if (trigger.Kind == CompletionTriggerKind.Insertion)
{
Expand Down Expand Up @@ -327,7 +327,7 @@ private static async Task<CompletionContext> GetContextAsync(
SharedSyntaxContextsWithSpeculativeModel? sharedContext,
CancellationToken cancellationToken)
{
var extensionManager = document.Project.Solution.Workspace.Services.GetRequiredService<IExtensionManager>();
var extensionManager = document.Project.Solution.Services.GetRequiredService<IExtensionManager>();

var context = new CompletionContext(provider, document, position, sharedContext, defaultSpan, triggerInfo, options, cancellationToken);

Expand Down

0 comments on commit 8cb765f

Please sign in to comment.