-
Notifications
You must be signed in to change notification settings - Fork 416
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
Fixed GoToMetadata in CSX #829
Conversation
// we will use temporary project to hold metadata documents | ||
var metadataProject = project.IsSubmission ? project.Solution.AddProject("metadataTemp", "metadataTemp.dll", LanguageNames.CSharp). | ||
WithCompilationOptions(project.CompilationOptions). | ||
WithMetadataReferences(project.MetadataReferences) : project; |
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.
Tiny, tiny, tiny nit: This might be more readable if formatted like so:
C#
var metadataProject = project.IsSubmission
? project.Solution.AddProject("metadataTemp", "metadataTemp.dll", LanguageNames.CSharp)
.WithCompilationOptions(project.CompilationOptions)
.WithMetadataReferences(project.MetadataReferences)
: project;
@@ -136,7 +136,12 @@ public void AddFilesToWorkspace(params TestFile[] testFiles) | |||
this.Workspace, | |||
"project.json", | |||
new[] { "dnx451", "dnxcore50" }, | |||
testFiles); | |||
testFiles.Where(f => f.FileName.EndsWith(".cs", StringComparison.CurrentCultureIgnoreCase)).ToArray()); |
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 want CurrentCulture
? Should that be OrdinalIgnoreCase
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.
ah sure, I just picked "that long thing" from intellisense without thinking twice
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.
👍
Fixes #755
At the moment Go To Metadata doesn't work in CSX files. The reason is, in the current implementation of metadata handling on the server, a metadata-document was added to current project. This is not allowed in
submission
type projects (which are used for CSX files), as they can only have one root syntax tree, cannot have namespaces etc. - and an ugly unhandled exception was thrown instead. To fix this, we actually create a temporary project (which is thrown away) for CSX metadata navigation.The fix doesn't affect the original code path so there is no risk merging this. However similar implementation (a temporary project) could also be considered there, because at the moment we flood the current project with new documents every time metadata is accessed. I left it intact because perhaps there was some reason to implement it like that?
I also added GoToMetadata tests for CSX to validate this fix.