-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Recalculate if LSP inlay hint cache miss #75709
Conversation
src/LanguageServer/Protocol/Handler/CodeLens/CodeLensResolveHandler.cs
Outdated
Show resolved
Hide resolved
{ | ||
ErrorCode = LspErrorCodes.ContentModified | ||
}; | ||
} | ||
|
||
var taggedText = await inlineHintToResolve.GetDescriptionAsync(document, cancellationToken).ConfigureAwait(false); | ||
var inlineHintToResolve = GetCacheEntry(resolveData, inlayHintCache); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to audit any other cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you're talking about other caches in different handlers, I believe we're good. We only also use a cache in completion, which doesn't have this same issue - switching editor focus will always dismiss the previous list
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
switching editor focus will always dismiss the previous list
Perhaps. Though that seemsl ike a host-specific behavior. Would we have an issue if the host chnaged and decided to not do that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: i'm not saying we need to do anything here. Just wanted to have this occupy a few brain cycles thinking about this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the client ever allowed multiple completion sessions at once, then completion will function, but at a slightly degraded experience - the items could be committed, but would not have documentation. Additionally items with additional text edits (for example unimported types), or complex edits (for example override completion) would only apply the word edit, and not the additional ones.
It may be technically possible to recalculate in completion - but that would slow down the resolve request a fair amount. IMHO if we want to support the multiple lists at once scenario I'd much prefer adding something to the spec similar to microsoft/language-server-protocol#1802 (comment) that allows the client to tell us which completion items to hold onto (and for how long).
src/LanguageServer/Protocol/Handler/InlayHint/InlayHintResolveHandler.cs
Show resolved
Hide resolved
|
||
var inlineHintService = document.GetRequiredLanguageService<IInlineHintsService>(); | ||
var hints = await inlineHintService.GetInlineHintsAsync(document, textSpan, options, resolveData.DisplayAllOverride, cancellationToken).ConfigureAwait(false); | ||
var hints = await InlayHintHandler.CalculateInlayHintsAsync(document, resolveData.Range, options, resolveData.DisplayAllOverride, cancellationToken).ConfigureAwait(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you :)
Resolves one of the failures listed in https://prism.vsdata.io/failure/?query=%20sev!%3DDiagnostic%20p%3Dcsdevkit&eventType=fault&failureType=hits&failureHash=32e9e891-7092-eff4-347c-8767c8db6ba0
Not too hard to repro in VSCode - having a few editors opened side by side will cause cache misses when resolving inlay hints between the different editors. Instead of throwing we can easily recalculate.