Skip to content

Merge CompletionServiceWithProviders into CompletionService#61943

Merged
genlu merged 15 commits intodotnet:mainfrom
genlu:CombineCompletionService
Jun 28, 2022
Merged

Merge CompletionServiceWithProviders into CompletionService#61943
genlu merged 15 commits intodotnet:mainfrom
genlu:CombineCompletionService

Conversation

@genlu
Copy link
Copy Markdown
Member

@genlu genlu commented Jun 15, 2022

See #61977 for more details on the change.

@ghost ghost added the Area-IDE label Jun 15, 2022

internal abstract CompletionRules GetRulesImpl();

internal sealed override void FilterItems(
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is added so we can move TS to use the internal overload instead, which will provide some perf benefit plus we can then make the public overload non-virtual.

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

image

This is fine (and i don't think needs reviews). We've established that adding/removing overrides isn't an ABI/API break (as long as the overrides don't use covariant returns, and have the same parameter names.

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

image

I believe this is also safe. virt to non-virt is not a break. All the existing virtcalls will work properly even if hte methods become non-virt.


return false;
return completionService.ShouldTriggerCompletion(
document.Project, document.Project.LanguageServices, sourceText, triggerLocation.Position, roslynTrigger, options, document.Project.Solution.Options, _roles);
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated to the merge, but we didn't pass in TextView roles to the method call, which is fixed here

/// </summary>
[Obsolete("Built-in providers will be ignored in a future release, please make them MEF exports instead.")]
protected virtual ImmutableArray<CompletionProvider> GetBuiltInProviders()
=> ImmutableArray<CompletionProvider>.Empty;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does anyone override this? can we remove now (or in a quick followup pr?)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/// <remarks>
/// Backward compatibility only.
/// </remarks>
public CompletionRules GetRules()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider obsoleting in future PR.

}

internal virtual bool SupportsTriggerOnDeletion(CompletionOptions options)
=> options.TriggerOnDeletion == true;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is thsi overridden?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but only in VB

internal virtual async Task<CompletionDescription?> GetDescriptionAsync(Document document, CompletionItem item, CompletionOptions options, SymbolDescriptionOptions displayOptions, CancellationToken cancellationToken = default)
{
var provider = GetProvider(item);
if (provider is null)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this happen?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe it's possible if the item is created "properly" via our system, but theoretically someone could pass in an arbitrary item they created themselves. So we'd need this in place to guard that

{
return Task.FromResult(CompletionChange.Create(new TextChange(item.Span, item.DisplayText)));
var provider = GetProvider(item);
if (provider != null)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this now ever be null?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, see comment here
#61943 (comment)

}

public void SuppressPartialSemantics()
=> _completionServiceWithProviders._suppressPartialSemantics = true;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice :)

{
return GetEnumerator();
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was this a basic port? did you change anything? this will be easier to review if you put this in the CompletionServiceWithProviders file. then once the review it over, break into separate file.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no code change in the method bodies. I have code movement in separate commits, which should show you what changed clearer than review everything

Copy link
Copy Markdown
Contributor

@CyrusNajmabadi CyrusNajmabadi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome. we should still take to API review to validate the rules on ABI compat. But i think this is 100% safe.

@genlu genlu marked this pull request as ready for review June 16, 2022 18:38
@genlu genlu requested review from a team as code owners June 16, 2022 18:38
@genlu genlu added the IDE-IntelliSense Completion, Signature Help, Quick Info label Jun 16, 2022
@genlu genlu linked an issue Jun 17, 2022 that may be closed by this pull request
@genlu genlu marked this pull request as draft June 17, 2022 17:41
@genlu
Copy link
Copy Markdown
Member Author

genlu commented Jun 17, 2022

Mark this as draft until approved by API board

@genlu genlu marked this pull request as ready for review June 23, 2022 21:22
@genlu
Copy link
Copy Markdown
Member Author

genlu commented Jun 23, 2022

API change is approved, ready for review

@genlu genlu closed this Jun 28, 2022
@genlu genlu reopened this Jun 28, 2022
@genlu genlu enabled auto-merge June 28, 2022 02:07
@genlu genlu merged commit ba0c3fa into dotnet:main Jun 28, 2022
@ghost ghost added this to the Next milestone Jun 28, 2022
@RikkiGibson RikkiGibson modified the milestones: Next, 17.3 P3 Jun 28, 2022
@genlu genlu deleted the CombineCompletionService branch June 29, 2022 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-IDE IDE-IntelliSense Completion, Signature Help, Quick Info

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Merge CompletionServiceWithProviders into CompletionService

3 participants