-
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
Ensure we only ask for a symbol's documentation comment once #68452
Ensure we only ask for a symbol's documentation comment once #68452
Conversation
This also removes the IStructuralTypeDisplayService we were passing around when we already had (or coud have) language services available.
Right now computing hover information is a fairly expensive portion of an LSIF dump. One small hotspot was we were fetching documentation comment information at least twice: once for the documentation itself and once for computing the exception info. This ensures we fetch it just once per generation. This also generally cleans up the AbstractSymbolDescriptionBuilder: 1. Duplicate local functions for returns/value is unified. 2. Removes a bunch of specific logic in the builder which supported finding the correct documentation in favor of the helper we already had. To support the second one, I added some methods to DocumentationComment to return a DocumentationComment with the contents of a <param> tag as the summary text for a specific parameter; this allows everything else to be able to operate as if that's a regular summary tag and removes some special cases in the code.
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.
VS 17.6 fixed the issues around .dic files having to be UTF-16 encoded, so we can just do this now.
{ | ||
var formatter = Services.GetRequiredLanguageService<IDocumentationCommentFormattingService>(_semanticModel.Language); |
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.
This logic was duplicated in ISymbolExtensions_2.cs, so it's unified now.
using Microsoft.CodeAnalysis.Host; | ||
using Roslyn.Utilities; | ||
|
||
namespace Microsoft.CodeAnalysis.LanguageService | ||
{ | ||
internal abstract partial class AbstractSymbolDisplayService : ISymbolDisplayService | ||
{ | ||
protected readonly LanguageServices Services; | ||
protected readonly IStructuralTypeDisplayService AnonymousTypeDisplayService; |
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.
For some reason we were passing around both LanguageServices and also one instance of a specific language service, so cleaned up.
@@ -328,6 +328,14 @@ private void ParseCallback(XmlReader reader) | |||
return text; | |||
} | |||
|
|||
public DocumentationComment? GetParameter(string parameterName) |
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.
I should add some better doc comments here -- but to simplify handling in the other parts of the code, the idea here is if we have a member, we can create a new DocumentationComment object that has a <summary>
tag with the same contents, so everything else can treat that identically.
Right now computing hover information is a fairly expensive portion of an LSIF dump. One small hotspot was we were fetching documentation comment information at least twice: once for the documentation itself and once for computing the exception info. This ensures we fetch it just once per generation.
This also generally cleans up the AbstractSymbolDescriptionBuilder:
To support the second one, I added some methods to DocumentationComment to return a DocumentationComment with the contents of a tag as the summary text for a specific parameter; this allows everything else to be able to operate as if that's a regular summary tag and removes some special cases in the code.
This by itself isn't the hugest speedup (maybe a couple of percent) but generally makes the code easier to follow and easier to see where the remaining expensive bits are in traces.