Skip to content

Conversation

@dibarbet
Copy link
Member

@dibarbet dibarbet commented Jul 22, 2024

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).

metadata_lang_features

@dibarbet dibarbet requested a review from a team as a code owner July 22, 2024 22:42
@ghost ghost added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Jul 22, 2024
// 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));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this pattern?

Copy link
Member Author

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.

Copy link
Member

@CyrusNajmabadi CyrusNajmabadi left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support language features in metadata / decompiled source files

5 participants