Switch AsyncCompletion to new pooled CompletionItemList based APIs#61477
Switch AsyncCompletion to new pooled CompletionItemList based APIs#61477genlu merged 19 commits intodotnet:main-vs-depsfrom
Conversation
| referencing what we need out of the macos SDK. --> | ||
| <PackageDownload Include="Microsoft.macOS.Ref" Version="[$(MicrosoftmacOSRefVersion)]" /> | ||
| <Reference Include="$(NuGetPackageRoot)microsoft.macos.ref\$(MicrosoftmacOSRefVersion)\ref\net6.0\Xamarin.Mac.dll" /> | ||
| <Reference Include="$(NuGetPackageRoot)microsoft.macos.ref\$(MicrosoftmacOSRefVersion)\ref\net6.0\Microsoft.macOS.dll" /> |
There was a problem hiding this comment.
@sandyarmstrong this is (one of) the same change as you're making in #61250
Is this a problem? Or do we need to wait for the 6.0.300 bump in VS Mac?
There was a problem hiding this comment.
Ping @sandyarmstrong, could you please take a look at this and let me know if it's OK? Thanks
There was a problem hiding this comment.
You should merge #61250 first. But then we will not be able to insert Roslyn with this change for at least a few days while we finish up the work to bump VSMac to use the 6.0.300 SDK and the newer macos workload.
There was a problem hiding this comment.
But then we will not be able to insert Roslyn with this change for at least a few days
@davidwengier Would this be a problem in case we need to merge this sooner?
There was a problem hiding this comment.
I merged #61250, we should be ready to consume it in VSMac in the next few days.
d7f1e17 to
46d939c
Compare
This reverts commit c44e868.
|
The referenced version of editor package in latest commit is pending insertion |
| } | ||
| } | ||
|
|
||
| private static SegmentedList<VSCompletionItem> SortCompletionitems(IAsyncCompletionSession session, AsyncCompletionSessionInitialDataSnapshot data) |
There was a problem hiding this comment.
- ideally move this next to the caller.
| return items; | ||
| } | ||
|
|
||
| private sealed class VSItemComparer : IComparer<VSCompletionItem> |
There was a problem hiding this comment.
would it be possible for us to jsut expose this IComparer to the caller so that they can own smart data management and sorting? we jsut own comparing?
There was a problem hiding this comment.
Yea, sounds good to me, I will bring this up with Editor team.
There was a problem hiding this comment.
what's the result of this talk?
|
Done with pass :) |
…nSource.cs Co-authored-by: CyrusNajmabadi <cyrus.najmabadi@gmail.com>
…nSource.cs Co-authored-by: CyrusNajmabadi <cyrus.najmabadi@gmail.com>
|
@CyrusNajmabadi PTAL, thanks! |
|
Integration tests seem to be totally broken. :( |
| itemsBuilder.AddRange(context1.Items); | ||
| itemsBuilder.AddRange(context2.Items); | ||
|
|
||
| var completionList = session.CreateCompletionList(context1.ItemList.Concat(context2.ItemList)); |
There was a problem hiding this comment.
which .Concat is this? is it a single alloc that just streams over both lists? or is it an O(N) alloc that copies everything into a new list?
There was a problem hiding this comment.
I think this is the one streams over both lists w/o copying (System.Linq.Enumerable.Concat)
| itemsBuilder.AddRange(data.InitialSortedList); | ||
| itemsBuilder.AddRange(expandedContext.Items); | ||
| var combinedList = itemsBuilder.MoveToImmutable(); | ||
| var combinedItemList = session.CreateCompletionList(data.InitialSortedItemList.Concat(expandedContext.ItemList)); |
There was a problem hiding this comment.
same question about this concat. is it a single-alloc? or an O(n) copy?
|
CompletionList is now: public sealed class CompletionList<T> : IReadOnlyList<T>, IDisposableWho is expected to dispose this. Note: calling this CompletionList was very confusing as i thought that meant it was a list of completoin items. When really it's just a list of anything, it's just used in completion. |
IT's associated to a async completion session, and Editor will free them after the session is done (dismissed/committed/etc) |
|
I agree CompletionList<T> is somewhat confusing name. It reflects existing state of completion API where completion items are passed as ImmutableArray<CompletionItem> and also ImmutableArray<CompletionItemWithHighlight> and CompletionItem and CompletionItemWithHighlight types do not have common supertype... |
|
I'm pretty ok with teh code. But i would like some sort of integration test pass to validate that this isn't going to break things for some unforseen reason. Thanks! |
|
Awesome! |
Address AB#1475048
LOH allocation for

CompletionItem[]andCompletionItemWithHighlight[]are gone.this will break our CI integration tests, so I queued DartLab integration test run with latest VS build which passed
https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=6272608&view=results