-
Notifications
You must be signed in to change notification settings - Fork 419
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
Load XML docs when using #r directives in scripting #1027
Conversation
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.
Looks good! Just tiny nits from me.
src/OmniSharp.Script/ScriptHelper.cs
Outdated
@@ -7,11 +7,19 @@ | |||
using Microsoft.CodeAnalysis.Scripting; | |||
using Microsoft.CodeAnalysis.Scripting.Hosting; | |||
using Microsoft.Extensions.Configuration; | |||
using System.IO; |
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.
nit: sort System using directives on top.
@@ -5,6 +5,7 @@ | |||
using TestUtility; | |||
using Xunit; | |||
using Xunit.Abstractions; | |||
using System.IO; |
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.
Sort usings with System namespaces an top
@@ -215,6 +215,7 @@ private void AddMetadataReference(ISet<MetadataReference> referenceCollection, s | |||
_logger.LogDebug($"Added reference to '{fileReference}'"); | |||
} | |||
|
|||
|
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.
nit: Extra blank line
src/OmniSharp.Script/ScriptHelper.cs
Outdated
return MetadataReference.CreateFromFile(path, properties, documentationProvider); | ||
})); | ||
} | ||
|
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.
nit: extra blank line.
src/OmniSharp.Script/ScriptHelper.cs
Outdated
: new CachingScriptMetadataResolver(ScriptMetadataResolver.Default); | ||
return enableScriptNuGetReferences ? | ||
new CachingScriptMetadataResolver(new NuGetMetadataReferenceResolver(_resolver)) : | ||
new CachingScriptMetadataResolver(_resolver); |
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.
nit: for this conditional expression, you have the ?
and :
at the end of the lines. However, below, you have them at the start of the lines. Maybe make these consistent? (I personally prefer the bottom one.)
@@ -47,7 +47,7 @@ public MetadataReference GetMetadataReference(string filePath) | |||
} | |||
|
|||
var displayText = assemblyMetadata.GetModules().FirstOrDefault()?.Name; | |||
|
|||
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.
unintentional whitespace-only change?
fdd796b
to
15fdbbe
Compare
thanks! pushed the requested changes. Also added a changelog entry that I forgot before. |
Fixes #1026
At the moment, the
RuntimeMetadataReferenceResolver
on which we rely when processing#r
directives in scripts, completely ignores XML docs https://github.com/dotnet/roslyn/blob/version-2.4.0/src/Scripting/Core/Hosting/Resolvers/RuntimeMetadataReferenceResolver.cs#L69There is no simple hook in which we can inject it (unless we rewrite/copy entire resolver and all its dependencies), so the fix is applied via 😔 reflection 😔. I'll talk to Tomas to see if we can do something better on the Scripting API side, but for now this should at least fix the problem.
Also attached a test that verifies the functionality.