Nimblesite / Nimblesite/SharpLsp

Roslyn's MEF-based "Generate overrides..." leaks into headless code actions and throws on apply

Open
#201 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
132
Forks
5
Avg merge
6h 24m
Merged PRs (30d)
27

Description

What

Requesting code actions on a type declaration can surface Roslyn's own Generate overrides... provider alongside the sidecar's headless replacement (HeadlessOverrideCodeAction). Resolving the Roslyn one fails:

Service of type 'Microsoft.CodeAnalysis.PickMembers.IPickMembersService' is required
to accomplish the task but is not available from 'MSBuildWorkspace' workspace.

IPickMembersService is a MEF-composed IDE service that does not exist in a headless MSBuildWorkspace, which is precisely why HeadlessOverrideCodeAction exists. Both actions carry the identical title Generate overrides..., so which one a client gets depends on ordering — the user sees an action that sometimes works and sometimes errors.

Reproduce

Observed against src/editors/vscode/test-fixtures-style sources while writing HeadlessOverrideGenerationTests. Put the caret on the identifier of an abstract class that inherits only object's virtuals (so the headless provider contributes nothing), request code actions, then resolve the Generate overrides... entry.

Expected

MEF-dependent providers that cannot run headlessly should be filtered out of the code-action list, so the only Generate overrides... offered is the one that actually works. A duplicate title should never be ambiguous.

Notes

Not a regression from the current PR — the headless replacement and the leak arrived together. Filed separately rather than widening that PR's scope.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with HeadlessOverrideGenerationTests and the code-action path involving HeadlessOverrideCodeAction, using the src/editors/vscode/test-fixtures-style sources described in the report. Reproduce the duplicate Generate overrides... actions on an abstract class and resolve each entry. Done means the MEF-dependent action is absent from headless results and the remaining action resolves without the IPickMembersService error.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.