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

Help needed: how to implement services for code actions that shows UI with custom workspace. #33277

Closed
savpek opened this issue Feb 10, 2019 · 5 comments
Assignees
Labels
Area-IDE Concept-API This issue involves adding, removing, clarification, or modification of an API. Question
Milestone

Comments

@savpek
Copy link

savpek commented Feb 10, 2019

I am trying to solve issue on omnisharp OmniSharp/omnisharp-roslyn#1220 which basically at simplest version is:

  1. Invoke action with options (like generate constructor).
  2. Use some defaults in place of UI options, don't pop ui.

Later on this could be replaced with fancier implementation.

However when i tried to implement them, i constantly face null reference errors. Source seems to be (in
constructor generator case):
http://source.roslyn.io/#Microsoft.CodeAnalysis.Features/GenerateConstructorFromMembers/GenerateConstructorFromMembersCodeRefactoringProvider.GenerateConstructorWithDialogCodeAction.cs,46

Which points to missing IPickMembersService implementation from workspace services. However interface http://source.roslyn.io/#Microsoft.CodeAnalysis.Features/PickMembers/IPickMembersService.cs,8cff688d6aa8c9b2 is internal.

Extract interface is likely blocked same way http://source.roslyn.io/#Microsoft.CodeAnalysis.Features/ExtractInterface/IExtractInterfaceOptionsService.cs,10b646dc7f2b7496

Is this feature impossible to implement at current Roslyn or have i understood something wrong? Those interfaces seems correct place to extend feature to work without visual studio specific services like http://source.roslyn.io/#Microsoft.VisualStudio.LanguageServices/Implementation/ExtractInterface/VisualStudioExtractInterfaceOptionsService.cs,70a52353ba9300a3 or http://source.roslyn.io/#Microsoft.VisualStudio.LanguageServices/Implementation/PickMembers/VisualStudioPickMembersService.cs,79994aa8f3e826c4

@savpek savpek changed the title Help needed: how to implement services for code actions that shows UI. Help needed: how to implement services for code actions that shows UI with custom workspace. Feb 10, 2019
@CyrusNajmabadi
Copy link
Member

Which points to missing IPickMembersService implementation from workspace services. However interface http://source.roslyn.io/#Microsoft.CodeAnalysis.Features/PickMembers/IPickMembersService.cs,8cff688d6aa8c9b2 is internal.

Being internal shouldn't matter. These are Mef exported interfaces. So as long as an appropriate impl has been exported, these will work.

@jinujoseph jinujoseph added Question Area-IDE Concept-API This issue involves adding, removing, clarification, or modification of an API. labels Feb 12, 2019
@jinujoseph jinujoseph added this to the 16.1 milestone Feb 12, 2019
@savpek
Copy link
Author

savpek commented Feb 24, 2019

Figured out how to get around internals.

Few notices that could make this easier to implement:

  • Theres several interfaces (in this case IExtractInterfaceOptionsService, IPickMembersService) that were internal. Proxied around them. Probably these are good extension points for public?
  • Their result types were internal.
  • Error messages. Documentation is one thing but small point that could pointed out to right direction immeditaly were that if there could be error like "Could not find IPickMembersService from workspace services" instead of null referecence exception. That way any following consumer of API could figure it nearly instantly whats wrong.

Hopefully you can make official support for 16.1 milestone where it's currently 🙂

@CyrusNajmabadi
Copy link
Member

* Probably these are good extension points for public?

These are the interfaces hosts are expected to be able to provide to use these services.

* Their result types were internal.

Yes, intentional. These APIs are not sufficiently solid to make public.

Hopefully you can make official support for 16.1 milestone where it's currently

Could you clarify? Make support of what official?

@savpek
Copy link
Author

savpek commented Feb 24, 2019

I meant that there´s way to do it against public apis instead of internal ones. This issue was put on milestone 16.1, does that mean that theres plan to do something for api or something else?

@jinujoseph jinujoseph modified the milestones: 16.1, Backlog Apr 24, 2019
@CyrusNajmabadi
Copy link
Member

Closing out as we have no plans to make our internal ui interfaces public.

@CyrusNajmabadi CyrusNajmabadi closed this as not planned Won't fix, can't repro, duplicate, stale Oct 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Concept-API This issue involves adding, removing, clarification, or modification of an API. Question
Projects
None yet
Development

No branches or pull requests

4 participants