-
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
Respect MSBuild globs after initial project load #1841
Respect MSBuild globs after initial project load #1841
Conversation
Great 😄. I didn't know about GetAllGlobs(). It is really a much better solution than mine. In the meantime I was trying to hook an event to trigger a design time build to just update the source files, but I was unsure of how to do it properly. I tested your solution and it worked fine for me. If this is accepted I can close my PR. |
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.
Waiting on some comments from some others as well, but I like it!
Only one minor question from me.
@@ -187,6 +192,7 @@ private ProjectData() | |||
AnalyzerConfigFiles = analyzerConfigFiles.EmptyIfDefault(); | |||
ReferenceAliases = referenceAliases; | |||
ProjectReferenceAliases = projectReferenceAliases; | |||
FileInclusionGlobs = fileInclusionGlobs; | |||
} | |||
|
|||
public static ProjectData Create(MSB.Evaluation.Project 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.
Would there be any benefit in including the globs as part of the data returned by this method as well?
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.
Sorry for the late reply! I've investigated a bit, and it seems that this codepath is used when solution contains projects outside the target workspace folder. Since they do get added to the workspace, it's probably worth a fix
We use |
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.
thanks a lot, I think this is definitely an improvement for us
@SirIntruder would you mind resolving conflicts - looks like a merge caused it to no longer build |
I may have broken this one too trying to resolve conflicts. I think I'll pull this down tonight and get it working. |
I've fixed the build error, I'll swing back and check to make sure the build passed later |
Thanks @SirIntruder |
Currently, Omnisharp often glitches randomly when new documents are added, or projects get restored (which triggers "FileAdded" events under the hood)
The core issue is that the way MSBuild resolves "which path belongs to which project" can get much more complicated than what omnisharp's crude heuristic can handle. So everything is fine on initial project load, but subsequential changes cause errors.
#1704 lists a lot of connected issues. I've tried to pull this PR and test it, but it turns out:
What we really need is to have a way to ask MSBuild "Should this file be in this project?". The closest thing I've found to that is MSBuild's GetAllGlobs() method. So this PR proposes storing a list of MSBuild glob objects directly from MSBuild project, and using them to match new files, instead of using any heuristics.