Skip to content

Move language service support#8722

Merged
tmeschter merged 2 commits intodotnet:mainfrom
tmeschter:221214-MoveLanguageServiceSupport
Dec 16, 2022
Merged

Move language service support#8722
tmeschter merged 2 commits intodotnet:mainfrom
tmeschter:221214-MoveLanguageServiceSupport

Conversation

@tmeschter
Copy link
Copy Markdown
Contributor

@tmeschter tmeschter commented Dec 14, 2022

In dotnet/roslyn#65592 the Roslyn team defined a new brokered service for communicating information from the project system to the language service. In effect, the IWorkspaceProjectContext and IWorkspaceProjectContextFactory types are being replaced by the very similar IWorkspaceProject and IWorkspaceProjectFactoryService types, but it isn't happening all at once. In preparation, this commit moves all the code depending on IWorkspaceProjectContext and IWorkspaceProjectContextFactory out of our host-agnostic layer (Microsoft.VisualStudio.ProjectSystem.Managed) and into our VS-specific layer (Microsoft.VisualStudio.ProjectSystem.Managed.VS). Specific changes:

  1. Any files that actually call the old interfaces are moved as-is to the VS layer.
  2. Any further files that depend on those files in 1 are moved as well.
  3. Files that refer to the old interfaces only in comments or doc comments have been updated to use phrases like "language service project" instead but have otherwise been left in place.
  4. The dependency on the Microsoft.VisualStudio.LanguageServices package has moved from the host-agnostic layer to the VS-specific layer.
  5. The DotNetImportsEnumProvider has also moved to the VS layer, as it depends on the VisualStudioWorkspace type. The host-agnostic layer no longer references the assembly with that type.
  6. Unit test files have also been moved around to reflect the new layering.

There are a few further dependencies on the Roslyn Workspace type in Microsoft.VisualStudio.ProjectSystem.Managed; those will be moved in a future change as direct access to a Workspace is very much dependent on VS.

Microsoft Reviewers: Open in CodeFlow

The dotnet/roslyn#65592 the Roslyn team defined a new brokered service for communicating information from the project system to the language service. In effect, the `IWorkspaceProjectContext` and `IWorkspaceProjectContextFactory` types are being replaced by the very similar `IWorkspaceProject` and `IWorkspaceProjectFactoryService` types, but it isn't happening all at once. In preparation, this commit moves all the code depending on `IWorkspaceProjectContext` and `IWorkspaceProjectContextFactory` out of our host-agnostic layer (Microsoft.VisualStudio.ProjectSystem.Managed) and into our VS-specific layer (Microsoft.VisualStudio.ProjectSystem.Managed.VS). Specific changes:

1. Any files that actually call the old interfaces are moved as-is to the VS layer.
2. Any further files that depend on those files in 1 are moved as well.
3. Files that refer to the old interfaces only in comments or doc comments have been updated to use phrases like "language service project" instead but have otherwise been left in place.
4. The dependency on the Microsoft.VisualStudio.LanguageServices package has moved from the host-agnostic layer to the VS-specific layer.
5. The `DotNetImportsEnumProvider` has also moved to the VS layer, as it depends on the `VisualStudioWorkspace` type. The host-agnostic layer no longer references the assembly with that type.
6. Unit test files have also been moved around to reflect the new layering.

There are a few further dependencies on the Roslyn `Workspace` type in Microsoft.VisualStudio.ProjectSystem.Managed; those will be moved in a future change as direct access to a `Workspace` is very much dependent on VS.
Update the comment on `LanguageServiceRules` to provide some guidance on what types will make use of these rules.
@tmeschter tmeschter requested a review from a team as a code owner December 14, 2022 22:40
@tmeschter
Copy link
Copy Markdown
Contributor Author

Oops, meant to request @drewnoakes review of this, not assign it to him. Apologies.

@tmeschter tmeschter merged commit 058d84d into dotnet:main Dec 16, 2022
@tmeschter tmeschter deleted the 221214-MoveLanguageServiceSupport branch December 16, 2022 17:52
@ghost ghost added this to the 17.5 milestone Dec 16, 2022
drewnoakes added a commit to drewnoakes/project-system that referenced this pull request Nov 23, 2023
The language service is split between the VS and host-agnostic layers. Historically, we needed to call into the host from the lower layer, and did that via the `ILanguageServiceHostEnvironment` interface.

In dotnet#8722, some of that code was moved up into the VS layer. As a result, this abstraction is no longer needed and we can clean things up a little and reduce the size of the MEF graph.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants