-
Notifications
You must be signed in to change notification settings - Fork 231
Closed
Labels
Milestone
Description
When you launch VS Code with a Razor file open from a previous session, or you just open a Razor file while everything is still spinning up, the experience with cohosting is not great. Here are a few thoughts/ideas/causes:
- I confirmed that we are correctly registering for the semantic token refresh in Roslyn, and it does fire refresh messages on project changes, so it should be picking up the project load etc. Either this is happening too early, or whatever it is that means the source generator will successfully run is not a specific project change.
- Running the generator in misc files might help remove a bunch of "Could not get code document" errors: Automatically hook up the source generator in Misc Files #11833
- Explicitly handling that exception and returning null could mean the client will re-query us
- Us firing a semantic tokens refresh the first time we don't get the error might be worthwhile
- MEF composition creation feels slow so so caching (Cache our OOP MEF composition #11830) could help there
- We also could create the MEF composition during initialization (ie, in https://github.com/dotnet/razor/blob/main/src/Razor/src/Microsoft.VisualStudioCode.RazorExtension/Services/VSCodeRemoteServicesInitializer.cs), and since that happens inside the
initializedLSP request, VS Code will presumably wait for it to finish before flooding us with requests.