Share SyntaxContext among all internal CompletionProviders#61057
Merged
genlu merged 2 commits intodotnet:mainfrom May 10, 2022
Merged
Share SyntaxContext among all internal CompletionProviders#61057genlu merged 2 commits intodotnet:mainfrom
genlu merged 2 commits intodotnet:mainfrom
Conversation
sharwell
reviewed
May 6, 2022
src/Features/Core/Portable/Completion/CompletionServiceWithProviders.cs
Outdated
Show resolved
Hide resolved
sharwell
reviewed
May 6, 2022
src/Features/Core/Portable/Completion/Providers/AbstractSymbolCompletionProvider.cs
Outdated
Show resolved
Hide resolved
sharwell
reviewed
May 6, 2022
src/Features/Core/Portable/Completion/CompletionServiceWithProviders.cs
Outdated
Show resolved
Hide resolved
sharwell
reviewed
May 6, 2022
sharwell
suggested changes
May 6, 2022
Contributor
sharwell
left a comment
There was a problem hiding this comment.
Overall looks good, but need to optimize the fast path for the comments marked with ❗
c6167af to
92b54e9
Compare
via CompletionContext during a completion session to reduce repeat computation.
92b54e9 to
7dc3c66
Compare
sharwell
approved these changes
May 9, 2022
src/Features/Core/Portable/Completion/SharedSyntaxContextsWithSpeculativeModel.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/Completion/SharedSyntaxContextsWithSpeculativeModel.cs
Outdated
Show resolved
Hide resolved
9123da7 to
fa2553a
Compare
fa2553a to
364d352
Compare
sharwell
reviewed
May 10, 2022
| return _cache.GetOrAdd(document, d => AsyncLazy.Create(cancellationToken | ||
| => CompletionHelper.CreateSyntaxContextWithExistingSpeculativeModelAsync(document, position, cancellationToken), cacheResult: true)); | ||
| // Extract a local function to avoid creating a closure for code path of cache hit. | ||
| AsyncLazy<SyntaxContext> GetLazySyntaxContextWithSpeculativeModel(Document document) |
Contributor
There was a problem hiding this comment.
💡 Best to make this a static local function to guarantee the lack of a closure. The caller can pass this to a parameter named self.
Member
Author
There was a problem hiding this comment.
Sure, will clean this up in a new PR
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
via CompletionContext during a completion session to reduce repeat computation.
Fixes AB#1460014