Skip to content
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

Merged
merged 4 commits into from
Jul 24, 2024

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
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Jul 22, 2024
@@ -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));
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.

@dibarbet dibarbet merged commit 9177306 into dotnet:main Jul 24, 2024
25 checks passed
@dibarbet dibarbet deleted the metadata_language_features branch July 24, 2024 01:10
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Jul 24, 2024
@RikkiGibson RikkiGibson modified the milestones: Next, 17.12 P1 Jul 29, 2024
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