-
Notifications
You must be signed in to change notification settings - Fork 675
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
Make Virtual document tracking apply to specific scheme. #2562
Make Virtual document tracking apply to specific scheme. #2562
Conversation
|
||
// We wait until project state on the server has been initialized to add any virtual documents. | ||
|
||
server.waitForEmptyEventQueue().then(async () => { |
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.
@rchande @akshita31 this is ugly but essentially we need to wait until all of the projects have been initialized so we wait for the project initialization process to start and then in the background (we're not awaiting this) queue up a virtual document tracker initialization step. All of this is to ensure that we don't try and initialize a virtual document before its corresponding project is ready.
I thought about trying to assume the project in this virtual document tracker but figured that'd break functionality for anyone who truly just wanted a miscellaneous project only virtual document.
If there's a better way to do this i'm all ears.
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 don't think this is doing what you want. waitForEmptyEventQueue() waits for all the pending extension -> omnisharp messages to be send and responded to over the stdio communication channel. It doesn't have any knowledge of when OmniSharp is done loading projects (and unfortunately, there's no such message at the moment).
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.
@NTaylorMullen Why are we trying to wait for all projects to be initialized?
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.
Ya I figured I was using it incorrectly, but once the project resolution flow started it seemed to only return once they'd all been loaded.
If we try and add a virtual document before it's corresponding project has been loaded it gets added to the Misc workspace project. Because of that it can't see any of the projects types.
What would you suggest as an alternative?
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 believe it should get "promoted" to being a non-misc file if a project loads it after it's added as a misc file. If that's not the case, we should make it so. Have you actually seen it fail to promote the file?
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 believe it should get "promoted" to being a non-misc file if a project loads it after it's added as a misc file. If that's not the case, we should make it so. Have you actually seen it fail to promote the file?
Seems that way, or the promotion takes a super long time. From what I looked at it seemed that only MSBuild included file are promoted once a project has been loaded. Probably missing something though. Want to sit down and person and debug?
Codecov Report
@@ Coverage Diff @@
## master #2562 +/- ##
==========================================
- Coverage 65.08% 64.56% -0.53%
==========================================
Files 98 98
Lines 4248 4273 +25
Branches 613 620 +7
==========================================
- Hits 2765 2759 -6
- Misses 1304 1330 +26
- Partials 179 184 +5
Continue to review full report at Codecov.
|
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.
As discussed, misc file -> proj associated needs to get implemented in omnisharp. If you remove lines 150-152 in virtualDocumentTracker this lgtm.
- Also fixed issue where we'd attempt to initialize virtual documents before the project world was ready. This is an issue because virtual documents don't exist as part of the MSBuild piece of the project and therefore would more-often than not get put into the miscellaneous project on the server; resulting in bad IntelliSense. - Fixed the diagnostic provider to also obey the new `virtualCSharp-*` scheme requirement - Changed the default change forwarder to ignore virtual documents to ensure that it doesn't try and trigger any changes for them until the server is ready. OmniSharp/omnisharp-vscode#dotnet#2538 aspnet/Razor.VSCode#105
b334b64
to
fcdad6b
Compare
@rchande @akshita31 the failure that's happening on travis in this PR is happening in master on my Mac as well. Looks like an unrelated issue, that known? |
@NTaylorMullen Is this ready to merge? |
Yup go for it. |
virtualCSharp-*
scheme requirementFixes #2538
Fixes aspnet/Razor.VSCode#105
@rchande @akshita31 @SteveSandersonMS
@akshita31 I ported your changes to this PR and made the few PR requested changes. Also, I as well couldn't add a negative test for the virtual document tracking for reasons here.