-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Adds support for metadata LSP language features in VSCode #74488
Conversation
src/Features/Core/Portable/MetadataAsSource/DecompilationMetadataAsSourceFileProvider.cs
Show resolved
Hide resolved
src/Features/Core/Portable/MetadataAsSource/DecompilationMetadataAsSourceFileProvider.cs
Show resolved
Hide resolved
src/Features/Core/Portable/MetadataAsSource/IMetadataAsSourceFileProvider.cs
Outdated
Show resolved
Hide resolved
@@ -99,7 +99,7 @@ protected override IRequestExecutionQueue<RequestContext> ConstructRequestExecut | |||
// those cases, we do not need to add an additional workspace to manage new files we hear about. So only | |||
// add the LspMiscellaneousFilesWorkspace for hosts that have not already brought their own. | |||
if (serverKind == WellKnownLspServerKinds.CSharpVisualBasicLspServer) | |||
AddLazyService<LspMiscellaneousFilesWorkspace>(lspServices => new LspMiscellaneousFilesWorkspace(lspServices, hostServices)); | |||
AddLazyService<LspMiscellaneousFilesWorkspace>(lspServices => lspServices.GetRequiredService<LspMiscellaneousFilesWorkspaceProvider>().CreateLspMiscellaneousFilesWorkspace(lspServices, hostServices)); |
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.
why this pattern?
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.
The misc files workspace now requires dependencies from both regular mef (IMetadataAsSourceFileService) and directly from the base language server instance (HostServices) that aren't available as MEF services.
So the provider can import the MEF service normally, then gets passed in the HostServices by the instance.
src/LanguageServer/Protocol/Workspaces/LspMiscellaneousFilesWorkspaceProvider.cs
Outdated
Show resolved
Hide resolved
src/LanguageServer/Protocol/Workspaces/LspMiscellaneousFilesWorkspace.cs
Outdated
Show resolved
Hide resolved
src/LanguageServer/ProtocolUnitTests/Metadata/LspMetadataAsSourceWorkspaceTests.cs
Outdated
Show resolved
Hide resolved
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.
overall ok. i do think locking of some form would be good.
Resolves dotnet/vscode-csharp#5787
In VS, the VS misc workspace delegates to the MetadataAsSource workspace to open the file if it recognizes a metadata file. This was not happening in VSCode because we do not use the VS misc workspace. So files would get generated, but never added to the MetadataAsSource workspace.
Instead, I added similar functionality to the LSP misc files workspace (to add/remove from MetadataAsSource if a metadata file is opened/closed).